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-prefixes=SSE,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse4.2 | FileCheck %s --check-prefixes=SSE,SSE4
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
5 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
6 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx512dq,+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512
8 define <4 x i32> @add_op1_constant(i32* %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
22 %x = load i32, i32* %p
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(i32* %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
44 %x = load i32, i32* %p
46 %r = insertelement <4 x i32> undef, i32 %b, i32 0
50 define <8 x i16> @add_op0_constant(i16* %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
64 %x = load i16, i16* %p
66 %r = insertelement <8 x i16> undef, i16 %b, i32 0
70 define <2 x i64> @sub_op0_constant(i64* %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
84 %x = load i64, i64* %p
86 %r = insertelement <2 x i64> undef, i64 %b, i32 0
90 define <16 x i8> @sub_op1_constant(i8* %p) nounwind {
91 ; SSE-LABEL: sub_op1_constant:
93 ; SSE-NEXT: movb (%rdi), %al
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: movb (%rdi), %al
102 ; AVX-NEXT: addb $-42, %al
103 ; AVX-NEXT: movzbl %al, %eax
104 ; AVX-NEXT: vmovd %eax, %xmm0
108 %r = insertelement <16 x i8> undef, i8 %b, i32 0
112 define <4 x i32> @mul_op1_constant(i32* %p) nounwind {
113 ; SSE-LABEL: mul_op1_constant:
115 ; SSE-NEXT: imull $42, (%rdi), %eax
116 ; SSE-NEXT: movd %eax, %xmm0
119 ; AVX-LABEL: mul_op1_constant:
121 ; AVX-NEXT: imull $42, (%rdi), %eax
122 ; AVX-NEXT: vmovd %eax, %xmm0
124 %x = load i32, i32* %p
126 %r = insertelement <4 x i32> undef, i32 %b, i32 0
130 define <8 x i16> @mul_op0_constant(i16* %p) nounwind {
131 ; SSE-LABEL: mul_op0_constant:
133 ; SSE-NEXT: movzwl (%rdi), %eax
134 ; SSE-NEXT: imull $42, %eax, %eax
135 ; SSE-NEXT: movd %eax, %xmm0
138 ; AVX-LABEL: mul_op0_constant:
140 ; AVX-NEXT: movzwl (%rdi), %eax
141 ; AVX-NEXT: imull $42, %eax, %eax
142 ; AVX-NEXT: vmovd %eax, %xmm0
144 %x = load i16, i16* %p
146 %r = insertelement <8 x i16> undef, i16 %b, i32 0
150 define <4 x i32> @and_op1_constant(i32* %p) nounwind {
151 ; SSE-LABEL: and_op1_constant:
153 ; SSE-NEXT: movl (%rdi), %eax
154 ; SSE-NEXT: andl $42, %eax
155 ; SSE-NEXT: movd %eax, %xmm0
158 ; AVX-LABEL: and_op1_constant:
160 ; AVX-NEXT: movl (%rdi), %eax
161 ; AVX-NEXT: andl $42, %eax
162 ; AVX-NEXT: vmovd %eax, %xmm0
164 %x = load i32, i32* %p
166 %r = insertelement <4 x i32> undef, i32 %b, i32 0
170 define <2 x i64> @or_op1_constant(i64* %p) nounwind {
171 ; SSE-LABEL: or_op1_constant:
173 ; SSE-NEXT: movq (%rdi), %rax
174 ; SSE-NEXT: orq $42, %rax
175 ; SSE-NEXT: movq %rax, %xmm0
178 ; AVX-LABEL: or_op1_constant:
180 ; AVX-NEXT: movq (%rdi), %rax
181 ; AVX-NEXT: orq $42, %rax
182 ; AVX-NEXT: vmovq %rax, %xmm0
184 %x = load i64, i64* %p
186 %r = insertelement <2 x i64> undef, i64 %b, i32 0
190 define <8 x i16> @xor_op1_constant(i16* %p) nounwind {
191 ; SSE-LABEL: xor_op1_constant:
193 ; SSE-NEXT: movzwl (%rdi), %eax
194 ; SSE-NEXT: xorl $42, %eax
195 ; SSE-NEXT: movd %eax, %xmm0
198 ; AVX-LABEL: xor_op1_constant:
200 ; AVX-NEXT: movzwl (%rdi), %eax
201 ; AVX-NEXT: xorl $42, %eax
202 ; AVX-NEXT: vmovd %eax, %xmm0
204 %x = load i16, i16* %p
206 %r = insertelement <8 x i16> undef, i16 %b, i32 0
210 define <4 x i32> @shl_op0_constant(i32* %p) nounwind {
211 ; SSE-LABEL: shl_op0_constant:
213 ; SSE-NEXT: movb (%rdi), %cl
214 ; SSE-NEXT: movl $42, %eax
215 ; SSE-NEXT: shll %cl, %eax
216 ; SSE-NEXT: movd %eax, %xmm0
219 ; AVX-LABEL: shl_op0_constant:
221 ; AVX-NEXT: movb (%rdi), %cl
222 ; AVX-NEXT: movl $42, %eax
223 ; AVX-NEXT: shll %cl, %eax
224 ; AVX-NEXT: vmovd %eax, %xmm0
226 %x = load i32, i32* %p
228 %r = insertelement <4 x i32> undef, i32 %b, i32 0
232 define <16 x i8> @shl_op1_constant(i8* %p) nounwind {
233 ; SSE-LABEL: shl_op1_constant:
235 ; SSE-NEXT: movb (%rdi), %al
236 ; SSE-NEXT: shlb $5, %al
237 ; SSE-NEXT: movzbl %al, %eax
238 ; SSE-NEXT: movd %eax, %xmm0
241 ; AVX-LABEL: shl_op1_constant:
243 ; AVX-NEXT: movb (%rdi), %al
244 ; AVX-NEXT: shlb $5, %al
245 ; AVX-NEXT: movzbl %al, %eax
246 ; AVX-NEXT: vmovd %eax, %xmm0
250 %r = insertelement <16 x i8> undef, i8 %b, i32 0
254 define <2 x i64> @lshr_op0_constant(i64* %p) nounwind {
255 ; SSE-LABEL: lshr_op0_constant:
257 ; SSE-NEXT: movb (%rdi), %cl
258 ; SSE-NEXT: movl $42, %eax
259 ; SSE-NEXT: shrq %cl, %rax
260 ; SSE-NEXT: movq %rax, %xmm0
263 ; AVX-LABEL: lshr_op0_constant:
265 ; AVX-NEXT: movb (%rdi), %cl
266 ; AVX-NEXT: movl $42, %eax
267 ; AVX-NEXT: shrq %cl, %rax
268 ; AVX-NEXT: vmovq %rax, %xmm0
270 %x = load i64, i64* %p
272 %r = insertelement <2 x i64> undef, i64 %b, i32 0
276 define <4 x i32> @lshr_op1_constant(i32* %p) nounwind {
277 ; SSE-LABEL: lshr_op1_constant:
279 ; SSE-NEXT: movl (%rdi), %eax
280 ; SSE-NEXT: shrl $17, %eax
281 ; SSE-NEXT: movd %eax, %xmm0
284 ; AVX-LABEL: lshr_op1_constant:
286 ; AVX-NEXT: movl (%rdi), %eax
287 ; AVX-NEXT: shrl $17, %eax
288 ; AVX-NEXT: vmovd %eax, %xmm0
290 %x = load i32, i32* %p
292 %r = insertelement <4 x i32> undef, i32 %b, i32 0
296 define <8 x i16> @ashr_op0_constant(i16* %p) nounwind {
297 ; SSE-LABEL: ashr_op0_constant:
299 ; SSE-NEXT: movb (%rdi), %cl
300 ; SSE-NEXT: movw $-42, %ax
301 ; SSE-NEXT: sarw %cl, %ax
302 ; SSE-NEXT: movd %eax, %xmm0
305 ; AVX-LABEL: ashr_op0_constant:
307 ; AVX-NEXT: movb (%rdi), %cl
308 ; AVX-NEXT: movw $-42, %ax
309 ; AVX-NEXT: sarw %cl, %ax
310 ; AVX-NEXT: vmovd %eax, %xmm0
312 %x = load i16, i16* %p
313 %b = ashr i16 -42, %x
314 %r = insertelement <8 x i16> undef, i16 %b, i32 0
318 define <8 x i16> @ashr_op1_constant(i16* %p) nounwind {
319 ; SSE-LABEL: ashr_op1_constant:
321 ; SSE-NEXT: movzwl (%rdi), %eax
322 ; SSE-NEXT: sarw $7, %ax
323 ; SSE-NEXT: movd %eax, %xmm0
326 ; AVX-LABEL: ashr_op1_constant:
328 ; AVX-NEXT: movzwl (%rdi), %eax
329 ; AVX-NEXT: sarw $7, %ax
330 ; AVX-NEXT: vmovd %eax, %xmm0
332 %x = load i16, i16* %p
334 %r = insertelement <8 x i16> undef, i16 %b, i32 0
338 define <4 x i32> @sdiv_op0_constant(i32* %p) nounwind {
339 ; SSE-LABEL: sdiv_op0_constant:
341 ; SSE-NEXT: movl $42, %eax
342 ; SSE-NEXT: xorl %edx, %edx
343 ; SSE-NEXT: idivl (%rdi)
344 ; SSE-NEXT: movd %eax, %xmm0
347 ; AVX-LABEL: sdiv_op0_constant:
349 ; AVX-NEXT: movl $42, %eax
350 ; AVX-NEXT: xorl %edx, %edx
351 ; AVX-NEXT: idivl (%rdi)
352 ; AVX-NEXT: vmovd %eax, %xmm0
354 %x = load i32, i32* %p
356 %r = insertelement <4 x i32> undef, i32 %b, i32 0
360 define <8 x i16> @sdiv_op1_constant(i16* %p) nounwind {
361 ; SSE-LABEL: sdiv_op1_constant:
363 ; SSE-NEXT: movswl (%rdi), %eax
364 ; SSE-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
365 ; SSE-NEXT: shrl $16, %ecx
366 ; SSE-NEXT: addl %eax, %ecx
367 ; SSE-NEXT: movzwl %cx, %eax
368 ; SSE-NEXT: sarw $5, %cx
369 ; SSE-NEXT: shrl $15, %eax
370 ; SSE-NEXT: addl %ecx, %eax
371 ; SSE-NEXT: movd %eax, %xmm0
374 ; AVX-LABEL: sdiv_op1_constant:
376 ; AVX-NEXT: movswl (%rdi), %eax
377 ; AVX-NEXT: imull $-15603, %eax, %ecx # imm = 0xC30D
378 ; AVX-NEXT: shrl $16, %ecx
379 ; AVX-NEXT: addl %eax, %ecx
380 ; AVX-NEXT: movzwl %cx, %eax
381 ; AVX-NEXT: sarw $5, %cx
382 ; AVX-NEXT: shrl $15, %eax
383 ; AVX-NEXT: addl %ecx, %eax
384 ; AVX-NEXT: vmovd %eax, %xmm0
386 %x = load i16, i16* %p
388 %r = insertelement <8 x i16> undef, i16 %b, i32 0
392 define <8 x i16> @srem_op0_constant(i16* %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, i16* %p
412 %r = insertelement <8 x i16> undef, i16 %b, i32 0
416 define <4 x i32> @srem_op1_constant(i32* %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, i32* %p
444 %r = insertelement <4 x i32> undef, i32 %b, i32 0
448 define <4 x i32> @udiv_op0_constant(i32* %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, i32* %p
466 %r = insertelement <4 x i32> undef, i32 %b, i32 0
470 define <2 x i64> @udiv_op1_constant(i64* %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, i64* %p
492 %r = insertelement <2 x i64> undef, i64 %b, i32 0
496 define <2 x i64> @urem_op0_constant(i64* %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, i64* %p
514 %r = insertelement <2 x i64> undef, i64 %b, i32 0
518 define <16 x i8> @urem_op1_constant(i8* %p) nounwind {
519 ; SSE-LABEL: urem_op1_constant:
521 ; SSE-NEXT: movb (%rdi), %al
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: movb (%rdi), %al
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: movzbl %al, %eax
544 ; AVX-NEXT: vmovd %eax, %xmm0
548 %r = insertelement <16 x i8> undef, i8 %b, i32 0
552 define <4 x float> @fadd_op1_constant(float* %p) nounwind {
553 ; SSE-LABEL: fadd_op1_constant:
555 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
556 ; SSE-NEXT: addss {{.*}}(%rip), %xmm0
559 ; AVX-LABEL: fadd_op1_constant:
561 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
562 ; AVX-NEXT: vaddss {{.*}}(%rip), %xmm0, %xmm0
564 %x = load float, float* %p
565 %b = fadd float %x, 42.0
566 %r = insertelement <4 x float> undef, float %b, i32 0
570 define <2 x double> @fsub_op1_constant(double* %p) nounwind {
571 ; SSE-LABEL: fsub_op1_constant:
573 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
574 ; SSE-NEXT: addsd {{.*}}(%rip), %xmm0
577 ; AVX-LABEL: fsub_op1_constant:
579 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
580 ; AVX-NEXT: vaddsd {{.*}}(%rip), %xmm0, %xmm0
582 %x = load double, double* %p
583 %b = fsub double %x, 42.0
584 %r = insertelement <2 x double> undef, double %b, i32 0
588 define <4 x float> @fsub_op0_constant(float* %p) nounwind {
589 ; SSE-LABEL: fsub_op0_constant:
591 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
592 ; SSE-NEXT: subss (%rdi), %xmm0
595 ; AVX-LABEL: fsub_op0_constant:
597 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
598 ; AVX-NEXT: vsubss (%rdi), %xmm0, %xmm0
600 %x = load float, float* %p
601 %b = fsub float 42.0, %x
602 %r = insertelement <4 x float> undef, float %b, i32 0
606 define <4 x float> @fmul_op1_constant(float* %p) nounwind {
607 ; SSE-LABEL: fmul_op1_constant:
609 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
610 ; SSE-NEXT: mulss {{.*}}(%rip), %xmm0
613 ; AVX-LABEL: fmul_op1_constant:
615 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
616 ; AVX-NEXT: vmulss {{.*}}(%rip), %xmm0, %xmm0
618 %x = load float, float* %p
619 %b = fmul float %x, 42.0
620 %r = insertelement <4 x float> undef, float %b, i32 0
624 define <2 x double> @fdiv_op1_constant(double* %p) nounwind {
625 ; SSE-LABEL: fdiv_op1_constant:
627 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
628 ; SSE-NEXT: divsd {{.*}}(%rip), %xmm0
631 ; AVX-LABEL: fdiv_op1_constant:
633 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
634 ; AVX-NEXT: vdivsd {{.*}}(%rip), %xmm0, %xmm0
636 %x = load double, double* %p
637 %b = fdiv double %x, 42.0
638 %r = insertelement <2 x double> undef, double %b, i32 0
642 define <4 x float> @fdiv_op0_constant(float* %p) nounwind {
643 ; SSE-LABEL: fdiv_op0_constant:
645 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
646 ; SSE-NEXT: divss (%rdi), %xmm0
649 ; AVX-LABEL: fdiv_op0_constant:
651 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
652 ; AVX-NEXT: vdivss (%rdi), %xmm0, %xmm0
654 %x = load float, float* %p
655 %b = fdiv float 42.0, %x
656 %r = insertelement <4 x float> undef, float %b, i32 0
660 define <4 x float> @frem_op1_constant(float* %p) nounwind {
661 ; SSE-LABEL: frem_op1_constant:
663 ; SSE-NEXT: pushq %rax
664 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
665 ; SSE-NEXT: movss {{.*#+}} xmm1 = mem[0],zero,zero,zero
666 ; SSE-NEXT: callq fmodf
667 ; SSE-NEXT: popq %rax
670 ; AVX-LABEL: frem_op1_constant:
672 ; AVX-NEXT: pushq %rax
673 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
674 ; AVX-NEXT: vmovss {{.*#+}} xmm1 = mem[0],zero,zero,zero
675 ; AVX-NEXT: callq fmodf
676 ; AVX-NEXT: popq %rax
678 %x = load float, float* %p
679 %b = frem float %x, 42.0
680 %r = insertelement <4 x float> undef, float %b, i32 0
684 define <2 x double> @frem_op0_constant(double* %p) nounwind {
685 ; SSE-LABEL: frem_op0_constant:
687 ; SSE-NEXT: pushq %rax
688 ; SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
689 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
690 ; SSE-NEXT: callq fmod
691 ; SSE-NEXT: popq %rax
694 ; AVX-LABEL: frem_op0_constant:
696 ; AVX-NEXT: pushq %rax
697 ; AVX-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
698 ; AVX-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
699 ; AVX-NEXT: callq fmod
700 ; AVX-NEXT: popq %rax
702 %x = load double, double* %p
703 %b = frem double 42.0, %x
704 %r = insertelement <2 x double> undef, double %b, i32 0
708 ; Try again with 256-bit types.
710 define <8 x i32> @add_op1_constant_v8i32(i32* %p) nounwind {
711 ; SSE-LABEL: add_op1_constant_v8i32:
713 ; SSE-NEXT: movl (%rdi), %eax
714 ; SSE-NEXT: addl $42, %eax
715 ; SSE-NEXT: movd %eax, %xmm0
718 ; AVX-LABEL: add_op1_constant_v8i32:
720 ; AVX-NEXT: movl (%rdi), %eax
721 ; AVX-NEXT: addl $42, %eax
722 ; AVX-NEXT: vmovd %eax, %xmm0
724 %x = load i32, i32* %p
726 %r = insertelement <8 x i32> undef, i32 %b, i32 0
730 define <4 x i64> @sub_op0_constant_v4i64(i64* %p) nounwind {
731 ; SSE-LABEL: sub_op0_constant_v4i64:
733 ; SSE-NEXT: movl $42, %eax
734 ; SSE-NEXT: subq (%rdi), %rax
735 ; SSE-NEXT: movq %rax, %xmm0
738 ; AVX-LABEL: sub_op0_constant_v4i64:
740 ; AVX-NEXT: movl $42, %eax
741 ; AVX-NEXT: subq (%rdi), %rax
742 ; AVX-NEXT: vmovq %rax, %xmm0
744 %x = load i64, i64* %p
746 %r = insertelement <4 x i64> undef, i64 %b, i32 0
750 define <8 x i32> @mul_op1_constant_v8i32(i32* %p) nounwind {
751 ; SSE-LABEL: mul_op1_constant_v8i32:
753 ; SSE-NEXT: imull $42, (%rdi), %eax
754 ; SSE-NEXT: movd %eax, %xmm0
757 ; AVX-LABEL: mul_op1_constant_v8i32:
759 ; AVX-NEXT: imull $42, (%rdi), %eax
760 ; AVX-NEXT: vmovd %eax, %xmm0
762 %x = load i32, i32* %p
764 %r = insertelement <8 x i32> undef, i32 %b, i32 0
768 define <4 x i64> @or_op1_constant_v4i64(i64* %p) nounwind {
769 ; SSE-LABEL: or_op1_constant_v4i64:
771 ; SSE-NEXT: movq (%rdi), %rax
772 ; SSE-NEXT: orq $42, %rax
773 ; SSE-NEXT: movq %rax, %xmm0
776 ; AVX-LABEL: or_op1_constant_v4i64:
778 ; AVX-NEXT: movq (%rdi), %rax
779 ; AVX-NEXT: orq $42, %rax
780 ; AVX-NEXT: vmovq %rax, %xmm0
782 %x = load i64, i64* %p
784 %r = insertelement <4 x i64> undef, i64 %b, i32 0
788 ; Try again with 512-bit types.
790 define <16 x i32> @add_op1_constant_v16i32(i32* %p) nounwind {
791 ; SSE-LABEL: add_op1_constant_v16i32:
793 ; SSE-NEXT: movl (%rdi), %eax
794 ; SSE-NEXT: addl $42, %eax
795 ; SSE-NEXT: movd %eax, %xmm0
798 ; AVX-LABEL: add_op1_constant_v16i32:
800 ; AVX-NEXT: movl (%rdi), %eax
801 ; AVX-NEXT: addl $42, %eax
802 ; AVX-NEXT: vmovd %eax, %xmm0
804 %x = load i32, i32* %p
806 %r = insertelement <16 x i32> undef, i32 %b, i32 0
810 define <8 x i64> @sub_op0_constant_v8i64(i64* %p) nounwind {
811 ; SSE-LABEL: sub_op0_constant_v8i64:
813 ; SSE-NEXT: movl $42, %eax
814 ; SSE-NEXT: subq (%rdi), %rax
815 ; SSE-NEXT: movq %rax, %xmm0
818 ; AVX-LABEL: sub_op0_constant_v8i64:
820 ; AVX-NEXT: movl $42, %eax
821 ; AVX-NEXT: subq (%rdi), %rax
822 ; AVX-NEXT: vmovq %rax, %xmm0
824 %x = load i64, i64* %p
826 %r = insertelement <8 x i64> undef, i64 %b, i32 0
830 define <16 x i32> @mul_op1_constant_v16i32(i32* %p) nounwind {
831 ; SSE-LABEL: mul_op1_constant_v16i32:
833 ; SSE-NEXT: imull $42, (%rdi), %eax
834 ; SSE-NEXT: movd %eax, %xmm0
837 ; AVX-LABEL: mul_op1_constant_v16i32:
839 ; AVX-NEXT: imull $42, (%rdi), %eax
840 ; AVX-NEXT: vmovd %eax, %xmm0
842 %x = load i32, i32* %p
844 %r = insertelement <16 x i32> undef, i32 %b, i32 0
848 define <8 x i64> @or_op1_constant_v8i64(i64* %p) nounwind {
849 ; SSE-LABEL: or_op1_constant_v8i64:
851 ; SSE-NEXT: movq (%rdi), %rax
852 ; SSE-NEXT: orq $42, %rax
853 ; SSE-NEXT: movq %rax, %xmm0
856 ; AVX-LABEL: or_op1_constant_v8i64:
858 ; AVX-NEXT: movq (%rdi), %rax
859 ; AVX-NEXT: orq $42, %rax
860 ; AVX-NEXT: vmovq %rax, %xmm0
862 %x = load i64, i64* %p
864 %r = insertelement <8 x i64> undef, i64 %b, i32 0