1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt < %s -mtriple=x86_64-- -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") #[[ATTR0:[0-9]+]]
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") #0
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") #0
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") #0
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") #0
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") #[[ATTR0]]
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") #0
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") #0
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") #0
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") #0
78 define float @fsub_nan_op0_strict(float %x) {
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") #[[ATTR0]]
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") #0
87 define float @fsub_nan_op0_maytrap(float %x) {
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") #0
95 define float @fsub_nan_op0_upward(float %x) {
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") #0
103 define float @fsub_nan_op0_defaultfp(float %x) {
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") #0
111 define float @fsub_nan_op1_strict(float %x) {
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") #[[ATTR0]]
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) {
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") #0
128 define float @fsub_nan_op1_upward(float %x) {
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") #0
136 define float @fsub_nan_op1_defaultfp(float %x) {
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") #0
148 define float @fmul_nan_op0_strict(float %x) {
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") #[[ATTR0]]
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") #0
157 define float @fmul_nan_op0_maytrap(float %x) {
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") #0
165 define float @fmul_nan_op0_upward(float %x) {
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") #0
173 define float @fmul_nan_op0_defaultfp(float %x) {
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") #0
181 define float @fmul_nan_op1_strict(float %x) {
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") #[[ATTR0]]
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") #0
190 define float @fmul_nan_op1_maytrap(float %x) {
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") #0
198 define float @fmul_nan_op1_upward(float %x) {
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") #0
206 define float @fmul_nan_op1_defaultfp(float %x) {
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") #0
218 define float @fdiv_nan_op0_strict(float %x) {
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") #[[ATTR0]]
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") #0
227 define float @fdiv_nan_op0_maytrap(float %x) {
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") #0
235 define float @fdiv_nan_op0_upward(float %x) {
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") #0
243 define float @fdiv_nan_op0_defaultfp(float %x) {
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") #0
251 define float @fdiv_nan_op1_strict(float %x) {
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") #[[ATTR0]]
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") #0
260 define float @fdiv_nan_op1_maytrap(float %x) {
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") #0
268 define float @fdiv_nan_op1_upward(float %x) {
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") #0
276 define float @fdiv_nan_op1_defaultfp(float %x) {
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") #0
288 define float @frem_nan_op0_strict(float %x) {
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") #[[ATTR0]]
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") #0
297 define float @frem_nan_op0_maytrap(float %x) {
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") #0
305 define float @frem_nan_op0_upward(float %x) {
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") #0
313 define float @frem_nan_op0_defaultfp(float %x) {
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") #0
321 define float @frem_nan_op1_strict(float %x) {
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") #[[ATTR0]]
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") #0
330 define float @frem_nan_op1_maytrap(float %x) {
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") #0
338 define float @frem_nan_op1_upward(float %x) {
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") #0
346 define float @frem_nan_op1_defaultfp(float %x) {
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") #0
358 define float @fma_nan_op0_strict(float %x, float %y) {
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") #[[ATTR0]]
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") #0
367 define float @fma_nan_op0_maytrap(float %x, float %y) {
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") #0
375 define float @fma_nan_op0_upward(float %x, float %y) {
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") #0
383 define float @fma_nan_op0_defaultfp(float %x, float %y) {
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") #0
391 define float @fma_nan_op1_strict(float %x, float %y) {
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") #[[ATTR0]]
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") #0
400 define float @fma_nan_op1_maytrap(float %x, float %y) {
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") #0
408 define float @fma_nan_op1_upward(float %x, float %y) {
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") #0
416 define float @fma_nan_op1_defaultfp(float %x, float %y) {
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") #0
424 define float @fma_nan_op2_strict(float %x, float %y) {
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") #[[ATTR0]]
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") #0
433 define float @fma_nan_op2_maytrap(float %x, float %y) {
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") #0
441 define float @fma_nan_op2_upward(float %x, float %y) {
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") #0
449 define float @fma_nan_op2_defaultfp(float %x, float %y) {
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") #0
457 declare float @llvm.experimental.constrained.fadd.f32(float, float, metadata, metadata) #0
458 declare float @llvm.experimental.constrained.fsub.f32(float, float, metadata, metadata) #0
459 declare float @llvm.experimental.constrained.fmul.f32(float, float, metadata, metadata) #0
460 declare float @llvm.experimental.constrained.fdiv.f32(float, float, metadata, metadata) #0
461 declare float @llvm.experimental.constrained.frem.f32(float, float, metadata, metadata) #0
462 declare float @llvm.experimental.constrained.fma.f32(float, float, float, metadata, metadata) #0
464 attributes #0 = { strictfp }