1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-- -passes=instsimplify -S | FileCheck %s
8 define float @fadd_nan_op0_strict(float %x) #0 {
9 ; CHECK-LABEL: @fadd_nan_op0_strict(
10 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
11 ; CHECK-NEXT: ret float [[R]]
13 %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
17 define float @fadd_nan_op0_maytrap(float %x) #0 {
18 ; CHECK-LABEL: @fadd_nan_op0_maytrap(
19 ; CHECK-NEXT: ret float 0x7FF8000000000000
21 %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
25 define float @fadd_nan_op0_upward(float %x) #0 {
26 ; CHECK-LABEL: @fadd_nan_op0_upward(
27 ; CHECK-NEXT: ret float 0x7FF8000000000000
29 %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
33 define float @fadd_nan_op0_defaultfp(float %x) #0 {
34 ; CHECK-LABEL: @fadd_nan_op0_defaultfp(
35 ; CHECK-NEXT: ret float 0x7FF8000000000000
37 %r = call float @llvm.experimental.constrained.fadd.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
41 define float @fadd_nan_op1_strict(float %x) #0 {
42 ; CHECK-LABEL: @fadd_nan_op1_strict(
43 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fadd.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
44 ; CHECK-NEXT: ret float [[R]]
46 %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
50 define float @fadd_nan_op1_maytrap(float %x) #0 {
51 ; CHECK-LABEL: @fadd_nan_op1_maytrap(
52 ; CHECK-NEXT: ret float 0x7FF8000000000000
54 %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
58 define float @fadd_nan_op1_upward(float %x) #0 {
59 ; CHECK-LABEL: @fadd_nan_op1_upward(
60 ; CHECK-NEXT: ret float 0x7FF8000000000000
62 %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
66 define float @fadd_nan_op1_defaultfp(float %x) #0 {
67 ; CHECK-LABEL: @fadd_nan_op1_defaultfp(
68 ; CHECK-NEXT: ret float 0x7FF8000000000000
70 %r = call float @llvm.experimental.constrained.fadd.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
78 define float @fsub_nan_op0_strict(float %x) #0 {
79 ; CHECK-LABEL: @fsub_nan_op0_strict(
80 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
81 ; CHECK-NEXT: ret float [[R]]
83 %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
87 define float @fsub_nan_op0_maytrap(float %x) #0 {
88 ; CHECK-LABEL: @fsub_nan_op0_maytrap(
89 ; CHECK-NEXT: ret float 0x7FF8000000000000
91 %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
95 define float @fsub_nan_op0_upward(float %x) #0 {
96 ; CHECK-LABEL: @fsub_nan_op0_upward(
97 ; CHECK-NEXT: ret float 0x7FF8000000000000
99 %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
103 define float @fsub_nan_op0_defaultfp(float %x) #0 {
104 ; CHECK-LABEL: @fsub_nan_op0_defaultfp(
105 ; CHECK-NEXT: ret float 0x7FF8000000000000
107 %r = call float @llvm.experimental.constrained.fsub.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
111 define float @fsub_nan_op1_strict(float %x) #0 {
112 ; CHECK-LABEL: @fsub_nan_op1_strict(
113 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fsub.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
114 ; CHECK-NEXT: ret float [[R]]
116 %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict") #0
120 define float @fsub_nan_op1_maytrap(float %x) #0 {
121 ; CHECK-LABEL: @fsub_nan_op1_maytrap(
122 ; CHECK-NEXT: ret float 0x7FF8000000000000
124 %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
128 define float @fsub_nan_op1_upward(float %x) #0 {
129 ; CHECK-LABEL: @fsub_nan_op1_upward(
130 ; CHECK-NEXT: ret float 0x7FF8000000000000
132 %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
136 define float @fsub_nan_op1_defaultfp(float %x) #0 {
137 ; CHECK-LABEL: @fsub_nan_op1_defaultfp(
138 ; CHECK-NEXT: ret float 0x7FF8000000000000
140 %r = call float @llvm.experimental.constrained.fsub.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
148 define float @fmul_nan_op0_strict(float %x) #0 {
149 ; CHECK-LABEL: @fmul_nan_op0_strict(
150 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
151 ; CHECK-NEXT: ret float [[R]]
153 %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
157 define float @fmul_nan_op0_maytrap(float %x) #0 {
158 ; CHECK-LABEL: @fmul_nan_op0_maytrap(
159 ; CHECK-NEXT: ret float 0x7FF8000000000000
161 %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
165 define float @fmul_nan_op0_upward(float %x) #0 {
166 ; CHECK-LABEL: @fmul_nan_op0_upward(
167 ; CHECK-NEXT: ret float 0x7FF8000000000000
169 %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
173 define float @fmul_nan_op0_defaultfp(float %x) #0 {
174 ; CHECK-LABEL: @fmul_nan_op0_defaultfp(
175 ; CHECK-NEXT: ret float 0x7FF8000000000000
177 %r = call float @llvm.experimental.constrained.fmul.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
181 define float @fmul_nan_op1_strict(float %x) #0 {
182 ; CHECK-LABEL: @fmul_nan_op1_strict(
183 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fmul.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
184 ; CHECK-NEXT: ret float [[R]]
186 %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
190 define float @fmul_nan_op1_maytrap(float %x) #0 {
191 ; CHECK-LABEL: @fmul_nan_op1_maytrap(
192 ; CHECK-NEXT: ret float 0x7FF8000000000000
194 %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
198 define float @fmul_nan_op1_upward(float %x) #0 {
199 ; CHECK-LABEL: @fmul_nan_op1_upward(
200 ; CHECK-NEXT: ret float 0x7FF8000000000000
202 %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
206 define float @fmul_nan_op1_defaultfp(float %x) #0 {
207 ; CHECK-LABEL: @fmul_nan_op1_defaultfp(
208 ; CHECK-NEXT: ret float 0x7FF8000000000000
210 %r = call float @llvm.experimental.constrained.fmul.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
218 define float @fdiv_nan_op0_strict(float %x) #0 {
219 ; CHECK-LABEL: @fdiv_nan_op0_strict(
220 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
221 ; CHECK-NEXT: ret float [[R]]
223 %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
227 define float @fdiv_nan_op0_maytrap(float %x) #0 {
228 ; CHECK-LABEL: @fdiv_nan_op0_maytrap(
229 ; CHECK-NEXT: ret float 0x7FF8000000000000
231 %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
235 define float @fdiv_nan_op0_upward(float %x) #0 {
236 ; CHECK-LABEL: @fdiv_nan_op0_upward(
237 ; CHECK-NEXT: ret float 0x7FF8000000000000
239 %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
243 define float @fdiv_nan_op0_defaultfp(float %x) #0 {
244 ; CHECK-LABEL: @fdiv_nan_op0_defaultfp(
245 ; CHECK-NEXT: ret float 0x7FF8000000000000
247 %r = call float @llvm.experimental.constrained.fdiv.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
251 define float @fdiv_nan_op1_strict(float %x) #0 {
252 ; CHECK-LABEL: @fdiv_nan_op1_strict(
253 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fdiv.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
254 ; CHECK-NEXT: ret float [[R]]
256 %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
260 define float @fdiv_nan_op1_maytrap(float %x) #0 {
261 ; CHECK-LABEL: @fdiv_nan_op1_maytrap(
262 ; CHECK-NEXT: ret float 0x7FF8000000000000
264 %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
268 define float @fdiv_nan_op1_upward(float %x) #0 {
269 ; CHECK-LABEL: @fdiv_nan_op1_upward(
270 ; CHECK-NEXT: ret float 0x7FF8000000000000
272 %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
276 define float @fdiv_nan_op1_defaultfp(float %x) #0 {
277 ; CHECK-LABEL: @fdiv_nan_op1_defaultfp(
278 ; CHECK-NEXT: ret float 0x7FF8000000000000
280 %r = call float @llvm.experimental.constrained.fdiv.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
288 define float @frem_nan_op0_strict(float %x) #0 {
289 ; CHECK-LABEL: @frem_nan_op0_strict(
290 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float [[X:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
291 ; CHECK-NEXT: ret float [[R]]
293 %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.strict")
297 define float @frem_nan_op0_maytrap(float %x) #0 {
298 ; CHECK-LABEL: @frem_nan_op0_maytrap(
299 ; CHECK-NEXT: ret float 0x7FF8000000000000
301 %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
305 define float @frem_nan_op0_upward(float %x) #0 {
306 ; CHECK-LABEL: @frem_nan_op0_upward(
307 ; CHECK-NEXT: ret float 0x7FF8000000000000
309 %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.upward", metadata !"fpexcept.ignore")
313 define float @frem_nan_op0_defaultfp(float %x) #0 {
314 ; CHECK-LABEL: @frem_nan_op0_defaultfp(
315 ; CHECK-NEXT: ret float 0x7FF8000000000000
317 %r = call float @llvm.experimental.constrained.frem.f32(float 0x7FF8000000000000, float %x, metadata !"round.tonearest", metadata !"fpexcept.ignore")
321 define float @frem_nan_op1_strict(float %x) #0 {
322 ; CHECK-LABEL: @frem_nan_op1_strict(
323 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.frem.f32(float [[X:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
324 ; CHECK-NEXT: ret float [[R]]
326 %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
330 define float @frem_nan_op1_maytrap(float %x) #0 {
331 ; CHECK-LABEL: @frem_nan_op1_maytrap(
332 ; CHECK-NEXT: ret float 0x7FF8000000000000
334 %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
338 define float @frem_nan_op1_upward(float %x) #0 {
339 ; CHECK-LABEL: @frem_nan_op1_upward(
340 ; CHECK-NEXT: ret float 0x7FF8000000000000
342 %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
346 define float @frem_nan_op1_defaultfp(float %x) #0 {
347 ; CHECK-LABEL: @frem_nan_op1_defaultfp(
348 ; CHECK-NEXT: ret float 0x7FF8000000000000
350 %r = call float @llvm.experimental.constrained.frem.f32(float %x, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
358 define float @fma_nan_op0_strict(float %x, float %y) #0 {
359 ; CHECK-LABEL: @fma_nan_op0_strict(
360 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float [[X:%.*]], float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
361 ; CHECK-NEXT: ret float [[R]]
363 %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.dynamic", metadata !"fpexcept.strict")
367 define float @fma_nan_op0_maytrap(float %x, float %y) #0 {
368 ; CHECK-LABEL: @fma_nan_op0_maytrap(
369 ; CHECK-NEXT: ret float 0x7FF8000000000000
371 %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
375 define float @fma_nan_op0_upward(float %x, float %y) #0 {
376 ; CHECK-LABEL: @fma_nan_op0_upward(
377 ; CHECK-NEXT: ret float 0x7FF8000000000000
379 %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.upward", metadata !"fpexcept.ignore")
383 define float @fma_nan_op0_defaultfp(float %x, float %y) #0 {
384 ; CHECK-LABEL: @fma_nan_op0_defaultfp(
385 ; CHECK-NEXT: ret float 0x7FF8000000000000
387 %r = call float @llvm.experimental.constrained.fma.f32(float 0x7FF8000000000000, float %x, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
391 define float @fma_nan_op1_strict(float %x, float %y) #0 {
392 ; CHECK-LABEL: @fma_nan_op1_strict(
393 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float 0x7FF8000000000000, float [[Y:%.*]], metadata !"round.dynamic", metadata !"fpexcept.strict")
394 ; CHECK-NEXT: ret float [[R]]
396 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.dynamic", metadata !"fpexcept.strict")
400 define float @fma_nan_op1_maytrap(float %x, float %y) #0 {
401 ; CHECK-LABEL: @fma_nan_op1_maytrap(
402 ; CHECK-NEXT: ret float 0x7FF8000000000000
404 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
408 define float @fma_nan_op1_upward(float %x, float %y) #0 {
409 ; CHECK-LABEL: @fma_nan_op1_upward(
410 ; CHECK-NEXT: ret float 0x7FF8000000000000
412 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.upward", metadata !"fpexcept.ignore")
416 define float @fma_nan_op1_defaultfp(float %x, float %y) #0 {
417 ; CHECK-LABEL: @fma_nan_op1_defaultfp(
418 ; CHECK-NEXT: ret float 0x7FF8000000000000
420 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float 0x7FF8000000000000, float %y, metadata !"round.tonearest", metadata !"fpexcept.ignore")
424 define float @fma_nan_op2_strict(float %x, float %y) #0 {
425 ; CHECK-LABEL: @fma_nan_op2_strict(
426 ; CHECK-NEXT: [[R:%.*]] = call float @llvm.experimental.constrained.fma.f32(float [[X:%.*]], float [[Y:%.*]], float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
427 ; CHECK-NEXT: ret float [[R]]
429 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.strict")
433 define float @fma_nan_op2_maytrap(float %x, float %y) #0 {
434 ; CHECK-LABEL: @fma_nan_op2_maytrap(
435 ; CHECK-NEXT: ret float 0x7FF8000000000000
437 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.dynamic", metadata !"fpexcept.maytrap")
441 define float @fma_nan_op2_upward(float %x, float %y) #0 {
442 ; CHECK-LABEL: @fma_nan_op2_upward(
443 ; CHECK-NEXT: ret float 0x7FF8000000000000
445 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.upward", metadata !"fpexcept.ignore")
449 define float @fma_nan_op2_defaultfp(float %x, float %y) #0 {
450 ; CHECK-LABEL: @fma_nan_op2_defaultfp(
451 ; CHECK-NEXT: ret float 0x7FF8000000000000
453 %r = call float @llvm.experimental.constrained.fma.f32(float %x, float %y, float 0x7FF8000000000000, metadata !"round.tonearest", metadata !"fpexcept.ignore")
457 declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata)
458 declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata)
459 declare float @llvm.experimental.constrained.fmul.f32(float, float, metadata, metadata)
460 declare float @llvm.experimental.constrained.fdiv.f32(float, float, metadata, metadata)
461 declare float @llvm.experimental.constrained.frem.f32(float, float, metadata, metadata)
462 declare float @llvm.experimental.constrained.fma.f32(float, float, float, metadata, metadata)
464 attributes #0 = { strictfp }