brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.1 KiB · 7445411 Raw
38 lines · c
1// RUN: %clang -target aarch64 -emit-llvm -S %s -o - | FileCheck %s2// RUN: %clang -target lanai -emit-llvm -S %s -o - | FileCheck %s3// RUN: %clang -target riscv64 -emit-llvm -S %s -o - | FileCheck %s4// RUN: %clang -target x86_64 -emit-llvm -S %s -o - | FileCheck %s5 6// Run a variety of targets to ensure there's no target-based difference.7 8// An SNaN with no payload is formed by setting the bit after the9// the quiet bit (MSB of the significand).10 11// CHECK: float 0x7FF8000000000000, float 0x7FF400000000000012 13float f[] = {14  __builtin_nanf(""),15  __builtin_nansf(""),16};17 18 19// Doubles are created and converted to floats.20// Converting (truncating) to float quiets the NaN (sets the MSB21// of the significand) and raises the APFloat invalidOp exception22// but that should not cause a compilation error in the default23// (ignore FP exceptions) mode.24 25// CHECK: float 0x7FF8000000000000, float 0x7FFC00000000000026 27float converted_to_float[] = {28  __builtin_nan(""),29  __builtin_nans(""),30};31 32// CHECK: double 0x7FF8000000000000, double 0x7FF400000000000033 34double d[] = {35  __builtin_nan(""),36  __builtin_nans(""),37};38