File: mips-unsupported-nan.c

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-11
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,418,840 kB
  • sloc: cpp: 5,290,826; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,898; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,913; xml: 953; cs: 573; fortran: 539
file content (59 lines) | stat: -rw-r--r-- 3,633 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
// RUN: FileCheck -check-prefix=CHECK-MIPS2 %s < %t
//
// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
// RUN: FileCheck -check-prefix=CHECK-MIPS3 %s < %t
//
// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips4 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
// RUN: FileCheck -check-prefix=CHECK-MIPS4 %s < %t
//
// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
// RUN: FileCheck -check-prefix=CHECK-MIPS32 %s < %t
//
// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
//
// RUN: %clang -target mipsel-unknown-linux -mnan=2008 -march=mips32r3 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
//
// RUN: %clang -target mipsel-unknown-linux -mnan=legacy -march=mips32r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
// RUN: FileCheck -check-prefix=CHECK-MIPS32R6 %s < %t
//
// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NANLEGACY %s
// RUN: FileCheck -check-prefix=CHECK-MIPS64 %s < %t
//
// RUN: %clang -target mips64el-unknown-linux -mnan=2008 -march=mips64r2 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
// RUN: FileCheck -allow-empty -check-prefix=NO-WARNINGS %s < %t
//
// RUN: %clang -target mips64el-unknown-linux -mnan=legacy -march=mips64r6 -emit-llvm -S %s -o - 2>%t | FileCheck -check-prefix=CHECK-NAN2008 %s
// RUN: FileCheck -check-prefix=CHECK-MIPS64R6 %s < %t

// NO-WARNINGS-NOT: warning: ignoring '-mnan=legacy' option
// NO-WARNINGS-NOT: warning: ignoring '-mnan=2008' option

// CHECK-MIPS2: warning: ignoring '-mnan=2008' option because the 'mips2' architecture does not support it
// CHECK-MIPS3: warning: ignoring '-mnan=2008' option because the 'mips3' architecture does not support it
// CHECK-MIPS4: warning: ignoring '-mnan=2008' option because the 'mips4' architecture does not support it
// CHECK-MIPS32: warning: ignoring '-mnan=2008' option because the 'mips32' architecture does not support it
// CHECK-MIPS32R6: warning: ignoring '-mnan=legacy' option because the 'mips32r6' architecture does not support it
// CHECK-MIPS64: warning: ignoring '-mnan=2008' option because the 'mips64' architecture does not support it
// CHECK-MIPS64R6: warning: ignoring '-mnan=legacy' option because the 'mips64r6' architecture does not support it

// This call creates a QNAN double with an empty payload.
// The quiet bit is inverted in legacy mode: it is clear to indicate QNAN,
// so the next highest bit is set to maintain NAN (not infinity).
// In regular (2008) mode, the quiet bit is set to indicate QNAN.

// CHECK-NANLEGACY: double 0x7FF4000000000000
// CHECK-NAN2008: double 0x7FF8000000000000

double d =  __builtin_nan("");

// This call creates a QNAN double with an empty payload and then truncates.
// llvm::APFloat does not know about the inverted quiet bit, so it sets the
// quiet bit on conversion independently of the setting in clang.

// CHECK-NANLEGACY: float 0x7FFC000000000000
// CHECK-NAN2008: float 0x7FF8000000000000

float f =  __builtin_nan("");