Skip to content

Commit 187686b

Browse files
committed
[CodeGen] add test for NAN creation; NFC
This goes with the APFloat change proposed in D88238. This is copied from the MIPS-specific test in builtin-nan-legacy.c to verify that the normal behavior is correct on other targets without the complication of an inverted quiet bit.
1 parent 8d8cb1a commit 187686b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// RUN: %clang -target aarch64 -emit-llvm -S %s -o - | FileCheck %s
2+
// RUN: %clang -target lanai -emit-llvm -S %s -o - | FileCheck %s
3+
// RUN: %clang -target riscv64 -emit-llvm -S %s -o - | FileCheck %s
4+
// RUN: %clang -target x86_64 -emit-llvm -S %s -o - | FileCheck %s
5+
6+
// Run a variety of targets to ensure there's no target-based difference.
7+
8+
// The builtin always produces a 64-bit (double).
9+
// An SNaN with no payload is formed by setting the bit after the
10+
// the quiet bit (MSB of the significand).
11+
12+
// CHECK: float 0x7FF8000000000000, float 0x7FF4000000000000
13+
// CHECK: double 0x7FF8000000000000, double 0x7FF4000000000000
14+
15+
float f[] = {
16+
__builtin_nan(""),
17+
__builtin_nans(""),
18+
};
19+
20+
double d[] = {
21+
__builtin_nan(""),
22+
__builtin_nans(""),
23+
};

0 commit comments

Comments
 (0)