2018-05-01 02:19:03 +08:00
|
|
|
// RUN: %clang_cc1 -S -fno-strict-float-cast-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=NOSTRICT
|
2021-12-16 21:37:44 +08:00
|
|
|
|
|
|
|
// When compiling with non-standard semantics, use intrinsics to inhibit the optimizer.
|
2021-12-20 00:53:56 +08:00
|
|
|
// This used to require a function attribute, so we check that it is NOT here anymore.
|
2021-12-16 21:37:44 +08:00
|
|
|
|
2018-05-01 02:19:03 +08:00
|
|
|
// NOSTRICT-LABEL: main
|
2021-12-16 21:37:44 +08:00
|
|
|
// NOSTRICT: call i32 @llvm.fptosi.sat.i32.f64
|
|
|
|
// NOSTRICT: call i32 @llvm.fptoui.sat.i32.f64
|
2021-12-20 00:53:56 +08:00
|
|
|
// NOSTRICT-NOT: strict-float-cast-overflow
|
2018-04-27 22:22:48 +08:00
|
|
|
|
|
|
|
// The workaround attribute is not applied by default.
|
|
|
|
|
2020-06-05 10:28:54 +08:00
|
|
|
// RUN: %clang_cc1 -S %s -emit-llvm -o - | FileCheck %s --check-prefix=STRICT
|
2018-05-01 02:19:03 +08:00
|
|
|
// STRICT-LABEL: main
|
2021-12-16 21:37:44 +08:00
|
|
|
// STRICT: = fptosi
|
|
|
|
// STRICT: = fptoui
|
2018-05-01 02:19:03 +08:00
|
|
|
// STRICT-NOT: strict-float-cast-overflow
|
|
|
|
|
2021-12-16 21:37:44 +08:00
|
|
|
|
2022-02-16 05:06:01 +08:00
|
|
|
int main(void) {
|
2021-12-16 21:37:44 +08:00
|
|
|
double d = 1e20;
|
|
|
|
return (int)d != 1e20 && (unsigned)d != 1e20;
|
2018-04-27 22:22:48 +08:00
|
|
|
}
|