Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / mips-unsupported-nan.c
blob16cea3c2e7e182e8414779813ea3d6da18c4eca1
1 // RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
2 // RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t
3 //
4 // RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
5 // RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t
6 //
7 // RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
8 // RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t
9 //
10 // RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
11 // RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t
13 // RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
14 // RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
16 // RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
17 // RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
19 // RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
20 // RUN: FileCheck -check-prefix=CHECK-MIPS32R6 %s < %t
22 // RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
23 // RUN: FileCheck -check-prefix=CHECK-MIPS64 %s < %t
25 // RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
26 // RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
28 // RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
29 // RUN: FileCheck -check-prefix=CHECK-MIPS64R6 %s < %t
31 // NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option
32 // NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option
34 // CHECK-MIPS2: warning: ignoring '-mnan=2008' option because the 'mips2' architecture does not support it
35 // CHECK-MIPS3: warning: ignoring '-mnan=2008' option because the 'mips3' architecture does not support it
36 // CHECK-MIPS4: warning: ignoring '-mnan=2008' option because the 'mips4' architecture does not support it
37 // CHECK-MIPS32: warning: ignoring '-mnan=2008' option because the 'mips32' architecture does not support it
38 // CHECK-MIPS32R6: warning: ignoring '-mnan=legacy' option because the 'mips32r6' architecture does not support it
39 // CHECK-MIPS64: warning: ignoring '-mnan=2008' option because the 'mips64' architecture does not support it
40 // CHECK-MIPS64R6: warning: ignoring '-mnan=legacy' option because the 'mips64r6' architecture does not support it
42 // This call creates a QNAN double with an empty payload.
43 // The quiet bit is inverted in legacy mode: it is clear to indicate QNAN,
44 // so the next highest bit is set to maintain NAN (not infinity).
45 // In regular (2008) mode, the quiet bit is set to indicate QNAN.
47 // CHECK-NANLEGACY: double 0x7FF4000000000000
48 // CHECK-NAN2008: double 0x7FF8000000000000
50 double d = __builtin_nan("");
52 // This call creates a QNAN double with an empty payload and then truncates.
53 // llvm::APFloat does not know about the inverted quiet bit, so it sets the
54 // quiet bit on conversion independently of the setting in clang.
56 // CHECK-NANLEGACY: float 0x7FFC000000000000
57 // CHECK-NAN2008: float 0x7FF8000000000000
59 float f = __builtin_nan("");