| 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 |
| 12 |
// |
| 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 |
| 15 |
// |
| 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 |
| 18 |
// |
| 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 |
| 21 |
// |
| 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 |
| 24 |
// |
| 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 |
| 27 |
// |
| 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 |
| 30 |
|
| 31 |
// NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option |
| 32 |
// NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option |
| 33 |
|
| 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 |
| 41 |
|
| 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. |
| 46 |
|
| 47 |
// CHECK-NANLEGACY: double 0x7FF4000000000000 |
| 48 |
// CHECK-NAN2008: double 0x7FF8000000000000 |
| 49 |
|
| 50 |
double d = __builtin_nan(""); |
| 51 |
|
| 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. |
| 55 |
|
| 56 |
// CHECK-NANLEGACY: float 0x7FFC000000000000 |
| 57 |
// CHECK-NAN2008: float 0x7FF8000000000000 |
| 58 |
|
| 59 |
float f = __builtin_nan(""); |