llvm-project/clang/test/CodeGen/pragma-fenv_access.c

66 lines
2.3 KiB
C

// RUN: %clang_cc1 -fexperimental-strict-floating-point -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
#pragma STDC FENV_ACCESS ON
float func_01(float x, float y) {
return x + y;
}
// CHECK-LABEL: @func_01
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
float func_02(float x, float y) {
#pragma float_control(except, off)
#pragma STDC FENV_ACCESS OFF
return x + y;
}
// CHECK-LABEL: @func_02
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
float func_03(float x, float y) {
return x + y;
}
// CHECK-LABEL: @func_03
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
#pragma STDC FENV_ACCESS OFF
float func_04(float x, float y) {
#pragma float_control(except, off)
return x + y;
}
// CHECK-LABEL: @func_04
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
float func_05(float x, float y) {
#pragma STDC FENV_ACCESS ON
return x + y;
}
// CHECK-LABEL: @func_05
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
float func_06(float x, float y) {
#pragma float_control(except, off)
return x + y;
}
// CHECK-LABEL: @func_06
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
float func_07(float x, float y) {
x -= y;
if (x) {
#pragma STDC FENV_ACCESS ON
y *= 2;
}
return y + 4;
}
// CHECK-LABEL: @func_07
// CHECK: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
// CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")