1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s --check-prefix=SSE
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse4.2 | FileCheck %s --check-prefix=SSE
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx | FileCheck %s --check-prefix=AVX
5 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefix=AVX
6 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512dq,+avx512bw | FileCheck %s --check-prefix=AVX
8 define <4 x i32> @add_op1_constant(ptr %p) nounwind {
9 ; SSE-LABEL: add_op1_constant:
11 ; SSE-NEXT: movl (%rdi), %eax
12 ; SSE-NEXT: addl $42, %eax
13 ; SSE-NEXT: movd %eax, %xmm0
16 ; AVX-LABEL: add_op1_constant:
18 ; AVX-NEXT: movl (%rdi), %eax
19 ; AVX-NEXT: addl $42, %eax
20 ; AVX-NEXT: vmovd %eax, %xmm0
24 %r = insertelement <4 x i32> undef, i32 %b, i32 0
28 ; Code and data size may increase by using more vector ops, so the transform is disabled here.
30 define <4 x i32> @add_op1_constant_optsize(ptr %p) nounwind optsize {
31 ; SSE-LABEL: add_op1_constant_optsize:
33 ; SSE-NEXT: movl (%rdi), %eax
34 ; SSE-NEXT: addl $42, %eax
35 ; SSE-NEXT: movd %eax, %xmm0
38 ; AVX-LABEL: add_op1_constant_optsize:
40 ; AVX-NEXT: movl (%rdi), %eax
41 ; AVX-NEXT: addl $42, %eax
42 ; AVX-NEXT: vmovd %eax, %xmm0
46 %r = insertelement <4 x i32> undef, i32 %b, i32 0
50 define <8 x i16> @add_op0_constant(ptr %p) nounwind {
51 ; SSE-LABEL: add_op0_constant:
53 ; SSE-NEXT: movzwl (%rdi), %eax
54 ; SSE-NEXT: addl $42, %eax
55 ; SSE-NEXT: movd %eax, %xmm0
58 ; AVX-LABEL: add_op0_constant:
60 ; AVX-NEXT: movzwl (%rdi), %eax
61 ; AVX-NEXT: addl $42, %eax
62 ; AVX-NEXT: vmovd %eax, %xmm0
66 %r = insertelement <8 x i16> undef, i16 %b, i32 0
70 define <2 x i64> @sub_op0_constant(ptr %p) nounwind {
71 ; SSE-LABEL: sub_op0_constant:
73 ; SSE-NEXT: movl $42, %eax
74 ; SSE-NEXT: subq (%rdi), %rax
75 ; SSE-NEXT: movq %rax, %xmm0
78 ; AVX-LABEL: sub_op0_constant:
80 ; AVX-NEXT: movl $42, %eax
81 ; AVX-NEXT: subq (%rdi), %rax
82 ; AVX-NEXT: vmovq %rax, %xmm0
86 %r = insertelement <2 x i64> undef, i64 %b, i32 0
90 define <16 x i8> @sub_op1_constant(ptr %p) nounwind {
91 ; SSE-LABEL: sub_op1_constant:
93 ; SSE-NEXT: movzbl (%rdi), %eax
94 ; SSE-NEXT: addb $-42, %al
95 ; SSE-NEXT: movzbl %al, %eax
96 ; SSE-NEXT: movd %eax, %xmm0
99 ; AVX-LABEL: sub_op1_constant:
101 ; AVX-NEXT: movzbl (%rdi), %eax
102 ; AVX-NEXT: addb $-42, %al
103 ; AVX-NEXT: vmovd %eax, %xmm0
107 %r = insertelement <16 x i8> undef, i8 %b, i32 0
111 define <4 x i32> @mul_op1_constant(ptr %p) nounwind {
112 ; SSE-LABEL: mul_op1_constant:
114 ; SSE-NEXT: imull $42, (%rdi), %eax
115 ; SSE-NEXT: movd %eax, %xmm0
118 ; AVX-LABEL: mul_op1_constant:
120 ; AVX-NEXT: imull $42, (%rdi), %eax
121 ; AVX-NEXT: vmovd %eax, %xmm0
123 %x = load i32, ptr %p
125 %r = insertelement <4 x i32> undef, i32 %b, i32 0
129 define <8 x i16> @mul_op0_constant(ptr %p) nounwind {
130 ; SSE-LABEL: mul_op0_constant:
132 ; SSE-NEXT: movzwl (%rdi), %eax
133 ; SSE-NEXT: imull $42, %eax, %eax
134 ; SSE-NEXT: movd %eax, %xmm0
137 ; AVX-LABEL: mul_op0_constant:
139 ; AVX-NEXT: movzwl (%rdi), %eax
140 ; AVX-NEXT: imull $42, %eax, %eax
141 ; AVX-NEXT: vmovd %eax, %xmm0
143 %x = load i16, ptr %p
145 %r = insertelement <8 x i16> undef, i16 %b, i32 0
149 define <4 x i32> @and_op1_constant(ptr %p) nounwind {
150 ; SSE-LABEL: and_op1_constant:
152 ; SSE-NEXT: movl (%rdi), %eax
153 ; SSE-NEXT: andl $42, %eax
154 ; SSE-NEXT: movd %eax, %xmm0
157 ; AVX-LABEL: and_op1_constant:
159 ; AVX-NEXT: movl (%rdi), %eax
160 ; AVX-NEXT: andl $42, %eax
161 ; AVX-NEXT: vmovd %eax, %xmm0
163 %x = load i32, ptr %p
165 %r = insertelement <4 x i32> undef, i32 %b, i32 0
169 define <2 x i64> @or_op1_constant(ptr %p) nounwind {
170 ; SSE-LABEL: or_op1_constant:
172 ; SSE-NEXT: movq (%rdi), %rax
173 ; SSE-NEXT: orq $42, %rax
174 ; SSE-NEXT: movq %rax, %xmm0
177 ; AVX-LABEL: or_op1_constant:
179 ; AVX-NEXT: movq (%rdi), %rax
180 ; AVX-NEXT: orq $42, %rax
181 ; AVX-NEXT: vmovq %rax, %xmm0
183 %x = load i64, ptr %p
185 %r = insertelement <2 x i64> undef, i64 %b, i32 0
189 define <8 x i16> @xor_op1_constant(ptr %p) nounwind {
190 ; SSE-LABEL: xor_op1_constant:
192 ; SSE-NEXT: movzwl (%rdi), %eax
193 ; SSE-NEXT: xorl $42, %eax
194 ; SSE-NEXT: movd %eax, %xmm0
197 ; AVX-LABEL: xor_op1_constant:
199 ; AVX-NEXT: movzwl (%rdi), %eax
200 ; AVX-NEXT: xorl $42, %eax
201 ; AVX-NEXT: vmovd %eax, %xmm0
203 %x = load i16, ptr %p
205 %r = insertelement <8 x i16> undef, i16 %b, i32 0
209 define <4 x i32> @shl_op0_constant(ptr %p) nounwind {
210 ; SSE-LABEL: shl_op0_constant:
212 ; SSE-NEXT: movzbl (%rdi), %ecx
213 ; SSE-NEXT: movl $42, %eax
214 ; SSE-NEXT: shll %cl, %eax
215 ; SSE-NEXT: movd %eax, %xmm0
218 ; AVX-LABEL: shl_op0_constant:
220 ; AVX-NEXT: movzbl (%rdi), %ecx
221 ; AVX-NEXT: movl $42, %eax
222 ; AVX-NEXT: shll %cl, %eax
223 ; AVX-NEXT: vmovd %eax, %xmm0
225 %x = load i32, ptr %p
227 %r = insertelement <4 x i32> undef, i32 %b, i32 0
231 define <16 x i8> @shl_op1_constant(ptr %p) nounwind {
232 ; SSE-LABEL: shl_op1_constant:
234 ; SSE-NEXT: movzbl (%rdi), %eax
235 ; SSE-NEXT: shlb $5, %al
236 ; SSE-NEXT: movzbl %al, %eax
237 ; SSE-NEXT: movd %eax, %xmm0
240 ; AVX-LABEL: shl_op1_constant:
242 ; AVX-NEXT: movzbl (%rdi), %eax
243 ; AVX-NEXT: shlb $5, %al
244 ; AVX-NEXT: vmovd %eax, %xmm0
248 %r = insertelement <16 x i8> undef, i8 %b, i32 0
252 define <2 x i64> @lshr_op0_constant(ptr %p) nounwind {
253 ; SSE-LABEL: lshr_op0_constant:
255 ; SSE-NEXT: movzbl (%rdi), %ecx
256 ; SSE-NEXT: movl $42, %eax
257 ; SSE-NEXT: shrq %cl, %rax
258 ; SSE-NEXT: movd %eax, %xmm0
261 ; AVX-LABEL: lshr_op0_constant:
263 ; AVX-NEXT: movzbl (%rdi), %ecx
264 ; AVX-NEXT: movl $42, %eax
265 ; AVX-NEXT: shrq %cl, %rax
266 ; AVX-NEXT: vmovd %eax, %xmm0
268 %x = load i64, ptr %p
270 %r = insertelement <2 x i64> undef, i64 %b, i32 0
274 define <4 x i32> @lshr_op1_constant(ptr %p) nounwind {
275 ; SSE-LABEL: lshr_op1_constant:
277 ; SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
278 ; SSE-NEXT: psrld $17, %xmm0
281 ; AVX-LABEL: lshr_op1_constant:
283 ; AVX-NEXT: vmovd {{.*#+}} xmm0 = mem[0],zero,zero,zero
284 ; AVX-NEXT: vpsrld $17, %xmm0, %xmm0
286 %x = load i32, ptr %p
288 %r = insertelement <4 x i32> undef, i32 %b, i32 0
292 define <8 x i16> @ashr_op0_constant(ptr %p) nounwind {
293 ; SSE-LABEL: ashr_op0_constant:
295 ; SSE-NEXT: movzbl (%rdi), %ecx
296 ; SSE-NEXT: movl $-42, %eax
297 ; SSE-NEXT: sarl %cl, %eax
298 ; SSE-NEXT: movd %eax, %xmm0
301 ; AVX-LABEL: ashr_op0_constant:
303 ; AVX-NEXT: movzbl (%rdi), %ecx
304 ; AVX-NEXT: movl $-42, %eax
305 ; AVX-NEXT: sarl %cl, %eax
306 ; AVX-NEXT: vmovd %eax, %xmm0
308 %x = load i16, ptr %p
309 %b = ashr i16 -42, %x
310 %r = insertelement <8 x i16> undef, i16 %b, i32 0
314 define <8 x i16> @ashr_op1_constant(ptr %p) nounwind {
315 ; SSE-LABEL: ashr_op1_constant:
317 ; SSE-NEXT: movswl (%rdi), %eax
318 ; SSE-NEXT: movd %eax, %xmm0
319 ; SSE-NEXT: psrad $7, %xmm0
322 ; AVX-LABEL: ashr_op1_constant:
324 ; AVX-NEXT: movswl (%rdi), %eax
325 ; AVX-NEXT: vmovd %eax, %xmm0
326 ; AVX-NEXT: vpsrad $7, %xmm0, %xmm0
328 %x = load i16, ptr %p
330 %r = insertelement <8 x i16> undef, i16 %b, i32 0
334 define <4 x i32> @sdiv_op0_constant(ptr %p) nounwind {
335 ; SSE-LABEL: sdiv_op0_constant:
337 ; SSE-NEXT: movl $42, %eax
338 ; SSE-NEXT: xorl %edx, %edx
339 ; SSE-NEXT: idivl (%rdi)
340 ; SSE-NEXT: movd %eax, %xmm0
343 ; AVX-LABEL: sdiv_op0_constant:
345 ; AVX-NEXT: movl $42, %eax
346 ; AVX-NEXT: xorl %edx, %edx
347 ; AVX-NEXT: idivl (%rdi)
348 ; AVX-NEXT: vmovd %eax, %xmm0
350 %x = load i32, ptr %p
352 %r = insertelement <4 x i32> undef, i32 %b, i32 0
356 define <8 x i16> @sdiv_op1_constant(ptr %p) nounwind {
357 ; SSE-LABEL: sdiv_op1_constant:
359 ; SSE-NEXT: movswl (%rdi), %eax
360 ; SSE-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
361 ; SSE-NEXT: shrl $16, %ecx
362 ; SSE-NEXT: addl %eax, %ecx
363 ; SSE-NEXT: movzwl %cx, %eax
364 ; SSE-NEXT: movswl %ax, %ecx
365 ; SSE-NEXT: shrl $15, %eax
366 ; SSE-NEXT: sarl $5, %ecx
367 ; SSE-NEXT: addl %eax, %ecx
368 ; SSE-NEXT: movd %ecx, %xmm0
371 ; AVX-LABEL: sdiv_op1_constant:
373 ; AVX-NEXT: movswl (%rdi), %eax
374 ; AVX-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
375 ; AVX-NEXT: shrl $16, %ecx
376 ; AVX-NEXT: addl %eax, %ecx
377 ; AVX-NEXT: movzwl %cx, %eax
378 ; AVX-NEXT: movswl %ax, %ecx
379 ; AVX-NEXT: shrl $15, %eax
380 ; AVX-NEXT: sarl $5, %ecx
381 ; AVX-NEXT: addl %eax, %ecx
382 ; AVX-NEXT: vmovd %ecx, %xmm0
384 %x = load i16, ptr %p
386 %r = insertelement <8 x i16> undef, i16 %b, i32 0
390 define <8 x i16> @srem_op0_constant(ptr %p) nounwind {
391 ; SSE-LABEL: srem_op0_constant:
393 ; SSE-NEXT: movw $42, %ax
394 ; SSE-NEXT: xorl %edx, %edx
395 ; SSE-NEXT: idivw (%rdi)
396 ; SSE-NEXT: # kill: def $dx killed $dx def $edx
397 ; SSE-NEXT: movd %edx, %xmm0
400 ; AVX-LABEL: srem_op0_constant:
402 ; AVX-NEXT: movw $42, %ax
403 ; AVX-NEXT: xorl %edx, %edx
404 ; AVX-NEXT: idivw (%rdi)
405 ; AVX-NEXT: # kill: def $dx killed $dx def $edx
406 ; AVX-NEXT: vmovd %edx, %xmm0
408 %x = load i16, ptr %p
410 %r = insertelement <8 x i16> undef, i16 %b, i32 0
414 define <4 x i32> @srem_op1_constant(ptr %p) nounwind {
415 ; SSE-LABEL: srem_op1_constant:
417 ; SSE-NEXT: movslq (%rdi), %rax
418 ; SSE-NEXT: imulq $818089009, %rax, %rcx # imm = 0x30C30C31
419 ; SSE-NEXT: movq %rcx, %rdx
420 ; SSE-NEXT: shrq $63, %rdx
421 ; SSE-NEXT: sarq $35, %rcx
422 ; SSE-NEXT: addl %edx, %ecx
423 ; SSE-NEXT: imull $42, %ecx, %ecx
424 ; SSE-NEXT: subl %ecx, %eax
425 ; SSE-NEXT: movd %eax, %xmm0
428 ; AVX-LABEL: srem_op1_constant:
430 ; AVX-NEXT: movslq (%rdi), %rax
431 ; AVX-NEXT: imulq $818089009, %rax, %rcx # imm = 0x30C30C31
432 ; AVX-NEXT: movq %rcx, %rdx
433 ; AVX-NEXT: shrq $63, %rdx
434 ; AVX-NEXT: sarq $35, %rcx
435 ; AVX-NEXT: addl %edx, %ecx
436 ; AVX-NEXT: imull $42, %ecx, %ecx
437 ; AVX-NEXT: subl %ecx, %eax
438 ; AVX-NEXT: vmovd %eax, %xmm0
440 %x = load i32, ptr %p
442 %r = insertelement <4 x i32> undef, i32 %b, i32 0
446 define <4 x i32> @udiv_op0_constant(ptr %p) nounwind {
447 ; SSE-LABEL: udiv_op0_constant:
449 ; SSE-NEXT: movl $42, %eax
450 ; SSE-NEXT: xorl %edx, %edx
451 ; SSE-NEXT: divl (%rdi)
452 ; SSE-NEXT: movd %eax, %xmm0
455 ; AVX-LABEL: udiv_op0_constant:
457 ; AVX-NEXT: movl $42, %eax
458 ; AVX-NEXT: xorl %edx, %edx
459 ; AVX-NEXT: divl (%rdi)
460 ; AVX-NEXT: vmovd %eax, %xmm0
462 %x = load i32, ptr %p
464 %r = insertelement <4 x i32> undef, i32 %b, i32 0
468 define <2 x i64> @udiv_op1_constant(ptr %p) nounwind {
469 ; SSE-LABEL: udiv_op1_constant:
471 ; SSE-NEXT: movq (%rdi), %rax
472 ; SSE-NEXT: shrq %rax
473 ; SSE-NEXT: movabsq $-4392081922311798003, %rcx # imm = 0xC30C30C30C30C30D
474 ; SSE-NEXT: mulq %rcx
475 ; SSE-NEXT: movq %rdx, %xmm0
476 ; SSE-NEXT: psrlq $4, %xmm0
479 ; AVX-LABEL: udiv_op1_constant:
481 ; AVX-NEXT: movq (%rdi), %rax
482 ; AVX-NEXT: shrq %rax
483 ; AVX-NEXT: movabsq $-4392081922311798003, %rcx # imm = 0xC30C30C30C30C30D
484 ; AVX-NEXT: mulq %rcx
485 ; AVX-NEXT: vmovq %rdx, %xmm0
486 ; AVX-NEXT: vpsrlq $4, %xmm0, %xmm0
488 %x = load i64, ptr %p
490 %r = insertelement <2 x i64> undef, i64 %b, i32 0
494 define <2 x i64> @urem_op0_constant(ptr %p) nounwind {
495 ; SSE-LABEL: urem_op0_constant:
497 ; SSE-NEXT: movl $42, %eax
498 ; SSE-NEXT: xorl %edx, %edx
499 ; SSE-NEXT: divq (%rdi)
500 ; SSE-NEXT: movq %rdx, %xmm0
503 ; AVX-LABEL: urem_op0_constant:
505 ; AVX-NEXT: movl $42, %eax
506 ; AVX-NEXT: xorl %edx, %edx
507 ; AVX-NEXT: divq (%rdi)
508 ; AVX-NEXT: vmovq %rdx, %xmm0
510 %x = load i64, ptr %p
512 %r = insertelement <2 x i64> undef, i64 %b, i32 0
516 define <16 x i8> @urem_op1_constant(ptr %p) nounwind {
517 ; SSE-LABEL: urem_op1_constant:
519 ; SSE-NEXT: movzbl (%rdi), %eax
520 ; SSE-NEXT: movl %eax, %ecx
522 ; SSE-NEXT: movzbl %cl, %ecx
523 ; SSE-NEXT: imull $49, %ecx, %ecx
524 ; SSE-NEXT: shrl $10, %ecx
525 ; SSE-NEXT: imull $42, %ecx, %ecx
526 ; SSE-NEXT: subb %cl, %al
527 ; SSE-NEXT: movzbl %al, %eax
528 ; SSE-NEXT: movd %eax, %xmm0
531 ; AVX-LABEL: urem_op1_constant:
533 ; AVX-NEXT: movzbl (%rdi), %eax
534 ; AVX-NEXT: movl %eax, %ecx
536 ; AVX-NEXT: movzbl %cl, %ecx
537 ; AVX-NEXT: imull $49, %ecx, %ecx
538 ; AVX-NEXT: shrl $10, %ecx
539 ; AVX-NEXT: imull $42, %ecx, %ecx
540 ; AVX-NEXT: subb %cl, %al
541 ; AVX-NEXT: vmovd %eax, %xmm0
545 %r = insertelement <16 x i8> undef, i8 %b, i32 0
549 define <4 x float> @fadd_op1_constant(ptr %p) nounwind {
550 ; SSE-LABEL: fadd_op1_constant:
552 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
553 ; SSE-NEXT: addss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
556 ; AVX-LABEL: fadd_op1_constant:
558 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
559 ; AVX-NEXT: vaddss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
561 %x = load float, ptr %p
562 %b = fadd float %x, 42.0
563 %r = insertelement <4 x float> undef, float %b, i32 0
567 define <2 x double> @fsub_op1_constant(ptr %p) nounwind {
568 ; SSE-LABEL: fsub_op1_constant:
570 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
571 ; SSE-NEXT: addsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
574 ; AVX-LABEL: fsub_op1_constant:
576 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
577 ; AVX-NEXT: vaddsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
579 %x = load double, ptr %p
580 %b = fsub double %x, 42.0
581 %r = insertelement <2 x double> undef, double %b, i32 0
585 define <4 x float> @fsub_op0_constant(ptr %p) nounwind {
586 ; SSE-LABEL: fsub_op0_constant:
588 ; SSE-NEXT: movss {{.*#+}} xmm0 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
589 ; SSE-NEXT: subss (%rdi), %xmm0
592 ; AVX-LABEL: fsub_op0_constant:
594 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
595 ; AVX-NEXT: vsubss (%rdi), %xmm0, %xmm0
597 %x = load float, ptr %p
598 %b = fsub float 42.0, %x
599 %r = insertelement <4 x float> undef, float %b, i32 0
603 define <4 x float> @fmul_op1_constant(ptr %p) nounwind {
604 ; SSE-LABEL: fmul_op1_constant:
606 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
607 ; SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
610 ; AVX-LABEL: fmul_op1_constant:
612 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
613 ; AVX-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
615 %x = load float, ptr %p
616 %b = fmul float %x, 42.0
617 %r = insertelement <4 x float> undef, float %b, i32 0
621 define <2 x double> @fdiv_op1_constant(ptr %p) nounwind {
622 ; SSE-LABEL: fdiv_op1_constant:
624 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
625 ; SSE-NEXT: divsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
628 ; AVX-LABEL: fdiv_op1_constant:
630 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
631 ; AVX-NEXT: vdivsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
633 %x = load double, ptr %p
634 %b = fdiv double %x, 42.0
635 %r = insertelement <2 x double> undef, double %b, i32 0
639 define <4 x float> @fdiv_op0_constant(ptr %p) nounwind {
640 ; SSE-LABEL: fdiv_op0_constant:
642 ; SSE-NEXT: movss {{.*#+}} xmm0 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
643 ; SSE-NEXT: divss (%rdi), %xmm0
646 ; AVX-LABEL: fdiv_op0_constant:
648 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
649 ; AVX-NEXT: vdivss (%rdi), %xmm0, %xmm0
651 %x = load float, ptr %p
652 %b = fdiv float 42.0, %x
653 %r = insertelement <4 x float> undef, float %b, i32 0
657 define <4 x float> @frem_op1_constant(ptr %p) nounwind {
658 ; SSE-LABEL: frem_op1_constant:
660 ; SSE-NEXT: pushq %rax
661 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
662 ; SSE-NEXT: movss {{.*#+}} xmm1 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
663 ; SSE-NEXT: callq fmodf@PLT
664 ; SSE-NEXT: popq %rax
667 ; AVX-LABEL: frem_op1_constant:
669 ; AVX-NEXT: pushq %rax
670 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
671 ; AVX-NEXT: vmovss {{.*#+}} xmm1 = [4.2E+1,0.0E+0,0.0E+0,0.0E+0]
672 ; AVX-NEXT: callq fmodf@PLT
673 ; AVX-NEXT: popq %rax
675 %x = load float, ptr %p
676 %b = frem float %x, 42.0
677 %r = insertelement <4 x float> undef, float %b, i32 0
681 define <2 x double> @frem_op0_constant(ptr %p) nounwind {
682 ; SSE-LABEL: frem_op0_constant:
684 ; SSE-NEXT: pushq %rax
685 ; SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
686 ; SSE-NEXT: movsd {{.*#+}} xmm0 = [4.2E+1,0.0E+0]
687 ; SSE-NEXT: callq fmod@PLT
688 ; SSE-NEXT: popq %rax
691 ; AVX-LABEL: frem_op0_constant:
693 ; AVX-NEXT: pushq %rax
694 ; AVX-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
695 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = [4.2E+1,0.0E+0]
696 ; AVX-NEXT: callq fmod@PLT
697 ; AVX-NEXT: popq %rax
699 %x = load double, ptr %p
700 %b = frem double 42.0, %x
701 %r = insertelement <2 x double> undef, double %b, i32 0
705 ; Try again with 256-bit types.
707 define <8 x i32> @add_op1_constant_v8i32(ptr %p) nounwind {
708 ; SSE-LABEL: add_op1_constant_v8i32:
710 ; SSE-NEXT: movl (%rdi), %eax
711 ; SSE-NEXT: addl $42, %eax
712 ; SSE-NEXT: movd %eax, %xmm0
715 ; AVX-LABEL: add_op1_constant_v8i32:
717 ; AVX-NEXT: movl (%rdi), %eax
718 ; AVX-NEXT: addl $42, %eax
719 ; AVX-NEXT: vmovd %eax, %xmm0
721 %x = load i32, ptr %p
723 %r = insertelement <8 x i32> undef, i32 %b, i32 0
727 define <4 x i64> @sub_op0_constant_v4i64(ptr %p) nounwind {
728 ; SSE-LABEL: sub_op0_constant_v4i64:
730 ; SSE-NEXT: movl $42, %eax
731 ; SSE-NEXT: subq (%rdi), %rax
732 ; SSE-NEXT: movq %rax, %xmm0
735 ; AVX-LABEL: sub_op0_constant_v4i64:
737 ; AVX-NEXT: movl $42, %eax
738 ; AVX-NEXT: subq (%rdi), %rax
739 ; AVX-NEXT: vmovq %rax, %xmm0
741 %x = load i64, ptr %p
743 %r = insertelement <4 x i64> undef, i64 %b, i32 0
747 define <8 x i32> @mul_op1_constant_v8i32(ptr %p) nounwind {
748 ; SSE-LABEL: mul_op1_constant_v8i32:
750 ; SSE-NEXT: imull $42, (%rdi), %eax
751 ; SSE-NEXT: movd %eax, %xmm0
754 ; AVX-LABEL: mul_op1_constant_v8i32:
756 ; AVX-NEXT: imull $42, (%rdi), %eax
757 ; AVX-NEXT: vmovd %eax, %xmm0
759 %x = load i32, ptr %p
761 %r = insertelement <8 x i32> undef, i32 %b, i32 0
765 define <4 x i64> @or_op1_constant_v4i64(ptr %p) nounwind {
766 ; SSE-LABEL: or_op1_constant_v4i64:
768 ; SSE-NEXT: movq (%rdi), %rax
769 ; SSE-NEXT: orq $42, %rax
770 ; SSE-NEXT: movq %rax, %xmm0
773 ; AVX-LABEL: or_op1_constant_v4i64:
775 ; AVX-NEXT: movq (%rdi), %rax
776 ; AVX-NEXT: orq $42, %rax
777 ; AVX-NEXT: vmovq %rax, %xmm0
779 %x = load i64, ptr %p
781 %r = insertelement <4 x i64> undef, i64 %b, i32 0
785 ; Try again with 512-bit types.
787 define <16 x i32> @add_op1_constant_v16i32(ptr %p) nounwind {
788 ; SSE-LABEL: add_op1_constant_v16i32:
790 ; SSE-NEXT: movl (%rdi), %eax
791 ; SSE-NEXT: addl $42, %eax
792 ; SSE-NEXT: movd %eax, %xmm0
795 ; AVX-LABEL: add_op1_constant_v16i32:
797 ; AVX-NEXT: movl (%rdi), %eax
798 ; AVX-NEXT: addl $42, %eax
799 ; AVX-NEXT: vmovd %eax, %xmm0
801 %x = load i32, ptr %p
803 %r = insertelement <16 x i32> undef, i32 %b, i32 0
807 define <8 x i64> @sub_op0_constant_v8i64(ptr %p) nounwind {
808 ; SSE-LABEL: sub_op0_constant_v8i64:
810 ; SSE-NEXT: movl $42, %eax
811 ; SSE-NEXT: subq (%rdi), %rax
812 ; SSE-NEXT: movq %rax, %xmm0
815 ; AVX-LABEL: sub_op0_constant_v8i64:
817 ; AVX-NEXT: movl $42, %eax
818 ; AVX-NEXT: subq (%rdi), %rax
819 ; AVX-NEXT: vmovq %rax, %xmm0
821 %x = load i64, ptr %p
823 %r = insertelement <8 x i64> undef, i64 %b, i32 0
827 define <16 x i32> @mul_op1_constant_v16i32(ptr %p) nounwind {
828 ; SSE-LABEL: mul_op1_constant_v16i32:
830 ; SSE-NEXT: imull $42, (%rdi), %eax
831 ; SSE-NEXT: movd %eax, %xmm0
834 ; AVX-LABEL: mul_op1_constant_v16i32:
836 ; AVX-NEXT: imull $42, (%rdi), %eax
837 ; AVX-NEXT: vmovd %eax, %xmm0
839 %x = load i32, ptr %p
841 %r = insertelement <16 x i32> undef, i32 %b, i32 0
845 define <8 x i64> @or_op1_constant_v8i64(ptr %p) nounwind {
846 ; SSE-LABEL: or_op1_constant_v8i64:
848 ; SSE-NEXT: movq (%rdi), %rax
849 ; SSE-NEXT: orq $42, %rax
850 ; SSE-NEXT: movq %rax, %xmm0
853 ; AVX-LABEL: or_op1_constant_v8i64:
855 ; AVX-NEXT: movq (%rdi), %rax
856 ; AVX-NEXT: orq $42, %rax
857 ; AVX-NEXT: vmovq %rax, %xmm0
859 %x = load i64, ptr %p
861 %r = insertelement <8 x i64> undef, i64 %b, i32 0