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 -frounding-math -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefixes=CHECK,STRICT-RND %s
3 // 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
4 // RUN: %clang_cc1 -fexperimental-strict-floating-point -frounding-math -ffp-exception-behavior=strict -triple %itanium_abi_triple -emit-llvm %s -o - -fms-extensions -DMS | FileCheck --check-prefixes=CHECK,STRICT-RND %s
5 // RUN: %clang_cc1 -fexperimental-strict-floating-point -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefixes=CHECK,DEFAULT %s
6 // RUN: %clang_cc1 -fexperimental-strict-floating-point -frounding-math -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefixes=CHECK,DEFAULT-RND %s
8 float func_00(float x
, float y
) {
11 // CHECK-LABEL: @func_00
12 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
13 // STRICT-RND: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
14 // DEFAULT-RND: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
15 // DEFAULT: fadd float
19 #pragma fenv_access (on)
21 #pragma STDC FENV_ACCESS ON
24 float func_01(float x
, float y
) {
27 // CHECK-LABEL: @func_01
28 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
31 float func_02(float x
, float y
) {
32 #pragma float_control(except, off)
33 #pragma STDC FENV_ACCESS OFF
36 // CHECK-LABEL: @func_02
37 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
40 float func_03(float x
, float y
) {
43 // CHECK-LABEL: @func_03
44 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
48 #pragma fenv_access (off)
50 #pragma STDC FENV_ACCESS OFF
53 float func_04(float x
, float y
) {
54 #pragma float_control(except, off)
57 // CHECK-LABEL: @func_04
58 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
59 // DEFAULT: fadd float
62 float func_04a(float x
, float y
) {
63 #pragma float_control(except, on)
66 // CHECK-LABEL: @func_04a
67 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
70 float func_05(float x
, float y
) {
71 #pragma STDC FENV_ACCESS ON
74 // CHECK-LABEL: @func_05
75 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
78 float func_06(float x
, float y
) {
79 #pragma float_control(except, off)
82 // CHECK-LABEL: @func_06
83 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
84 // DEFAULT: fadd float
87 float func_07(float x
, float y
) {
90 #pragma STDC FENV_ACCESS ON
95 // CHECK-LABEL: @func_07
96 // STRICT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
97 // STRICT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
98 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
99 // DEFAULT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
100 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
101 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
104 float func_08(float x
, float y
) {
105 #pragma STDC FENV_ROUND FE_UPWARD
106 #pragma STDC FENV_ACCESS ON
109 // CHECK-LABEL: @func_08
110 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.strict")
113 float func_09(float x
, float y
) {
114 #pragma STDC FENV_ROUND FE_TONEAREST
115 #pragma STDC FENV_ACCESS ON
118 // CHECK-LABEL: @func_09
119 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
122 float func_10(float x
, float y
) {
123 #pragma STDC FENV_ROUND FE_TONEAREST
124 #pragma clang fp exceptions(ignore)
125 #pragma STDC FENV_ACCESS ON
128 // CHECK-LABEL: @func_10
129 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
132 float func_11(float x
, float y
) {
133 #pragma STDC FENV_ROUND FE_TONEAREST
134 #pragma clang fp exceptions(ignore)
135 #pragma STDC FENV_ACCESS OFF
138 // CHECK-LABEL: @func_11
139 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
140 // DEFAULT: fadd float
143 float func_12(float x
, float y
) {
144 #pragma clang fp exceptions(maytrap)
145 #pragma STDC FENV_ACCESS ON
148 // CHECK-LABEL: @func_12
149 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
152 float func_13(float x
, float y
) {
153 #pragma clang fp exceptions(maytrap)
154 #pragma STDC FENV_ROUND FE_UPWARD
155 #pragma STDC FENV_ACCESS ON
158 // CHECK-LABEL: @func_13
159 // CHECK: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.maytrap")
162 float func_14(float x
, float y
, float z
) {
163 #pragma STDC FENV_ACCESS ON
166 #pragma STDC FENV_ACCESS OFF
170 // CHECK-LABEL: @func_14
171 // STRICT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
172 // STRICT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
173 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
174 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
177 float func_15(float x
, float y
, float z
) {
178 #pragma STDC FENV_ROUND FE_TOWARDZERO
179 #pragma STDC FENV_ACCESS ON
182 #pragma STDC FENV_ACCESS OFF
186 // CHECK-LABEL: @func_15
187 // STRICT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
188 // STRICT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
189 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.strict")
190 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32({{.*}}, metadata !"round.towardzero", metadata !"fpexcept.ignore")
193 float func_16(float x
, float y
) {
196 #pragma STDC FENV_ROUND FE_TONEAREST
197 #pragma STDC FENV_ACCESS ON
201 #pragma STDC FENV_ACCESS ON
205 // CHECK-LABEL: @func_16
206 // STRICT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
207 // STRICT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
208 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
209 // DEFAULT: call float @llvm.experimental.constrained.fsub.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.ignore")
210 // DEFAULT: call float @llvm.experimental.constrained.fmul.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
211 // DEFAULT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
214 float func_17(float x
, float y
) {
215 #pragma STDC FENV_ROUND FE_DYNAMIC
216 #pragma STDC FENV_ACCESS ON
219 // CHECK-LABEL: @func_17
220 // CHECK: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
223 float func_18(float x
, float y
) {
224 #pragma STDC FENV_ROUND FE_DYNAMIC
227 // CHECK-LABEL: @func_18
228 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
229 // DEFAULT: fadd float
231 #pragma STDC FENV_ACCESS ON
232 float func_19(float x
, float y
) {
235 // CHECK-LABEL: @func_19
236 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
238 #pragma STDC FENV_ACCESS OFF
239 float func_20(float x
, float y
) {
242 // CHECK-LABEL: @func_20
243 // STRICT: call float @llvm.experimental.constrained.fadd.f32(float {{.*}}, float {{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
244 // DEFAULT: fadd float