llvm-capstone/clang/test/CodeGen/no-junk-ftrunc.c
Aaron Ballman adc402bf3d Use functions with prototypes when appropriate; NFC
A significant number of our tests in C accidentally use functions
without prototypes. This patch converts the function signatures to have
a prototype for the situations where the test is not specific to K&R C
declarations. e.g.,

  void func();

becomes

  void func(void);

This is the eleventh batch of tests being updated (there are a
significant number of other tests left to be updated).
2022-02-15 16:06:43 -05:00

24 lines
778 B
C

// RUN: %clang_cc1 -S -fno-strict-float-cast-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=NOSTRICT
// When compiling with non-standard semantics, use intrinsics to inhibit the optimizer.
// This used to require a function attribute, so we check that it is NOT here anymore.
// NOSTRICT-LABEL: main
// NOSTRICT: call i32 @llvm.fptosi.sat.i32.f64
// NOSTRICT: call i32 @llvm.fptoui.sat.i32.f64
// NOSTRICT-NOT: strict-float-cast-overflow
// The workaround attribute is not applied by default.
// RUN: %clang_cc1 -S %s -emit-llvm -o - | FileCheck %s --check-prefix=STRICT
// STRICT-LABEL: main
// STRICT: = fptosi
// STRICT: = fptoui
// STRICT-NOT: strict-float-cast-overflow
int main(void) {
double d = 1e20;
return (int)d != 1e20 && (unsigned)d != 1e20;
}