60 lines · c
1// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s2// RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t3//4// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s5// RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t6//7// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s8// RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t9//10// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s11// RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t12//13// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s14// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t15//16// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s17// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t18//19// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s20// RUN: FileCheck -check-prefix=CHECK-MIPS32R6 %s < %t21//22// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s23// RUN: FileCheck -check-prefix=CHECK-MIPS64 %s < %t24//25// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s26// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t27//28// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s29// RUN: FileCheck -check-prefix=CHECK-MIPS64R6 %s < %t30 31// NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option32// NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option33 34// CHECK-MIPS2: warning: ignoring '-mnan=2008' option because the 'mips2' architecture does not support it35// CHECK-MIPS3: warning: ignoring '-mnan=2008' option because the 'mips3' architecture does not support it36// CHECK-MIPS4: warning: ignoring '-mnan=2008' option because the 'mips4' architecture does not support it37// CHECK-MIPS32: warning: ignoring '-mnan=2008' option because the 'mips32' architecture does not support it38// CHECK-MIPS32R6: warning: ignoring '-mnan=legacy' option because the 'mips32r6' architecture does not support it39// CHECK-MIPS64: warning: ignoring '-mnan=2008' option because the 'mips64' architecture does not support it40// CHECK-MIPS64R6: warning: ignoring '-mnan=legacy' option because the 'mips64r6' architecture does not support it41 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 0x7FF400000000000048// CHECK-NAN2008: double 0x7FF800000000000049 50double 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 the54// quiet bit on conversion independently of the setting in clang.55 56// CHECK-NANLEGACY: float 0x7FFC00000000000057// CHECK-NAN2008: float 0x7FF800000000000058 59float f = __builtin_nan("");60