1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -passes=instsimplify -S | FileCheck %s
12 define float @fadd_x_n0_defaultenv(float %a) #0 {
13 ; CHECK-LABEL: @fadd_x_n0_defaultenv(
14 ; CHECK-NEXT: ret float [[A:%.*]]
16 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
20 define <2 x float> @fadd_vec_x_n0_defaultenv(<2 x float> %a) #0 {
21 ; CHECK-LABEL: @fadd_vec_x_n0_defaultenv(
22 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
24 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
28 define float @fadd_x_n0_ebmaytrap(float %a) #0 {
29 ; CHECK-LABEL: @fadd_x_n0_ebmaytrap(
30 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0:[0-9]+]]
31 ; CHECK-NEXT: ret float [[RET]]
33 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
37 define <2 x float> @fadd_vec_x_n0_ebmaytrap(<2 x float> %a) #0 {
38 ; CHECK-LABEL: @fadd_vec_x_n0_ebmaytrap(
39 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
40 ; CHECK-NEXT: ret <2 x float> [[RET]]
42 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
46 define float @fadd_x_n0_ebstrict(float %a) #0 {
47 ; CHECK-LABEL: @fadd_x_n0_ebstrict(
48 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
49 ; CHECK-NEXT: ret float [[RET]]
51 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
55 define <2 x float> @fadd_vec_x_n0_ebstrict(<2 x float> %a) #0 {
56 ; CHECK-LABEL: @fadd_vec_x_n0_ebstrict(
57 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
58 ; CHECK-NEXT: ret <2 x float> [[RET]]
60 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
64 define float @fadd_x_n0_neginf(float %a) #0 {
65 ; CHECK-LABEL: @fadd_x_n0_neginf(
66 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.downward", metadata !"fpexcept.ignore") #[[ATTR0]]
67 ; CHECK-NEXT: ret float [[RET]]
69 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.downward", metadata !"fpexcept.ignore") #0
73 define <2 x float> @fadd_vec_x_n0_neginf(<2 x float> %a) #0 {
74 ; CHECK-LABEL: @fadd_vec_x_n0_neginf(
75 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.downward", metadata !"fpexcept.ignore") #[[ATTR0]]
76 ; CHECK-NEXT: ret <2 x float> [[RET]]
78 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.downward", metadata !"fpexcept.ignore") #0
82 define float @fadd_x_n0_dynamic(float %a) #0 {
83 ; CHECK-LABEL: @fadd_x_n0_dynamic(
84 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.dynamic", metadata !"fpexcept.ignore") #[[ATTR0]]
85 ; CHECK-NEXT: ret float [[RET]]
87 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
91 define <2 x float> @fadd_vec_x_n0_dynamic(<2 x float> %a) #0 {
92 ; CHECK-LABEL: @fadd_vec_x_n0_dynamic(
93 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.dynamic", metadata !"fpexcept.ignore") #[[ATTR0]]
94 ; CHECK-NEXT: ret <2 x float> [[RET]]
96 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.dynamic", metadata !"fpexcept.ignore") #0
100 ; The rounding mode here needs to not be { tonearest, downward, dynamic }.
101 ; Test one of the remaining rounding modes and the rest will be fine.
102 define float @fadd_x_n0_towardzero(float %a) #0 {
103 ; CHECK-LABEL: @fadd_x_n0_towardzero(
104 ; CHECK-NEXT: ret float [[A:%.*]]
106 %ret = call float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.towardzero", metadata !"fpexcept.ignore") #0
110 ; The rounding mode here needs to not be { tonearest, downward, dynamic }.
111 ; Test one of the remaining rounding modes and the rest will be fine.
112 define <2 x float> @fadd_vec_x_n0_towardzero(<2 x float> %a) #0 {
113 ; CHECK-LABEL: @fadd_vec_x_n0_towardzero(
114 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
116 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.towardzero", metadata !"fpexcept.ignore") #0
120 define float @fadd_nnan_x_n0_ebmaytrap(float %a) #0 {
121 ; CHECK-LABEL: @fadd_nnan_x_n0_ebmaytrap(
122 ; CHECK-NEXT: ret float [[A:%.*]]
124 %ret = call nnan float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
128 define <2 x float> @fadd_vec_nnan_x_n0_ebmaytrap(<2 x float> %a) #0 {
129 ; CHECK-LABEL: @fadd_vec_nnan_x_n0_ebmaytrap(
130 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
132 %ret = call nnan <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
136 define float @fadd_nnan_x_n0_ebstrict(float %a) #0 {
137 ; CHECK-LABEL: @fadd_nnan_x_n0_ebstrict(
138 ; CHECK-NEXT: [[RET:%.*]] = call nnan float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
139 ; CHECK-NEXT: ret float [[A]]
141 %ret = call nnan float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
145 define <2 x float> @fadd_vec_nnan_x_n0_ebstrict(<2 x float> %a) #0 {
146 ; CHECK-LABEL: @fadd_vec_nnan_x_n0_ebstrict(
147 ; CHECK-NEXT: [[RET:%.*]] = call nnan <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
148 ; CHECK-NEXT: ret <2 x float> [[A]]
150 %ret = call nnan <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
154 ; Test with a fast math flag set but that flag is not "nnan".
155 define float @fadd_ninf_x_n0_ebstrict(float %a) #0 {
156 ; CHECK-LABEL: @fadd_ninf_x_n0_ebstrict(
157 ; CHECK-NEXT: [[RET:%.*]] = call ninf float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float -0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
158 ; CHECK-NEXT: ret float [[RET]]
160 %ret = call ninf float @llvm.experimental.constrained.fadd.f32(float %a, float -0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
164 ; Test with a fast math flag set but that flag is not "nnan".
165 define <2 x float> @fadd_vec_ninf_x_n0_ebstrict(<2 x float> %a) #0 {
166 ; CHECK-LABEL: @fadd_vec_ninf_x_n0_ebstrict(
167 ; CHECK-NEXT: [[RET:%.*]] = call ninf <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> splat (float -0.000000e+00), metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
168 ; CHECK-NEXT: ret <2 x float> [[RET]]
170 %ret = call ninf <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float><float -0.0, float -0.0>, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
174 define float @fadd_n0_x_defaultenv(float %a) #0 {
175 ; CHECK-LABEL: @fadd_n0_x_defaultenv(
176 ; CHECK-NEXT: ret float [[A:%.*]]
178 %ret = call float @llvm.experimental.constrained.fadd.f32(float -0.0, float %a, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
182 define <2 x float> @fadd_vec_n0_x_defaultenv(<2 x float> %a) #0 {
183 ; CHECK-LABEL: @fadd_vec_n0_x_defaultenv(
184 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
186 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float -0.0, float -0.0>, <2 x float> %a, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
190 ; TODO: Canonicalize the order of the arguments. Then this will fire.
191 define float @fadd_n0_x_ebmaytrap(float %a) #0 {
192 ; CHECK-LABEL: @fadd_n0_x_ebmaytrap(
193 ; CHECK-NEXT: [[RET:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float -0.000000e+00, float [[A:%.*]], metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
194 ; CHECK-NEXT: ret float [[RET]]
196 %ret = call float @llvm.experimental.constrained.fadd.f32(float -0.0, float %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
200 ; TODO: Canonicalize the order of the arguments. Then this will fire.
201 define <2 x float> @fadd_vec_n0_x_ebmaytrap(<2 x float> %a) #0 {
202 ; CHECK-LABEL: @fadd_vec_n0_x_ebmaytrap(
203 ; CHECK-NEXT: [[RET:%.*]] = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> splat (float -0.000000e+00), <2 x float> [[A:%.*]], metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
204 ; CHECK-NEXT: ret <2 x float> [[RET]]
206 %ret = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float -0.0, float -0.0>, <2 x float> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
211 ; fadd X, 0 ==> X, when we know X is not -0
214 define float @fold_fadd_nsz_x_0_defaultenv(float %a) #0 {
215 ; CHECK-LABEL: @fold_fadd_nsz_x_0_defaultenv(
216 ; CHECK-NEXT: ret float [[A:%.*]]
218 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
222 define <2 x float> @fold_fadd_vec_nsz_x_0_defaultenv(<2 x float> %a) #0 {
223 ; CHECK-LABEL: @fold_fadd_vec_nsz_x_0_defaultenv(
224 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
226 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
230 define float @fold_fadd_nsz_x_0_neginf(float %a) #0 {
231 ; CHECK-LABEL: @fold_fadd_nsz_x_0_neginf(
232 ; CHECK-NEXT: ret float [[A:%.*]]
234 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.downward", metadata !"fpexcept.ignore") #0
238 define <2 x float> @fold_fadd_vec_nsz_x_0_neginf(<2 x float> %a) #0 {
239 ; CHECK-LABEL: @fold_fadd_vec_nsz_x_0_neginf(
240 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
242 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.downward", metadata !"fpexcept.ignore") #0
246 define float @fold_fadd_nsz_x_0_ebmaytrap(float %a) #0 {
247 ; CHECK-LABEL: @fold_fadd_nsz_x_0_ebmaytrap(
248 ; CHECK-NEXT: [[ADD:%.*]] = call nsz float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float 0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
249 ; CHECK-NEXT: ret float [[ADD]]
251 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
255 define <2 x float> @fold_fadd_vec_nsz_x_0_ebmaytrap(<2 x float> %a) #0 {
256 ; CHECK-LABEL: @fold_fadd_vec_nsz_x_0_ebmaytrap(
257 ; CHECK-NEXT: [[ADD:%.*]] = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
258 ; CHECK-NEXT: ret <2 x float> [[ADD]]
260 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
264 define float @fold_fadd_nnan_nsz_x_0_ebmaytrap(float %a) #0 {
265 ; CHECK-LABEL: @fold_fadd_nnan_nsz_x_0_ebmaytrap(
266 ; CHECK-NEXT: ret float [[A:%.*]]
268 %add = call nnan nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
272 define <2 x float> @fold_fadd_vec_nnan_nsz_x_0_ebmaytrap(<2 x float> %a) #0 {
273 ; CHECK-LABEL: @fold_fadd_vec_nnan_nsz_x_0_ebmaytrap(
274 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
276 %add = call nnan nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
280 define float @fold_fadd_nsz_x_0_ebstrict(float %a) #0 {
281 ; CHECK-LABEL: @fold_fadd_nsz_x_0_ebstrict(
282 ; CHECK-NEXT: [[ADD:%.*]] = call nsz float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float 0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
283 ; CHECK-NEXT: ret float [[ADD]]
285 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
289 define <2 x float> @fold_fadd_vec_nsz_x_0_ebstrict(<2 x float> %a) #0 {
290 ; CHECK-LABEL: @fold_fadd_vec_nsz_x_0_ebstrict(
291 ; CHECK-NEXT: [[ADD:%.*]] = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
292 ; CHECK-NEXT: ret <2 x float> [[ADD]]
294 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
298 define float @fold_fadd_nsz_nnan_x_0_ebstrict(float %a) #0 {
299 ; CHECK-LABEL: @fold_fadd_nsz_nnan_x_0_ebstrict(
300 ; CHECK-NEXT: [[ADD:%.*]] = call nnan nsz float @llvm.experimental.constrained.fadd.f32(float [[A:%.*]], float 0.000000e+00, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
301 ; CHECK-NEXT: ret float [[A]]
303 %add = call nsz nnan float @llvm.experimental.constrained.fadd.f32(float %a, float 0.0, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
307 define <2 x float> @fold_fadd_vec_nsz_nnan_x_0_ebstrict(<2 x float> %a) #0 {
308 ; CHECK-LABEL: @fold_fadd_vec_nsz_nnan_x_0_ebstrict(
309 ; CHECK-NEXT: [[ADD:%.*]] = call nnan nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> [[A:%.*]], <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
310 ; CHECK-NEXT: ret <2 x float> [[A]]
312 %add = call nsz nnan <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> %a, <2 x float> zeroinitializer, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
316 define float @fold_fadd_nsz_0_x_defaultenv(float %a) #0 {
317 ; CHECK-LABEL: @fold_fadd_nsz_0_x_defaultenv(
318 ; CHECK-NEXT: ret float [[A:%.*]]
320 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float 0.0, float %a, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
324 define <2 x float> @fold_fadd_vec_nsz_0_x_defaultenv(<2 x float> %a) #0 {
325 ; CHECK-LABEL: @fold_fadd_vec_nsz_0_x_defaultenv(
326 ; CHECK-NEXT: ret <2 x float> [[A:%.*]]
328 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> zeroinitializer, <2 x float> %a, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
332 ; TODO: Canonicalize the order of the arguments. Then this will fire.
333 define float @fold_fadd_nsz_0_x_ebmaytrap(float %a) #0 {
334 ; CHECK-LABEL: @fold_fadd_nsz_0_x_ebmaytrap(
335 ; CHECK-NEXT: [[ADD:%.*]] = call nsz float @llvm.experimental.constrained.fadd.f32(float 0.000000e+00, float [[A:%.*]], metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
336 ; CHECK-NEXT: ret float [[ADD]]
338 %add = call nsz float @llvm.experimental.constrained.fadd.f32(float 0.0, float %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
342 ; TODO: Canonicalize the order of the arguments. Then this will fire.
343 define <2 x float> @fold_fadd_vec_nsz_0_x_ebmaytrap(<2 x float> %a) #0 {
344 ; CHECK-LABEL: @fold_fadd_vec_nsz_0_x_ebmaytrap(
345 ; CHECK-NEXT: [[ADD:%.*]] = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> zeroinitializer, <2 x float> [[A:%.*]], metadata !"round.tonearest", metadata !"fpexcept.maytrap") #[[ATTR0]]
346 ; CHECK-NEXT: ret <2 x float> [[ADD]]
348 %add = call nsz <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float> zeroinitializer, <2 x float> %a, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
356 define float @fold_fadd_qnan_qnan_ebmaytrap() #0 {
357 ; CHECK-LABEL: @fold_fadd_qnan_qnan_ebmaytrap(
358 ; CHECK-NEXT: ret float 0x7FF8000000000000
360 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff8000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
364 define float @fold_fadd_qnan_qnan_ebstrict() #0 {
365 ; CHECK-LABEL: @fold_fadd_qnan_qnan_ebstrict(
366 ; CHECK-NEXT: [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
367 ; CHECK-NEXT: ret float 0x7FF8000000000000
369 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff8000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
373 ; Exceptions are ignored, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
375 define float @fold_fadd_snan_variable_ebignore(float %x) #0 {
376 ; CHECK-LABEL: @fold_fadd_snan_variable_ebignore(
377 ; CHECK-NEXT: ret float 0x7FFC000000000000
379 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
383 ; Exceptions may (not) trap, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
385 define float @fold_fadd_snan_variable_ebmaytrap(float %x) #0 {
386 ; CHECK-LABEL: @fold_fadd_snan_variable_ebmaytrap(
387 ; CHECK-NEXT: ret float 0x7FFC000000000000
389 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
393 ; Exceptions are ignored, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
395 define <2 x float> @fold_fadd_vec_snan_variable_ebignore(<2 x float> %x) #0 {
396 ; CHECK-LABEL: @fold_fadd_vec_snan_variable_ebignore(
397 ; CHECK-NEXT: ret <2 x float> <float 0x7FFC000000000000, float 0xFFFC000000000000>
399 %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0x7ff4000000000000, float 0xfff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
403 ; Exceptions may (not) trap, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
405 define <2 x float> @fold_fadd_vec_snan_variable_ebmaytrap(<2 x float> %x) #0 {
406 ; CHECK-LABEL: @fold_fadd_vec_snan_variable_ebmaytrap(
407 ; CHECK-NEXT: ret <2 x float> <float 0xFFFC000000000000, float 0x7FFC000000000000>
409 %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0xfff4000000000000, float 0x7ff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
413 ; Exceptions are ignored, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
415 define <2 x float> @fold_fadd_vec_partial_snan_variable_ebignore(<2 x float> %x) #0 {
416 ; CHECK-LABEL: @fold_fadd_vec_partial_snan_variable_ebignore(
417 ; CHECK-NEXT: ret <2 x float> <float 0x7FFC000000000000, float 0xFFFF000000000000>
419 %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0x7ff4000000000000, float 0xffff000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.ignore") #0
423 ; Exceptions may (not) trap, so this can be folded, but constrained math requires that SNaN is quieted per IEEE-754 spec.
425 define <2 x float> @fold_fadd_vec_partial_snan_variable_ebmaytrap(<2 x float> %x) #0 {
426 ; CHECK-LABEL: @fold_fadd_vec_partial_snan_variable_ebmaytrap(
427 ; CHECK-NEXT: ret <2 x float> <float 0xFFF8000000000000, float 0x7FFC000000000000>
429 %add = call <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float><float 0xfff8000000000000, float 0x7ff4000000000000>, <2 x float> %x, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
433 define float @fold_fadd_snan_variable_ebstrict(float %x) #0 {
434 ; CHECK-LABEL: @fold_fadd_snan_variable_ebstrict(
435 ; CHECK-NEXT: [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float [[X:%.*]], metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
436 ; CHECK-NEXT: ret float [[ADD]]
438 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
442 define float @fold_fadd_snan_qnan_ebmaytrap() #0 {
443 ; CHECK-LABEL: @fold_fadd_snan_qnan_ebmaytrap(
444 ; CHECK-NEXT: ret float 0x7FFC000000000000
446 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.maytrap") #0
450 define float @fold_fadd_snan_qnan_ebstrict() #0 {
451 ; CHECK-LABEL: @fold_fadd_snan_qnan_ebstrict(
452 ; CHECK-NEXT: [[ADD:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF4000000000000, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #[[ATTR0]]
453 ; CHECK-NEXT: ret float [[ADD]]
455 %add = call float @llvm.experimental.constrained.fadd.f32(float 0x7ff4000000000000, float 0x7ff8000000000000, metadata !"round.tonearest", metadata !"fpexcept.strict") #0
459 declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) #0
460 declare <2 x float> @llvm.experimental.constrained.fadd.v2f32(<2 x float>, <2 x float>, metadata, metadata) #0
462 attributes #0 = { strictfp }