1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-- -mattr=+sse2 | FileCheck %s --check-prefixes=X86
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx2 | FileCheck %s --check-prefixes=X64
5 define i32 @freeze_and(i32 %a0) nounwind {
6 ; X86-LABEL: freeze_and:
8 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
9 ; X86-NEXT: andl $7, %eax
12 ; X64-LABEL: freeze_and:
14 ; X64-NEXT: movl %edi, %eax
15 ; X64-NEXT: andl $7, %eax
23 define i32 @freeze_and_extra_use(i32 %a0, ptr %escape) nounwind {
24 ; X86-LABEL: freeze_and_extra_use:
26 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
27 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
28 ; X86-NEXT: movl %eax, (%ecx)
29 ; X86-NEXT: andl $7, %eax
32 ; X64-LABEL: freeze_and_extra_use:
34 ; X64-NEXT: movl %edi, %eax
35 ; X64-NEXT: movl %edi, (%rsi)
36 ; X64-NEXT: andl $7, %eax
38 store i32 %a0, ptr %escape
44 define i32 @freeze_and_extra_use2(i32 %a0, ptr %escape) nounwind {
45 ; X86-LABEL: freeze_and_extra_use2:
47 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
48 ; X86-NEXT: andl $15, %eax
51 ; X64-LABEL: freeze_and_extra_use2:
53 ; X64-NEXT: movl %edi, %eax
54 ; X64-NEXT: andl $15, %eax
63 define <2 x i64> @freeze_and_vec(<2 x i64> %a0) nounwind {
64 ; X86-LABEL: freeze_and_vec:
66 ; X86-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
69 ; X64-LABEL: freeze_and_vec:
71 ; X64-NEXT: vandps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
73 %x = and <2 x i64> %a0, <i64 15, i64 7>
74 %y = freeze <2 x i64> %x
75 %z = and <2 x i64> %y, <i64 7, i64 15>
79 define i32 @freeze_or(i32 %a0) nounwind {
80 ; X86-LABEL: freeze_or:
82 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
83 ; X86-NEXT: orl $15, %eax
86 ; X64-LABEL: freeze_or:
88 ; X64-NEXT: movl %edi, %eax
89 ; X64-NEXT: orl $15, %eax
97 define <2 x i64> @freeze_or_vec(<2 x i64> %a0) nounwind {
98 ; X86-LABEL: freeze_or_vec:
100 ; X86-NEXT: orps {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
103 ; X64-LABEL: freeze_or_vec:
105 ; X64-NEXT: vorps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
107 %x = or <2 x i64> %a0, <i64 1, i64 3>
108 %y = freeze <2 x i64> %x
109 %z = or <2 x i64> %y, <i64 14, i64 12>
113 define i32 @freeze_xor(i32 %a0) nounwind {
114 ; X86-LABEL: freeze_xor:
116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
117 ; X86-NEXT: xorl $15, %eax
120 ; X64-LABEL: freeze_xor:
122 ; X64-NEXT: movl %edi, %eax
123 ; X64-NEXT: xorl $15, %eax
131 define <8 x i16> @freeze_xor_vec(<8 x i16> %a0) nounwind {
132 ; X86-LABEL: freeze_xor_vec:
134 ; X86-NEXT: pcmpeqd %xmm1, %xmm1
135 ; X86-NEXT: pxor %xmm1, %xmm0
138 ; X64-LABEL: freeze_xor_vec:
140 ; X64-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
141 ; X64-NEXT: vpxor %xmm1, %xmm0, %xmm0
143 %x = xor <8 x i16> %a0, <i16 -1, i16 0, i16 -1, i16 0, i16 -1, i16 0, i16 -1, i16 0>
144 %y = freeze <8 x i16> %x
145 %z = xor <8 x i16> %y, <i16 0, i16 -1, i16 0, i16 -1, i16 0, i16 -1, i16 0, i16 -1>
149 define i32 @freeze_add(i32 %a0) nounwind {
150 ; X86-LABEL: freeze_add:
152 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
153 ; X86-NEXT: addl $2, %eax
156 ; X64-LABEL: freeze_add:
158 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
159 ; X64-NEXT: leal 2(%rdi), %eax
167 define i32 @freeze_add_nsw(i32 %a0) nounwind {
168 ; X86-LABEL: freeze_add_nsw:
170 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
171 ; X86-NEXT: addl $2, %eax
174 ; X64-LABEL: freeze_add_nsw:
176 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
177 ; X64-NEXT: leal 2(%rdi), %eax
179 %x = add nsw i32 %a0, 1
185 define <4 x i32> @freeze_add_vec(<4 x i32> %a0) nounwind {
186 ; X86-LABEL: freeze_add_vec:
188 ; X86-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
191 ; X64-LABEL: freeze_add_vec:
193 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [5,5,5,5]
194 ; X64-NEXT: vpaddd %xmm1, %xmm0, %xmm0
196 %x = add <4 x i32> %a0, <i32 1, i32 2, i32 3, i32 4>
197 %y = freeze <4 x i32> %x
198 %z = add <4 x i32> %y, <i32 4, i32 3, i32 2, i32 1>
202 define <4 x i32> @freeze_add_vec_undef(<4 x i32> %a0) nounwind {
203 ; X86-LABEL: freeze_add_vec_undef:
205 ; X86-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
206 ; X86-NEXT: paddd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
209 ; X64-LABEL: freeze_add_vec_undef:
211 ; X64-NEXT: vpaddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
212 ; X64-NEXT: vpaddd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
214 %x = add <4 x i32> %a0, <i32 1, i32 2, i32 3, i32 undef>
215 %y = freeze <4 x i32> %x
216 %z = add <4 x i32> %y, <i32 4, i32 3, i32 2, i32 undef>
220 define i32 @freeze_sub(i32 %a0) nounwind {
221 ; X86-LABEL: freeze_sub:
223 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
224 ; X86-NEXT: addl $-2, %eax
227 ; X64-LABEL: freeze_sub:
229 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
230 ; X64-NEXT: leal -2(%rdi), %eax
238 define i32 @freeze_sub_nuw(i32 %a0) nounwind {
239 ; X86-LABEL: freeze_sub_nuw:
241 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
242 ; X86-NEXT: addl $-2, %eax
245 ; X64-LABEL: freeze_sub_nuw:
247 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
248 ; X64-NEXT: leal -2(%rdi), %eax
250 %x = sub nuw i32 %a0, 1
256 define <4 x i32> @freeze_sub_vec(<4 x i32> %a0) nounwind {
257 ; X86-LABEL: freeze_sub_vec:
259 ; X86-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
262 ; X64-LABEL: freeze_sub_vec:
264 ; X64-NEXT: vpbroadcastd {{.*#+}} xmm1 = [5,5,5,5]
265 ; X64-NEXT: vpsubd %xmm1, %xmm0, %xmm0
267 %x = sub <4 x i32> %a0, <i32 1, i32 2, i32 3, i32 4>
268 %y = freeze <4 x i32> %x
269 %z = sub <4 x i32> %y, <i32 4, i32 3, i32 2, i32 1>
273 define <4 x i32> @freeze_sub_vec_undef(<4 x i32> %a0) nounwind {
274 ; X86-LABEL: freeze_sub_vec_undef:
276 ; X86-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
277 ; X86-NEXT: psubd {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
280 ; X64-LABEL: freeze_sub_vec_undef:
282 ; X64-NEXT: vpsubd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
283 ; X64-NEXT: vpsubd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
285 %x = sub <4 x i32> %a0, <i32 1, i32 2, i32 3, i32 undef>
286 %y = freeze <4 x i32> %x
287 %z = sub <4 x i32> %y, <i32 4, i32 3, i32 2, i32 undef>
291 define i32 @freeze_mul(i32 %a0) nounwind {
292 ; X86-LABEL: freeze_mul:
294 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
295 ; X86-NEXT: shll $2, %eax
298 ; X64-LABEL: freeze_mul:
300 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
301 ; X64-NEXT: leal (,%rdi,4), %eax
309 define i32 @freeze_mul_nsw(i32 %a0) nounwind {
310 ; X86-LABEL: freeze_mul_nsw:
312 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
313 ; X86-NEXT: leal (%eax,%eax,4), %eax
314 ; X86-NEXT: leal (%eax,%eax,2), %eax
317 ; X64-LABEL: freeze_mul_nsw:
319 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
320 ; X64-NEXT: leal (%rdi,%rdi,4), %eax
321 ; X64-NEXT: leal (%rax,%rax,2), %eax
323 %x = mul nsw i32 %a0, 3
329 define <8 x i16> @freeze_mul_vec(<8 x i16> %a0) nounwind {
330 ; X86-LABEL: freeze_mul_vec:
332 ; X86-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
335 ; X64-LABEL: freeze_mul_vec:
337 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
339 %x = mul <8 x i16> %a0, <i16 1, i16 2, i16 3, i16 4, i16 4, i16 3, i16 2, i16 1>
340 %y = freeze <8 x i16> %x
341 %z = mul <8 x i16> %y, <i16 4, i16 3, i16 2, i16 1, i16 1, i16 2, i16 3, i16 4>
345 define <8 x i16> @freeze_mul_vec_undef(<8 x i16> %a0) nounwind {
346 ; X86-LABEL: freeze_mul_vec_undef:
348 ; X86-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
349 ; X86-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0
352 ; X64-LABEL: freeze_mul_vec_undef:
354 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
355 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
357 %x = mul <8 x i16> %a0, <i16 1, i16 2, i16 3, i16 4, i16 4, i16 3, i16 undef, i16 1>
358 %y = freeze <8 x i16> %x
359 %z = mul <8 x i16> %y, <i16 4, i16 3, i16 2, i16 1, i16 1, i16 2, i16 undef, i16 4>
363 define i32 @freeze_shl(i32 %a0) nounwind {
364 ; X86-LABEL: freeze_shl:
366 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
367 ; X86-NEXT: shll $3, %eax
370 ; X64-LABEL: freeze_shl:
372 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
373 ; X64-NEXT: leal (,%rdi,8), %eax
381 define i32 @freeze_shl_nsw(i32 %a0) nounwind {
382 ; X86-LABEL: freeze_shl_nsw:
384 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
385 ; X86-NEXT: shll $8, %eax
388 ; X64-LABEL: freeze_shl_nsw:
390 ; X64-NEXT: movl %edi, %eax
391 ; X64-NEXT: shll $8, %eax
393 %x = shl nsw i32 %a0, 3
399 define i32 @freeze_shl_outofrange(i32 %a0) nounwind {
400 ; X86-LABEL: freeze_shl_outofrange:
402 ; X86-NEXT: shll $2, %eax
405 ; X64-LABEL: freeze_shl_outofrange:
407 ; X64-NEXT: shll $2, %eax
415 define <2 x i64> @freeze_shl_vec(<2 x i64> %a0) nounwind {
416 ; X86-LABEL: freeze_shl_vec:
418 ; X86-NEXT: movdqa %xmm0, %xmm1
419 ; X86-NEXT: psllq $4, %xmm1
420 ; X86-NEXT: psllq $2, %xmm0
421 ; X86-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
424 ; X64-LABEL: freeze_shl_vec:
426 ; X64-NEXT: vpsllvq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
428 %x = shl <2 x i64> %a0, <i64 2, i64 1>
429 %y = freeze <2 x i64> %x
430 %z = shl <2 x i64> %y, <i64 2, i64 1>
434 define <2 x i64> @freeze_shl_vec_outofrange(<2 x i64> %a0) nounwind {
435 ; X86-LABEL: freeze_shl_vec_outofrange:
437 ; X86-NEXT: psllq $3, %xmm0
440 ; X64-LABEL: freeze_shl_vec_outofrange:
442 ; X64-NEXT: vpsllvq {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
443 ; X64-NEXT: vpsllq $2, %xmm0, %xmm0
445 %x = shl <2 x i64> %a0, <i64 1, i64 64>
446 %y = freeze <2 x i64> %x
447 %z = shl <2 x i64> %y, <i64 2, i64 2>
451 define i32 @freeze_ashr(i32 %a0) nounwind {
452 ; X86-LABEL: freeze_ashr:
454 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
455 ; X86-NEXT: sarl $3, %eax
456 ; X86-NEXT: sarl $3, %eax
459 ; X64-LABEL: freeze_ashr:
461 ; X64-NEXT: movl %edi, %eax
462 ; X64-NEXT: sarl $3, %eax
463 ; X64-NEXT: sarl $3, %eax
471 define i32 @freeze_ashr_exact(i32 %a0) nounwind {
472 ; X86-LABEL: freeze_ashr_exact:
474 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
475 ; X86-NEXT: sarl $3, %eax
476 ; X86-NEXT: sarl $6, %eax
479 ; X64-LABEL: freeze_ashr_exact:
481 ; X64-NEXT: movl %edi, %eax
482 ; X64-NEXT: sarl $3, %eax
483 ; X64-NEXT: sarl $6, %eax
485 %x = ashr exact i32 %a0, 3
491 define i32 @freeze_ashr_outofrange(i32 %a0) nounwind {
492 ; X86-LABEL: freeze_ashr_outofrange:
494 ; X86-NEXT: sarl $3, %eax
497 ; X64-LABEL: freeze_ashr_outofrange:
499 ; X64-NEXT: sarl $3, %eax
501 %x = ashr i32 %a0, 32
507 define <8 x i16> @freeze_ashr_vec(<8 x i16> %a0) nounwind {
508 ; X86-LABEL: freeze_ashr_vec:
510 ; X86-NEXT: movdqa %xmm0, %xmm2
511 ; X86-NEXT: psraw $1, %xmm2
512 ; X86-NEXT: movdqa {{.*#+}} xmm1 = [65535,0,65535,0,65535,0,65535,0]
513 ; X86-NEXT: movdqa %xmm1, %xmm3
514 ; X86-NEXT: pandn %xmm2, %xmm3
515 ; X86-NEXT: psraw $3, %xmm0
516 ; X86-NEXT: pand %xmm1, %xmm0
517 ; X86-NEXT: por %xmm3, %xmm0
518 ; X86-NEXT: movdqa %xmm0, %xmm2
519 ; X86-NEXT: psraw $3, %xmm2
520 ; X86-NEXT: psraw $1, %xmm0
521 ; X86-NEXT: pand %xmm1, %xmm0
522 ; X86-NEXT: pandn %xmm2, %xmm1
523 ; X86-NEXT: por %xmm1, %xmm0
526 ; X64-LABEL: freeze_ashr_vec:
528 ; X64-NEXT: vpsraw $1, %xmm0, %xmm1
529 ; X64-NEXT: vpsraw $3, %xmm0, %xmm0
530 ; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6],xmm1[7]
531 ; X64-NEXT: vpsraw $3, %xmm0, %xmm1
532 ; X64-NEXT: vpsraw $1, %xmm0, %xmm0
533 ; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6],xmm1[7]
535 %x = ashr <8 x i16> %a0, <i16 3, i16 1, i16 3, i16 1, i16 3, i16 1, i16 3, i16 1>
536 %y = freeze <8 x i16> %x
537 %z = ashr <8 x i16> %y, <i16 1, i16 3, i16 1, i16 3, i16 1, i16 3, i16 1, i16 3>
541 define <4 x i32> @freeze_ashr_vec_outofrange(<4 x i32> %a0) nounwind {
542 ; X86-LABEL: freeze_ashr_vec_outofrange:
544 ; X86-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,3,2,3]
545 ; X86-NEXT: psrad $1, %xmm0
546 ; X86-NEXT: psrad $2, %xmm0
549 ; X64-LABEL: freeze_ashr_vec_outofrange:
551 ; X64-NEXT: vpsravd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
552 ; X64-NEXT: vpsrad $2, %xmm0, %xmm0
554 %x = ashr <4 x i32> %a0, <i32 1, i32 33, i32 1, i32 1>
555 %y = freeze <4 x i32> %x
556 %z = ashr <4 x i32> %y, <i32 2, i32 2, i32 2, i32 2>
560 define i32 @freeze_lshr(i32 %a0) nounwind {
561 ; X86-LABEL: freeze_lshr:
563 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
564 ; X86-NEXT: shrl $2, %eax
565 ; X86-NEXT: shrl %eax
568 ; X64-LABEL: freeze_lshr:
570 ; X64-NEXT: movl %edi, %eax
571 ; X64-NEXT: shrl $2, %eax
572 ; X64-NEXT: shrl %eax
580 define i32 @freeze_lshr_exact(i32 %a0) nounwind {
581 ; X86-LABEL: freeze_lshr_exact:
583 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
584 ; X86-NEXT: shrl $3, %eax
585 ; X86-NEXT: shrl $5, %eax
588 ; X64-LABEL: freeze_lshr_exact:
590 ; X64-NEXT: movl %edi, %eax
591 ; X64-NEXT: shrl $3, %eax
592 ; X64-NEXT: shrl $5, %eax
594 %x = lshr exact i32 %a0, 3
600 define i32 @freeze_lshr_outofrange(i32 %a0) nounwind {
601 ; X86-LABEL: freeze_lshr_outofrange:
603 ; X86-NEXT: shrl %eax
606 ; X64-LABEL: freeze_lshr_outofrange:
608 ; X64-NEXT: shrl %eax
610 %x = lshr i32 %a0, 32
616 define <8 x i16> @freeze_lshr_vec(<8 x i16> %a0) nounwind {
617 ; X86-LABEL: freeze_lshr_vec:
619 ; X86-NEXT: movdqa %xmm0, %xmm2
620 ; X86-NEXT: psrlw $1, %xmm2
621 ; X86-NEXT: movdqa {{.*#+}} xmm1 = [65535,0,65535,0,65535,0,65535,0]
622 ; X86-NEXT: movdqa %xmm1, %xmm3
623 ; X86-NEXT: pandn %xmm2, %xmm3
624 ; X86-NEXT: psrlw $2, %xmm0
625 ; X86-NEXT: pand %xmm1, %xmm0
626 ; X86-NEXT: por %xmm3, %xmm0
627 ; X86-NEXT: movdqa %xmm0, %xmm2
628 ; X86-NEXT: psrlw $2, %xmm2
629 ; X86-NEXT: psrlw $1, %xmm0
630 ; X86-NEXT: pand %xmm1, %xmm0
631 ; X86-NEXT: pandn %xmm2, %xmm1
632 ; X86-NEXT: por %xmm1, %xmm0
635 ; X64-LABEL: freeze_lshr_vec:
637 ; X64-NEXT: vpsrlw $1, %xmm0, %xmm1
638 ; X64-NEXT: vpsrlw $2, %xmm0, %xmm0
639 ; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6],xmm1[7]
640 ; X64-NEXT: vpsrlw $2, %xmm0, %xmm1
641 ; X64-NEXT: vpsrlw $1, %xmm0, %xmm0
642 ; X64-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3],xmm0[4],xmm1[5],xmm0[6],xmm1[7]
644 %x = lshr <8 x i16> %a0, <i16 2, i16 1, i16 2, i16 1, i16 2, i16 1, i16 2, i16 1>
645 %y = freeze <8 x i16> %x
646 %z = lshr <8 x i16> %y, <i16 1, i16 2, i16 1, i16 2, i16 1, i16 2, i16 1, i16 2>
650 define <4 x i32> @freeze_lshr_vec_outofrange(<4 x i32> %a0) nounwind {
651 ; X86-LABEL: freeze_lshr_vec_outofrange:
653 ; X86-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,3,2,3]
654 ; X86-NEXT: psrld $1, %xmm0
655 ; X86-NEXT: psrld $2, %xmm0
658 ; X64-LABEL: freeze_lshr_vec_outofrange:
660 ; X64-NEXT: vpsrlvd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
661 ; X64-NEXT: vpsrld $2, %xmm0, %xmm0
663 %x = lshr <4 x i32> %a0, <i32 1, i32 33, i32 1, i32 1>
664 %y = freeze <4 x i32> %x
665 %z = lshr <4 x i32> %y, <i32 2, i32 2, i32 2, i32 2>
669 define i32 @freeze_rotl(i32 %a0) nounwind {
670 ; X86-LABEL: freeze_rotl:
672 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
673 ; X86-NEXT: roll $10, %eax
676 ; X64-LABEL: freeze_rotl:
678 ; X64-NEXT: movl %edi, %eax
679 ; X64-NEXT: roll $10, %eax
681 %x = call i32 @llvm.fshl.i32(i32 %a0, i32 %a0, i32 5)
683 %z = call i32 @llvm.fshl.i32(i32 %y, i32 %y, i32 5)
686 declare i32 @llvm.fshl.i32(i32, i32, i32)
688 define <4 x i32> @freeze_rotl_vec(<4 x i32> %a0) nounwind {
689 ; X86-LABEL: freeze_rotl_vec:
691 ; X86-NEXT: movdqa %xmm0, %xmm1
692 ; X86-NEXT: psrld $2, %xmm1
693 ; X86-NEXT: pslld $30, %xmm0
694 ; X86-NEXT: por %xmm1, %xmm0
697 ; X64-LABEL: freeze_rotl_vec:
699 ; X64-NEXT: vpsrld $2, %xmm0, %xmm1
700 ; X64-NEXT: vpslld $30, %xmm0, %xmm0
701 ; X64-NEXT: vpor %xmm1, %xmm0, %xmm0
703 %x = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %a0, <4 x i32> %a0, <4 x i32> <i32 0, i32 1, i32 2, i32 3>)
704 %y = freeze <4 x i32> %x
705 %z = call <4 x i32> @llvm.fshl.v4i32(<4 x i32> %y, <4 x i32> %y, <4 x i32> <i32 30, i32 29, i32 28, i32 27>)
708 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
710 define i32 @freeze_rotr(i32 %a0) nounwind {
711 ; X86-LABEL: freeze_rotr:
713 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
714 ; X86-NEXT: rorl $24, %eax
717 ; X64-LABEL: freeze_rotr:
719 ; X64-NEXT: movl %edi, %eax
720 ; X64-NEXT: rorl $24, %eax
722 %x = call i32 @llvm.fshr.i32(i32 %a0, i32 %a0, i32 11)
724 %z = call i32 @llvm.fshr.i32(i32 %y, i32 %y, i32 13)
727 declare i32 @llvm.fshr.i32(i32, i32, i32)
729 define <4 x i32> @freeze_rotr_vec(<4 x i32> %a0) nounwind {
730 ; X86-LABEL: freeze_rotr_vec:
732 ; X86-NEXT: movdqa %xmm0, %xmm1
733 ; X86-NEXT: psrld $31, %xmm1
734 ; X86-NEXT: paddd %xmm0, %xmm0
735 ; X86-NEXT: por %xmm1, %xmm0
738 ; X64-LABEL: freeze_rotr_vec:
740 ; X64-NEXT: vpsrld $31, %xmm0, %xmm1
741 ; X64-NEXT: vpaddd %xmm0, %xmm0, %xmm0
742 ; X64-NEXT: vpor %xmm1, %xmm0, %xmm0
744 %x = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %a0, <4 x i32> %a0, <4 x i32> <i32 0, i32 1, i32 2, i32 3>)
745 %y = freeze <4 x i32> %x
746 %z = call <4 x i32> @llvm.fshr.v4i32(<4 x i32> %y, <4 x i32> %y, <4 x i32> <i32 31, i32 30, i32 29, i32 28>)
749 declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
751 define i32 @freeze_fshl(i32 %a0, i32 %a1, i32 %a2) nounwind {
752 ; X86-LABEL: freeze_fshl:
754 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
755 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
756 ; X86-NEXT: shrl $27, %eax
757 ; X86-NEXT: shldl $27, %ecx, %eax
760 ; X64-LABEL: freeze_fshl:
762 ; X64-NEXT: movl %esi, %eax
763 ; X64-NEXT: shrl $27, %eax
764 ; X64-NEXT: shldl $27, %edx, %eax
768 %x = call i32 @llvm.fshl.i32(i32 %a0, i32 %f1, i32 5)
770 %z = call i32 @llvm.fshl.i32(i32 %y, i32 %f2, i32 27)
774 define i32 @freeze_fshr(i32 %a0, i32 %a1, i32 %a2) nounwind {
775 ; X86-LABEL: freeze_fshr:
777 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
778 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
779 ; X86-NEXT: shrl %eax
780 ; X86-NEXT: shldl $1, %ecx, %eax
783 ; X64-LABEL: freeze_fshr:
785 ; X64-NEXT: movl %esi, %eax
786 ; X64-NEXT: shrl %eax
787 ; X64-NEXT: shldl $1, %edx, %eax
791 %x = call i32 @llvm.fshr.i32(i32 %a0, i32 %f1, i32 1)
793 %z = call i32 @llvm.fshr.i32(i32 %y, i32 %f2, i32 31)
797 define void @pr59676_frozen(ptr %dst, i32 %x.orig) {
798 ; X86-LABEL: pr59676_frozen:
800 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
801 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
802 ; X86-NEXT: imull %eax, %eax
803 ; X86-NEXT: imull $84, %eax, %eax
804 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
805 ; X86-NEXT: imull %edx
806 ; X86-NEXT: movl %edx, %eax
807 ; X86-NEXT: shrl $31, %eax
808 ; X86-NEXT: sarl $3, %edx
809 ; X86-NEXT: addl %eax, %edx
810 ; X86-NEXT: movl %edx, (%ecx)
813 ; X64-LABEL: pr59676_frozen:
815 ; X64-NEXT: imull %esi, %esi
816 ; X64-NEXT: imull $84, %esi, %eax
818 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
819 ; X64-NEXT: movq %rax, %rcx
820 ; X64-NEXT: shrq $63, %rcx
821 ; X64-NEXT: sarq $35, %rax
822 ; X64-NEXT: addl %ecx, %eax
823 ; X64-NEXT: movl %eax, (%rdi)
825 %x = freeze i32 %x.orig
826 %mul = mul i32 %x, 42
828 %mul.frozen = freeze i32 %mul
829 %shl.frozen = freeze i32 %shl
830 %area = mul i32 %mul.frozen, %shl.frozen
831 %div = sdiv i32 %area, 42
832 store i32 %div, ptr %dst, align 4
835 define void @pr59676_nsw_frozen(ptr %dst, i32 %x.orig) {
836 ; X86-LABEL: pr59676_nsw_frozen:
838 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
839 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
840 ; X86-NEXT: imull %eax, %eax
841 ; X86-NEXT: imull $84, %eax, %eax
842 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
843 ; X86-NEXT: imull %edx
844 ; X86-NEXT: movl %edx, %eax
845 ; X86-NEXT: shrl $31, %eax
846 ; X86-NEXT: sarl $3, %edx
847 ; X86-NEXT: addl %eax, %edx
848 ; X86-NEXT: movl %edx, (%ecx)
851 ; X64-LABEL: pr59676_nsw_frozen:
853 ; X64-NEXT: imull %esi, %esi
854 ; X64-NEXT: imull $84, %esi, %eax
856 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
857 ; X64-NEXT: movq %rax, %rcx
858 ; X64-NEXT: shrq $63, %rcx
859 ; X64-NEXT: sarq $35, %rax
860 ; X64-NEXT: addl %ecx, %eax
861 ; X64-NEXT: movl %eax, (%rdi)
863 %x = freeze i32 %x.orig
864 %mul = mul nsw i32 %x, 42
866 %mul.frozen = freeze i32 %mul
867 %shl.frozen = freeze i32 %shl
868 %area = mul i32 %mul.frozen, %shl.frozen
869 %div = sdiv i32 %area, 42
870 store i32 %div, ptr %dst, align 4
873 define void @pr59676_nsw(ptr %dst, i32 %x) {
874 ; X86-LABEL: pr59676_nsw:
876 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
877 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
878 ; X86-NEXT: imull %eax, %eax
879 ; X86-NEXT: imull $84, %eax, %eax
880 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
881 ; X86-NEXT: imull %edx
882 ; X86-NEXT: movl %edx, %eax
883 ; X86-NEXT: shrl $31, %eax
884 ; X86-NEXT: sarl $3, %edx
885 ; X86-NEXT: addl %eax, %edx
886 ; X86-NEXT: movl %edx, (%ecx)
889 ; X64-LABEL: pr59676_nsw:
891 ; X64-NEXT: imull %esi, %esi
892 ; X64-NEXT: imull $84, %esi, %eax
894 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
895 ; X64-NEXT: movq %rax, %rcx
896 ; X64-NEXT: shrq $63, %rcx
897 ; X64-NEXT: sarq $35, %rax
898 ; X64-NEXT: addl %ecx, %eax
899 ; X64-NEXT: movl %eax, (%rdi)
901 %mul = mul nsw i32 %x, 42
903 %mul.frozen = freeze i32 %mul
904 %shl.frozen = freeze i32 %shl
905 %area = mul i32 %mul.frozen, %shl.frozen
906 %div = sdiv i32 %area, 42
907 store i32 %div, ptr %dst, align 4