1 // RUN: %clang_cc1 -fexperimental-strict-floating-point -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefixes=CHECK,STRICT %s
2 // RUN: %clang_cc1 -fexperimental-strict-floating-point -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - -fms-extensions -DMS | FileCheck --check-prefixes=CHECK,STRICT %s
3 // RUN: %clang_cc1 -fexperimental-strict-floating-point -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
6 float func_00(float x
, float y
) {
9 // CHECK-LABEL: @func_00
10 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
11 // DEFAULT: fadd float
15 #pragma fenv_access (on)
17 #pragma STDC FENV_ACCESS ON
20 float func_01(float x
, float y
) {
23 // CHECK-LABEL: @func_01
24 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
27 float func_02(float x
, float y
) {
28 #pragma float_control(except, off)
29 #pragma STDC FENV_ACCESS OFF
32 // CHECK-LABEL: @func_02
33 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
36 float func_03(float x
, float y
) {
39 // CHECK-LABEL: @func_03
40 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
44 #pragma fenv_access (off)
46 #pragma STDC FENV_ACCESS OFF
49 float func_04(float x
, float y
) {
50 #pragma float_control(except, off)
53 // CHECK-LABEL: @func_04
54 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
55 // DEFAULT: fadd float
58 float func_04a(float x
, float y
) {
59 #pragma float_control(except, on)
62 // CHECK-LABEL: @func_04a
63 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
66 float func_05(float x
, float y
) {
67 #pragma STDC FENV_ACCESS ON
70 // CHECK-LABEL: @func_05
71 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
74 float func_06(float x
, float y
) {
75 #pragma float_control(except, off)
78 // CHECK-LABEL: @func_06
79 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
80 // DEFAULT: fadd float
83 float func_07(float x
, float y
) {
86 #pragma STDC FENV_ACCESS ON
91 // CHECK-LABEL: @func_07
92 // STRICT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
93 // STRICT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
94 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
95 // DEFAULT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
96 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
97 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
100 float func_08(float x
, float y
) {
101 #pragma STDC FENV_ROUND FE_UPWARD
102 #pragma STDC FENV_ACCESS ON
105 // CHECK-LABEL: @func_08
106 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.strict")
109 float func_09(float x
, float y
) {
110 #pragma STDC FENV_ROUND FE_TONEAREST
111 #pragma STDC FENV_ACCESS ON
114 // CHECK-LABEL: @func_09
115 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
118 float func_10(float x
, float y
) {
119 #pragma STDC FENV_ROUND FE_TONEAREST
120 #pragma clang fp exceptions(ignore)
121 #pragma STDC FENV_ACCESS ON
124 // CHECK-LABEL: @func_10
125 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
128 float func_11(float x
, float y
) {
129 #pragma STDC FENV_ROUND FE_TONEAREST
130 #pragma clang fp exceptions(ignore)
131 #pragma STDC FENV_ACCESS OFF
134 // CHECK-LABEL: @func_11
135 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
136 // DEFAULT: fadd float
139 float func_12(float x
, float y
) {
140 #pragma clang fp exceptions(maytrap)
141 #pragma STDC FENV_ACCESS ON
144 // CHECK-LABEL: @func_12
145 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
148 float func_13(float x
, float y
) {
149 #pragma clang fp exceptions(maytrap)
150 #pragma STDC FENV_ROUND FE_UPWARD
151 #pragma STDC FENV_ACCESS ON
154 // CHECK-LABEL: @func_13
155 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.maytrap")
158 float func_14(float x
, float y
, float z
) {
159 #pragma STDC FENV_ACCESS ON
162 #pragma STDC FENV_ACCESS OFF
166 // CHECK-LABEL: @func_14
167 // STRICT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
168 // STRICT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
169 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
170 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
173 float func_15(float x
, float y
, float z
) {
174 #pragma STDC FENV_ROUND FE_TOWARDZERO
175 #pragma STDC FENV_ACCESS ON
178 #pragma STDC FENV_ACCESS OFF
182 // CHECK-LABEL: @func_15
183 // STRICT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
184 // STRICT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
185 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
186 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.ignore")
189 float func_16(float x
, float y
) {
192 #pragma STDC FENV_ROUND FE_TONEAREST
193 #pragma STDC FENV_ACCESS ON
197 #pragma STDC FENV_ACCESS ON
201 // CHECK-LABEL: @func_16
202 // STRICT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
203 // STRICT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
204 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
205 // DEFAULT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
206 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
207 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
210 float func_17(float x
, float y
) {
211 #pragma STDC FENV_ROUND FE_DYNAMIC
212 #pragma STDC FENV_ACCESS ON
215 // CHECK-LABEL: @func_17
216 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
219 float func_18(float x
, float y
) {
220 #pragma STDC FENV_ROUND FE_DYNAMIC
223 // CHECK-LABEL: @func_18
224 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
225 // DEFAULT: fadd float