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: movl (%rdi), %eax
278 ; SSE-NEXT: shrl $17, %eax
279 ; SSE-NEXT: movd %eax, %xmm0
282 ; AVX-LABEL: lshr_op1_constant:
284 ; AVX-NEXT: movl (%rdi), %eax
285 ; AVX-NEXT: shrl $17, %eax
286 ; AVX-NEXT: vmovd %eax, %xmm0
288 %x = load i32, ptr %p
290 %r = insertelement <4 x i32> undef, i32 %b, i32 0
294 define <8 x i16> @ashr_op0_constant(ptr %p) nounwind {
295 ; SSE-LABEL: ashr_op0_constant:
297 ; SSE-NEXT: movzbl (%rdi), %ecx
298 ; SSE-NEXT: movl $-42, %eax
299 ; SSE-NEXT: sarl %cl, %eax
300 ; SSE-NEXT: movd %eax, %xmm0
303 ; AVX-LABEL: ashr_op0_constant:
305 ; AVX-NEXT: movzbl (%rdi), %ecx
306 ; AVX-NEXT: movl $-42, %eax
307 ; AVX-NEXT: sarl %cl, %eax
308 ; AVX-NEXT: vmovd %eax, %xmm0
310 %x = load i16, ptr %p
311 %b = ashr i16 -42, %x
312 %r = insertelement <8 x i16> undef, i16 %b, i32 0
316 define <8 x i16> @ashr_op1_constant(ptr %p) nounwind {
317 ; SSE-LABEL: ashr_op1_constant:
319 ; SSE-NEXT: movswl (%rdi), %eax
320 ; SSE-NEXT: sarl $7, %eax
321 ; SSE-NEXT: movd %eax, %xmm0
324 ; AVX-LABEL: ashr_op1_constant:
326 ; AVX-NEXT: movswl (%rdi), %eax
327 ; AVX-NEXT: sarl $7, %eax
328 ; AVX-NEXT: vmovd %eax, %xmm0
330 %x = load i16, ptr %p
332 %r = insertelement <8 x i16> undef, i16 %b, i32 0
336 define <4 x i32> @sdiv_op0_constant(ptr %p) nounwind {
337 ; SSE-LABEL: sdiv_op0_constant:
339 ; SSE-NEXT: movl $42, %eax
340 ; SSE-NEXT: xorl %edx, %edx
341 ; SSE-NEXT: idivl (%rdi)
342 ; SSE-NEXT: movd %eax, %xmm0
345 ; AVX-LABEL: sdiv_op0_constant:
347 ; AVX-NEXT: movl $42, %eax
348 ; AVX-NEXT: xorl %edx, %edx
349 ; AVX-NEXT: idivl (%rdi)
350 ; AVX-NEXT: vmovd %eax, %xmm0
352 %x = load i32, ptr %p
354 %r = insertelement <4 x i32> undef, i32 %b, i32 0
358 define <8 x i16> @sdiv_op1_constant(ptr %p) nounwind {
359 ; SSE-LABEL: sdiv_op1_constant:
361 ; SSE-NEXT: movswl (%rdi), %eax
362 ; SSE-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
363 ; SSE-NEXT: shrl $16, %ecx
364 ; SSE-NEXT: addl %eax, %ecx
365 ; SSE-NEXT: movzwl %cx, %eax
366 ; SSE-NEXT: movswl %ax, %ecx
367 ; SSE-NEXT: shrl $15, %eax
368 ; SSE-NEXT: sarl $5, %ecx
369 ; SSE-NEXT: addl %eax, %ecx
370 ; SSE-NEXT: movd %ecx, %xmm0
373 ; AVX-LABEL: sdiv_op1_constant:
375 ; AVX-NEXT: movswl (%rdi), %eax
376 ; AVX-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
377 ; AVX-NEXT: shrl $16, %ecx
378 ; AVX-NEXT: addl %eax, %ecx
379 ; AVX-NEXT: movzwl %cx, %eax
380 ; AVX-NEXT: movswl %ax, %ecx
381 ; AVX-NEXT: shrl $15, %eax
382 ; AVX-NEXT: sarl $5, %ecx
383 ; AVX-NEXT: addl %eax, %ecx
384 ; AVX-NEXT: vmovd %ecx, %xmm0
386 %x = load i16, ptr %p
388 %r = insertelement <8 x i16> undef, i16 %b, i32 0
392 define <8 x i16> @srem_op0_constant(ptr %p) nounwind {
393 ; SSE-LABEL: srem_op0_constant:
395 ; SSE-NEXT: movw $42, %ax
396 ; SSE-NEXT: xorl %edx, %edx
397 ; SSE-NEXT: idivw (%rdi)
398 ; SSE-NEXT: # kill: def $dx killed $dx def $edx
399 ; SSE-NEXT: movd %edx, %xmm0
402 ; AVX-LABEL: srem_op0_constant:
404 ; AVX-NEXT: movw $42, %ax
405 ; AVX-NEXT: xorl %edx, %edx
406 ; AVX-NEXT: idivw (%rdi)
407 ; AVX-NEXT: # kill: def $dx killed $dx def $edx
408 ; AVX-NEXT: vmovd %edx, %xmm0
410 %x = load i16, ptr %p
412 %r = insertelement <8 x i16> undef, i16 %b, i32 0
416 define <4 x i32> @srem_op1_constant(ptr %p) nounwind {
417 ; SSE-LABEL: srem_op1_constant:
419 ; SSE-NEXT: movslq (%rdi), %rax
420 ; SSE-NEXT: imulq $818089009, %rax, %rcx # imm = 0x30C30C31
421 ; SSE-NEXT: movq %rcx, %rdx
422 ; SSE-NEXT: shrq $63, %rdx
423 ; SSE-NEXT: sarq $35, %rcx
424 ; SSE-NEXT: addl %edx, %ecx
425 ; SSE-NEXT: imull $42, %ecx, %ecx
426 ; SSE-NEXT: subl %ecx, %eax
427 ; SSE-NEXT: movd %eax, %xmm0
430 ; AVX-LABEL: srem_op1_constant:
432 ; AVX-NEXT: movslq (%rdi), %rax
433 ; AVX-NEXT: imulq $818089009, %rax, %rcx # imm = 0x30C30C31
434 ; AVX-NEXT: movq %rcx, %rdx
435 ; AVX-NEXT: shrq $63, %rdx
436 ; AVX-NEXT: sarq $35, %rcx
437 ; AVX-NEXT: addl %edx, %ecx
438 ; AVX-NEXT: imull $42, %ecx, %ecx
439 ; AVX-NEXT: subl %ecx, %eax
440 ; AVX-NEXT: vmovd %eax, %xmm0
442 %x = load i32, ptr %p
444 %r = insertelement <4 x i32> undef, i32 %b, i32 0
448 define <4 x i32> @udiv_op0_constant(ptr %p) nounwind {
449 ; SSE-LABEL: udiv_op0_constant:
451 ; SSE-NEXT: movl $42, %eax
452 ; SSE-NEXT: xorl %edx, %edx
453 ; SSE-NEXT: divl (%rdi)
454 ; SSE-NEXT: movd %eax, %xmm0
457 ; AVX-LABEL: udiv_op0_constant:
459 ; AVX-NEXT: movl $42, %eax
460 ; AVX-NEXT: xorl %edx, %edx
461 ; AVX-NEXT: divl (%rdi)
462 ; AVX-NEXT: vmovd %eax, %xmm0
464 %x = load i32, ptr %p
466 %r = insertelement <4 x i32> undef, i32 %b, i32 0
470 define <2 x i64> @udiv_op1_constant(ptr %p) nounwind {
471 ; SSE-LABEL: udiv_op1_constant:
473 ; SSE-NEXT: movq (%rdi), %rax
474 ; SSE-NEXT: shrq %rax
475 ; SSE-NEXT: movabsq $-4392081922311798003, %rcx # imm = 0xC30C30C30C30C30D
476 ; SSE-NEXT: mulq %rcx
477 ; SSE-NEXT: shrq $4, %rdx
478 ; SSE-NEXT: movq %rdx, %xmm0
481 ; AVX-LABEL: udiv_op1_constant:
483 ; AVX-NEXT: movq (%rdi), %rax
484 ; AVX-NEXT: shrq %rax
485 ; AVX-NEXT: movabsq $-4392081922311798003, %rcx # imm = 0xC30C30C30C30C30D
486 ; AVX-NEXT: mulq %rcx
487 ; AVX-NEXT: shrq $4, %rdx
488 ; AVX-NEXT: vmovq %rdx, %xmm0
490 %x = load i64, ptr %p
492 %r = insertelement <2 x i64> undef, i64 %b, i32 0
496 define <2 x i64> @urem_op0_constant(ptr %p) nounwind {
497 ; SSE-LABEL: urem_op0_constant:
499 ; SSE-NEXT: movl $42, %eax
500 ; SSE-NEXT: xorl %edx, %edx
501 ; SSE-NEXT: divq (%rdi)
502 ; SSE-NEXT: movq %rdx, %xmm0
505 ; AVX-LABEL: urem_op0_constant:
507 ; AVX-NEXT: movl $42, %eax
508 ; AVX-NEXT: xorl %edx, %edx
509 ; AVX-NEXT: divq (%rdi)
510 ; AVX-NEXT: vmovq %rdx, %xmm0
512 %x = load i64, ptr %p
514 %r = insertelement <2 x i64> undef, i64 %b, i32 0
518 define <16 x i8> @urem_op1_constant(ptr %p) nounwind {
519 ; SSE-LABEL: urem_op1_constant:
521 ; SSE-NEXT: movzbl (%rdi), %eax
522 ; SSE-NEXT: movl %eax, %ecx
524 ; SSE-NEXT: movzbl %cl, %ecx
525 ; SSE-NEXT: imull $49, %ecx, %ecx
526 ; SSE-NEXT: shrl $10, %ecx
527 ; SSE-NEXT: imull $42, %ecx, %ecx
528 ; SSE-NEXT: subb %cl, %al
529 ; SSE-NEXT: movzbl %al, %eax
530 ; SSE-NEXT: movd %eax, %xmm0
533 ; AVX-LABEL: urem_op1_constant:
535 ; AVX-NEXT: movzbl (%rdi), %eax
536 ; AVX-NEXT: movl %eax, %ecx
538 ; AVX-NEXT: movzbl %cl, %ecx
539 ; AVX-NEXT: imull $49, %ecx, %ecx
540 ; AVX-NEXT: shrl $10, %ecx
541 ; AVX-NEXT: imull $42, %ecx, %ecx
542 ; AVX-NEXT: subb %cl, %al
543 ; AVX-NEXT: vmovd %eax, %xmm0
547 %r = insertelement <16 x i8> undef, i8 %b, i32 0
551 define <4 x float> @fadd_op1_constant(ptr %p) nounwind {
552 ; SSE-LABEL: fadd_op1_constant:
554 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
555 ; SSE-NEXT: addss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
558 ; AVX-LABEL: fadd_op1_constant:
560 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
561 ; AVX-NEXT: vaddss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
563 %x = load float, ptr %p
564 %b = fadd float %x, 42.0
565 %r = insertelement <4 x float> undef, float %b, i32 0
569 define <2 x double> @fsub_op1_constant(ptr %p) nounwind {
570 ; SSE-LABEL: fsub_op1_constant:
572 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
573 ; SSE-NEXT: addsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
576 ; AVX-LABEL: fsub_op1_constant:
578 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
579 ; AVX-NEXT: vaddsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
581 %x = load double, ptr %p
582 %b = fsub double %x, 42.0
583 %r = insertelement <2 x double> undef, double %b, i32 0
587 define <4 x float> @fsub_op0_constant(ptr %p) nounwind {
588 ; SSE-LABEL: fsub_op0_constant:
590 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
591 ; SSE-NEXT: subss (%rdi), %xmm0
594 ; AVX-LABEL: fsub_op0_constant:
596 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
597 ; AVX-NEXT: vsubss (%rdi), %xmm0, %xmm0
599 %x = load float, ptr %p
600 %b = fsub float 42.0, %x
601 %r = insertelement <4 x float> undef, float %b, i32 0
605 define <4 x float> @fmul_op1_constant(ptr %p) nounwind {
606 ; SSE-LABEL: fmul_op1_constant:
608 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
609 ; SSE-NEXT: mulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
612 ; AVX-LABEL: fmul_op1_constant:
614 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
615 ; AVX-NEXT: vmulss {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
617 %x = load float, ptr %p
618 %b = fmul float %x, 42.0
619 %r = insertelement <4 x float> undef, float %b, i32 0
623 define <2 x double> @fdiv_op1_constant(ptr %p) nounwind {
624 ; SSE-LABEL: fdiv_op1_constant:
626 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
627 ; SSE-NEXT: divsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
630 ; AVX-LABEL: fdiv_op1_constant:
632 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
633 ; AVX-NEXT: vdivsd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
635 %x = load double, ptr %p
636 %b = fdiv double %x, 42.0
637 %r = insertelement <2 x double> undef, double %b, i32 0
641 define <4 x float> @fdiv_op0_constant(ptr %p) nounwind {
642 ; SSE-LABEL: fdiv_op0_constant:
644 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
645 ; SSE-NEXT: divss (%rdi), %xmm0
648 ; AVX-LABEL: fdiv_op0_constant:
650 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
651 ; AVX-NEXT: vdivss (%rdi), %xmm0, %xmm0
653 %x = load float, ptr %p
654 %b = fdiv float 42.0, %x
655 %r = insertelement <4 x float> undef, float %b, i32 0
659 define <4 x float> @frem_op1_constant(ptr %p) nounwind {
660 ; SSE-LABEL: frem_op1_constant:
662 ; SSE-NEXT: pushq %rax
663 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
664 ; SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
665 ; SSE-NEXT: callq fmodf@PLT
666 ; SSE-NEXT: popq %rax
669 ; AVX-LABEL: frem_op1_constant:
671 ; AVX-NEXT: pushq %rax
672 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
673 ; AVX-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
674 ; AVX-NEXT: callq fmodf@PLT
675 ; AVX-NEXT: popq %rax
677 %x = load float, ptr %p
678 %b = frem float %x, 42.0
679 %r = insertelement <4 x float> undef, float %b, i32 0
683 define <2 x double> @frem_op0_constant(ptr %p) nounwind {
684 ; SSE-LABEL: frem_op0_constant:
686 ; SSE-NEXT: pushq %rax
687 ; SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
688 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
689 ; SSE-NEXT: callq fmod@PLT
690 ; SSE-NEXT: popq %rax
693 ; AVX-LABEL: frem_op0_constant:
695 ; AVX-NEXT: pushq %rax
696 ; AVX-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
697 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
698 ; AVX-NEXT: callq fmod@PLT
699 ; AVX-NEXT: popq %rax
701 %x = load double, ptr %p
702 %b = frem double 42.0, %x
703 %r = insertelement <2 x double> undef, double %b, i32 0
707 ; Try again with 256-bit types.
709 define <8 x i32> @add_op1_constant_v8i32(ptr %p) nounwind {
710 ; SSE-LABEL: add_op1_constant_v8i32:
712 ; SSE-NEXT: movl (%rdi), %eax
713 ; SSE-NEXT: addl $42, %eax
714 ; SSE-NEXT: movd %eax, %xmm0
717 ; AVX-LABEL: add_op1_constant_v8i32:
719 ; AVX-NEXT: movl (%rdi), %eax
720 ; AVX-NEXT: addl $42, %eax
721 ; AVX-NEXT: vmovd %eax, %xmm0
723 %x = load i32, ptr %p
725 %r = insertelement <8 x i32> undef, i32 %b, i32 0
729 define <4 x i64> @sub_op0_constant_v4i64(ptr %p) nounwind {
730 ; SSE-LABEL: sub_op0_constant_v4i64:
732 ; SSE-NEXT: movl $42, %eax
733 ; SSE-NEXT: subq (%rdi), %rax
734 ; SSE-NEXT: movq %rax, %xmm0
737 ; AVX-LABEL: sub_op0_constant_v4i64:
739 ; AVX-NEXT: movl $42, %eax
740 ; AVX-NEXT: subq (%rdi), %rax
741 ; AVX-NEXT: vmovq %rax, %xmm0
743 %x = load i64, ptr %p
745 %r = insertelement <4 x i64> undef, i64 %b, i32 0
749 define <8 x i32> @mul_op1_constant_v8i32(ptr %p) nounwind {
750 ; SSE-LABEL: mul_op1_constant_v8i32:
752 ; SSE-NEXT: imull $42, (%rdi), %eax
753 ; SSE-NEXT: movd %eax, %xmm0
756 ; AVX-LABEL: mul_op1_constant_v8i32:
758 ; AVX-NEXT: imull $42, (%rdi), %eax
759 ; AVX-NEXT: vmovd %eax, %xmm0
761 %x = load i32, ptr %p
763 %r = insertelement <8 x i32> undef, i32 %b, i32 0
767 define <4 x i64> @or_op1_constant_v4i64(ptr %p) nounwind {
768 ; SSE-LABEL: or_op1_constant_v4i64:
770 ; SSE-NEXT: movq (%rdi), %rax
771 ; SSE-NEXT: orq $42, %rax
772 ; SSE-NEXT: movq %rax, %xmm0
775 ; AVX-LABEL: or_op1_constant_v4i64:
777 ; AVX-NEXT: movq (%rdi), %rax
778 ; AVX-NEXT: orq $42, %rax
779 ; AVX-NEXT: vmovq %rax, %xmm0
781 %x = load i64, ptr %p
783 %r = insertelement <4 x i64> undef, i64 %b, i32 0
787 ; Try again with 512-bit types.
789 define <16 x i32> @add_op1_constant_v16i32(ptr %p) nounwind {
790 ; SSE-LABEL: add_op1_constant_v16i32:
792 ; SSE-NEXT: movl (%rdi), %eax
793 ; SSE-NEXT: addl $42, %eax
794 ; SSE-NEXT: movd %eax, %xmm0
797 ; AVX-LABEL: add_op1_constant_v16i32:
799 ; AVX-NEXT: movl (%rdi), %eax
800 ; AVX-NEXT: addl $42, %eax
801 ; AVX-NEXT: vmovd %eax, %xmm0
803 %x = load i32, ptr %p
805 %r = insertelement <16 x i32> undef, i32 %b, i32 0
809 define <8 x i64> @sub_op0_constant_v8i64(ptr %p) nounwind {
810 ; SSE-LABEL: sub_op0_constant_v8i64:
812 ; SSE-NEXT: movl $42, %eax
813 ; SSE-NEXT: subq (%rdi), %rax
814 ; SSE-NEXT: movq %rax, %xmm0
817 ; AVX-LABEL: sub_op0_constant_v8i64:
819 ; AVX-NEXT: movl $42, %eax
820 ; AVX-NEXT: subq (%rdi), %rax
821 ; AVX-NEXT: vmovq %rax, %xmm0
823 %x = load i64, ptr %p
825 %r = insertelement <8 x i64> undef, i64 %b, i32 0
829 define <16 x i32> @mul_op1_constant_v16i32(ptr %p) nounwind {
830 ; SSE-LABEL: mul_op1_constant_v16i32:
832 ; SSE-NEXT: imull $42, (%rdi), %eax
833 ; SSE-NEXT: movd %eax, %xmm0
836 ; AVX-LABEL: mul_op1_constant_v16i32:
838 ; AVX-NEXT: imull $42, (%rdi), %eax
839 ; AVX-NEXT: vmovd %eax, %xmm0
841 %x = load i32, ptr %p
843 %r = insertelement <16 x i32> undef, i32 %b, i32 0
847 define <8 x i64> @or_op1_constant_v8i64(ptr %p) nounwind {
848 ; SSE-LABEL: or_op1_constant_v8i64:
850 ; SSE-NEXT: movq (%rdi), %rax
851 ; SSE-NEXT: orq $42, %rax
852 ; SSE-NEXT: movq %rax, %xmm0
855 ; AVX-LABEL: or_op1_constant_v8i64:
857 ; AVX-NEXT: movq (%rdi), %rax
858 ; AVX-NEXT: orq $42, %rax
859 ; AVX-NEXT: vmovq %rax, %xmm0
861 %x = load i64, ptr %p
863 %r = insertelement <8 x i64> undef, i64 %b, i32 0