brintos

brintos / llvm-project-archived public Read only

0
0
Text · 772 B · 44638e0 Raw
24 lines · c
1// RUN: %clang_cc1 -fno-strict-float-cast-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=NOSTRICT2 3// When compiling with non-standard semantics, use intrinsics to inhibit the optimizer.4// This used to require a function attribute, so we check that it is NOT here anymore.5 6// NOSTRICT-LABEL: main7// NOSTRICT: call i32 @llvm.fptosi.sat.i32.f648// NOSTRICT: call i32 @llvm.fptoui.sat.i32.f649// NOSTRICT-NOT: strict-float-cast-overflow10 11// The workaround attribute is not applied by default.12 13// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s --check-prefix=STRICT14// STRICT-LABEL: main15// STRICT: = fptosi16// STRICT: = fptoui17// STRICT-NOT: strict-float-cast-overflow18 19 20int main(void) {21  double d = 1e20;22  return (int)d != 1e20 && (unsigned)d != 1e20;23}24