1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=ANY
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -enable-unsafe-fp-math | FileCheck %s --check-prefix=ANY
5 ; This is duplicated from tests for InstSimplify. If you're
6 ; adding something here, you should probably add it there too.
8 define float @fadd_undef_op0(float %x) {
9 ; ANY-LABEL: fadd_undef_op0:
11 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
13 %r = fadd float undef, %x
17 define float @fadd_undef_op1(float %x) {
18 ; ANY-LABEL: fadd_undef_op1:
20 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
22 %r = fadd float %x, undef
26 define float @fsub_undef_op0(float %x) {
27 ; ANY-LABEL: fsub_undef_op0:
29 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
31 %r = fsub float undef, %x
35 define float @fsub_undef_op1(float %x) {
36 ; ANY-LABEL: fsub_undef_op1:
38 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
40 %r = fsub float %x, undef
44 define float @fmul_undef_op0(float %x) {
45 ; ANY-LABEL: fmul_undef_op0:
47 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
49 %r = fmul float undef, %x
53 define float @fmul_undef_op1(float %x) {
54 ; ANY-LABEL: fmul_undef_op1:
56 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
58 %r = fmul float %x, undef
62 define float @fdiv_undef_op0(float %x) {
63 ; ANY-LABEL: fdiv_undef_op0:
65 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
67 %r = fdiv float undef, %x
71 define float @fdiv_undef_op1(float %x) {
72 ; ANY-LABEL: fdiv_undef_op1:
74 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
76 %r = fdiv float %x, undef
80 define float @frem_undef_op0(float %x) {
81 ; ANY-LABEL: frem_undef_op0:
83 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
85 %r = frem float undef, %x
89 define float @frem_undef_op1(float %x) {
90 ; ANY-LABEL: frem_undef_op1:
92 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
94 %r = frem float %x, undef
98 ; Repeat all tests with fast-math-flags. Alternate 'nnan' and 'fast' for more coverage.
100 define float @fadd_undef_op0_nnan(float %x) {
101 ; ANY-LABEL: fadd_undef_op0_nnan:
104 %r = fadd nnan float undef, %x
108 define float @fadd_undef_op1_fast(float %x) {
109 ; ANY-LABEL: fadd_undef_op1_fast:
112 %r = fadd fast float %x, undef
116 define float @fsub_undef_op0_fast(float %x) {
117 ; ANY-LABEL: fsub_undef_op0_fast:
120 %r = fsub fast float undef, %x
124 define float @fsub_undef_op1_nnan(float %x) {
125 ; ANY-LABEL: fsub_undef_op1_nnan:
128 %r = fsub nnan float %x, undef
132 define float @fmul_undef_op0_nnan(float %x) {
133 ; ANY-LABEL: fmul_undef_op0_nnan:
136 %r = fmul nnan float undef, %x
140 define float @fmul_undef_op1_fast(float %x) {
141 ; ANY-LABEL: fmul_undef_op1_fast:
144 %r = fmul fast float %x, undef
148 define float @fdiv_undef_op0_fast(float %x) {
149 ; ANY-LABEL: fdiv_undef_op0_fast:
152 %r = fdiv fast float undef, %x
156 define float @fdiv_undef_op1_nnan(float %x) {
157 ; ANY-LABEL: fdiv_undef_op1_nnan:
160 %r = fdiv nnan float %x, undef
164 define float @frem_undef_op0_nnan(float %x) {
165 ; ANY-LABEL: frem_undef_op0_nnan:
168 %r = frem nnan float undef, %x
172 define float @frem_undef_op1_fast(float %x) {
173 ; ANY-LABEL: frem_undef_op1_fast:
176 %r = frem fast float %x, undef
180 ; Constant folding - undef undef.
182 define double @fadd_undef_undef(double %x) {
183 ; ANY-LABEL: fadd_undef_undef:
186 %r = fadd double undef, undef
190 define double @fsub_undef_undef(double %x) {
191 ; ANY-LABEL: fsub_undef_undef:
194 %r = fsub double undef, undef
198 define double @fmul_undef_undef(double %x) {
199 ; ANY-LABEL: fmul_undef_undef:
202 %r = fmul double undef, undef
206 define double @fdiv_undef_undef(double %x) {
207 ; ANY-LABEL: fdiv_undef_undef:
210 %r = fdiv double undef, undef
214 define double @frem_undef_undef(double %x) {
215 ; ANY-LABEL: frem_undef_undef:
218 %r = frem double undef, undef
224 define float @fadd_undef_op0_nnan_constant(float %x) {
225 ; ANY-LABEL: fadd_undef_op0_nnan_constant:
228 %r = fadd nnan float undef, 1.0
232 define float @fadd_undef_op1_constant(float %x) {
233 ; ANY-LABEL: fadd_undef_op1_constant:
235 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
237 %r = fadd float 2.0, undef
241 define float @fsub_undef_op0_fast_constant(float %x) {
242 ; ANY-LABEL: fsub_undef_op0_fast_constant:
245 %r = fsub fast float undef, 3.0
249 define float @fsub_undef_op1_constant(float %x) {
250 ; ANY-LABEL: fsub_undef_op1_constant:
252 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
254 %r = fsub float 4.0, undef
258 define float @fmul_undef_op0_nnan_constant(float %x) {
259 ; ANY-LABEL: fmul_undef_op0_nnan_constant:
262 %r = fmul nnan float undef, 5.0
266 define float @fmul_undef_op1_constant(float %x) {
267 ; ANY-LABEL: fmul_undef_op1_constant:
269 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
271 %r = fmul float 6.0, undef
275 define float @fdiv_undef_op0_fast_constant(float %x) {
276 ; ANY-LABEL: fdiv_undef_op0_fast_constant:
279 %r = fdiv fast float undef, 7.0
283 define float @fdiv_undef_op1_constant(float %x) {
284 ; ANY-LABEL: fdiv_undef_op1_constant:
286 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
288 %r = fdiv float 8.0, undef
292 define float @frem_undef_op0_nnan_constant(float %x) {
293 ; ANY-LABEL: frem_undef_op0_nnan_constant:
296 %r = frem nnan float undef, 9.0
300 define float @frem_undef_op1_constant(float %x) {
301 ; ANY-LABEL: frem_undef_op1_constant:
303 ; ANY-NEXT: movss {{.*#+}} xmm0 = [NaN,0.0E+0,0.0E+0,0.0E+0]
305 %r = frem float 10.0, undef
309 ; Constant folding - special constants: NaN.
311 define double @fadd_undef_op0_constant_nan(double %x) {
312 ; ANY-LABEL: fadd_undef_op0_constant_nan:
314 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
316 %r = fadd double undef, 0x7FF8000000000000
320 define double @fadd_undef_op1_fast_constant_nan(double %x) {
321 ; ANY-LABEL: fadd_undef_op1_fast_constant_nan:
324 %r = fadd fast double 0xFFF0000000000001, undef
328 define double @fsub_undef_op0_constant_nan(double %x) {
329 ; ANY-LABEL: fsub_undef_op0_constant_nan:
331 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
333 %r = fsub double undef, 0xFFF8000000000010
337 define double @fsub_undef_op1_nnan_constant_nan(double %x) {
338 ; ANY-LABEL: fsub_undef_op1_nnan_constant_nan:
341 %r = fsub nnan double 0x7FF0000000000011, undef
345 define double @fmul_undef_op0_constant_nan(double %x) {
346 ; ANY-LABEL: fmul_undef_op0_constant_nan:
348 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
350 %r = fmul double undef, 0x7FF8000000000100
354 define double @fmul_undef_op1_fast_constant_nan(double %x) {
355 ; ANY-LABEL: fmul_undef_op1_fast_constant_nan:
358 %r = fmul fast double 0xFFF0000000000101, undef
362 define double @fdiv_undef_op0_constant_nan(double %x) {
363 ; ANY-LABEL: fdiv_undef_op0_constant_nan:
365 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
367 %r = fdiv double undef, 0xFFF8000000000110
371 define double @fdiv_undef_op1_nnan_constant_nan(double %x) {
372 ; ANY-LABEL: fdiv_undef_op1_nnan_constant_nan:
375 %r = fdiv nnan double 0x7FF0000000000111, undef
379 define double @frem_undef_op0_constant_nan(double %x) {
380 ; ANY-LABEL: frem_undef_op0_constant_nan:
382 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
384 %r = frem double undef, 0x7FF8000000001000
388 define double @frem_undef_op1_fast_constant_nan(double %x) {
389 ; ANY-LABEL: frem_undef_op1_fast_constant_nan:
392 %r = frem fast double 0xFFF0000000001001, undef
396 ; Constant folding - special constants: Inf.
398 define double @fadd_undef_op0_constant_inf(double %x) {
399 ; ANY-LABEL: fadd_undef_op0_constant_inf:
401 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
403 %r = fadd double undef, 0x7FF0000000000000
407 define double @fadd_undef_op1_fast_constant_inf(double %x) {
408 ; ANY-LABEL: fadd_undef_op1_fast_constant_inf:
411 %r = fadd fast double 0xFFF0000000000000, undef
415 define double @fsub_undef_op0_constant_inf(double %x) {
416 ; ANY-LABEL: fsub_undef_op0_constant_inf:
418 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
420 %r = fsub double undef, 0xFFF0000000000000
424 define double @fsub_undef_op1_ninf_constant_inf(double %x) {
425 ; ANY-LABEL: fsub_undef_op1_ninf_constant_inf:
428 %r = fsub ninf double 0x7FF0000000000000, undef
432 define double @fmul_undef_op0_constant_inf(double %x) {
433 ; ANY-LABEL: fmul_undef_op0_constant_inf:
435 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
437 %r = fmul double undef, 0x7FF0000000000000
441 define double @fmul_undef_op1_fast_constant_inf(double %x) {
442 ; ANY-LABEL: fmul_undef_op1_fast_constant_inf:
445 %r = fmul fast double 0xFFF0000000000000, undef
449 define double @fdiv_undef_op0_constant_inf(double %x) {
450 ; ANY-LABEL: fdiv_undef_op0_constant_inf:
452 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
454 %r = fdiv double undef, 0xFFF0000000000000
458 define double @fdiv_undef_op1_ninf_constant_inf(double %x) {
459 ; ANY-LABEL: fdiv_undef_op1_ninf_constant_inf:
462 %r = fdiv ninf double 0x7FF0000000000000, undef
466 define double @frem_undef_op0_constant_inf(double %x) {
467 ; ANY-LABEL: frem_undef_op0_constant_inf:
469 ; ANY-NEXT: movsd {{.*#+}} xmm0 = [NaN,0.0E+0]
471 %r = frem double undef, 0x7FF0000000000000
475 define double @frem_undef_op1_fast_constant_inf(double %x) {
476 ; ANY-LABEL: frem_undef_op1_fast_constant_inf:
479 %r = frem fast double 0xFFF0000000000000, undef
483 define <2 x double> @fadd_undef_op1_constant_vec(<2 x double> %x) {
484 ; ANY-LABEL: fadd_undef_op1_constant_vec:
486 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
488 %r = fadd <2 x double> <double 42.0, double undef>, undef
492 define <2 x double> @fadd_undef_op0_constant_vec(<2 x double> %x) {
493 ; ANY-LABEL: fadd_undef_op0_constant_vec:
495 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
497 %r = fadd <2 x double> undef, <double undef, double 42.0>
501 define <2 x double> @fsub_undef_op1_constant_vec(<2 x double> %x) {
502 ; ANY-LABEL: fsub_undef_op1_constant_vec:
504 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
506 %r = fsub <2 x double> <double undef, double 42.0>, undef
510 define <2 x double> @fsub_undef_op0_constant_vec(<2 x double> %x) {
511 ; ANY-LABEL: fsub_undef_op0_constant_vec:
513 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
515 %r = fsub <2 x double> undef, <double 42.0, double undef>
519 define <2 x double> @fmul_undef_op1_constant_vec(<2 x double> %x) {
520 ; ANY-LABEL: fmul_undef_op1_constant_vec:
522 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
524 %r = fmul <2 x double> <double 42.0, double undef>, undef
528 define <2 x double> @fmul_undef_op0_constant_vec(<2 x double> %x) {
529 ; ANY-LABEL: fmul_undef_op0_constant_vec:
531 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
533 %r = fmul <2 x double> undef, <double undef, double 42.0>
537 define <2 x double> @fdiv_undef_op1_constant_vec(<2 x double> %x) {
538 ; ANY-LABEL: fdiv_undef_op1_constant_vec:
540 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
542 %r = fdiv <2 x double> <double 42.0, double undef>, undef
546 define <2 x double> @fdiv_undef_op0_constant_vec(<2 x double> %x) {
547 ; ANY-LABEL: fdiv_undef_op0_constant_vec:
549 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
551 %r = fdiv <2 x double> undef, <double undef, double 42.0>
555 define <2 x double> @frem_undef_op1_constant_vec(<2 x double> %x) {
556 ; ANY-LABEL: frem_undef_op1_constant_vec:
558 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
560 %r = frem <2 x double> <double undef, double 42.0>, undef
564 define <2 x double> @frem_undef_op0_constant_vec(<2 x double> %x) {
565 ; ANY-LABEL: frem_undef_op0_constant_vec:
567 ; ANY-NEXT: movaps {{.*#+}} xmm0 = [NaN,NaN]
569 %r = frem <2 x double> undef, <double 42.0, double undef>