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 # [4,6,6,4,4,6,6,4]
335 ; X64-LABEL: freeze_mul_vec:
337 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0 # [4,6,6,4,4,6,6,4]
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 # [1,2,3,4,4,3,0,1]
349 ; X86-NEXT: pmullw {{\.?LCPI[0-9]+_[0-9]+}}, %xmm0 # [4,3,2,1,1,2,u,4]
352 ; X64-LABEL: freeze_mul_vec_undef:
354 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0 # [1,2,3,4,4,3,0,1]
355 ; X64-NEXT: vpmullw {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0 # [4,3,2,1,1,2,u,4]
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 $6, %eax
470 define i32 @freeze_ashr_exact(i32 %a0) nounwind {
471 ; X86-LABEL: freeze_ashr_exact:
473 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
474 ; X86-NEXT: sarl $3, %eax
475 ; X86-NEXT: sarl $6, %eax
478 ; X64-LABEL: freeze_ashr_exact:
480 ; X64-NEXT: movl %edi, %eax
481 ; X64-NEXT: sarl $3, %eax
482 ; X64-NEXT: sarl $6, %eax
484 %x = ashr exact i32 %a0, 3
490 define i32 @freeze_ashr_exact_extra_use(i32 %a0, ptr %escape) nounwind {
491 ; X86-LABEL: freeze_ashr_exact_extra_use:
493 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
494 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
495 ; X86-NEXT: sarl $3, %eax
496 ; X86-NEXT: movl %eax, (%ecx)
497 ; X86-NEXT: sarl $6, %eax
500 ; X64-LABEL: freeze_ashr_exact_extra_use:
502 ; X64-NEXT: movl %edi, %eax
503 ; X64-NEXT: sarl $3, %eax
504 ; X64-NEXT: movl %eax, (%rsi)
505 ; X64-NEXT: sarl $6, %eax
507 %x = ashr exact i32 %a0, 3
510 store i32 %x, ptr %escape
514 define i32 @freeze_ashr_outofrange(i32 %a0) nounwind {
515 ; X86-LABEL: freeze_ashr_outofrange:
517 ; X86-NEXT: sarl $3, %eax
520 ; X64-LABEL: freeze_ashr_outofrange:
522 ; X64-NEXT: sarl $3, %eax
524 %x = ashr i32 %a0, 32
530 define <8 x i16> @freeze_ashr_vec(<8 x i16> %a0) nounwind {
531 ; X86-LABEL: freeze_ashr_vec:
533 ; X86-NEXT: psraw $4, %xmm0
536 ; X64-LABEL: freeze_ashr_vec:
538 ; X64-NEXT: vpsraw $4, %xmm0, %xmm0
540 %x = ashr <8 x i16> %a0, <i16 3, i16 1, i16 3, i16 1, i16 3, i16 1, i16 3, i16 1>
541 %y = freeze <8 x i16> %x
542 %z = ashr <8 x i16> %y, <i16 1, i16 3, i16 1, i16 3, i16 1, i16 3, i16 1, i16 3>
546 define <4 x i32> @freeze_ashr_vec_outofrange(<4 x i32> %a0) nounwind {
547 ; X86-LABEL: freeze_ashr_vec_outofrange:
549 ; X86-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,3,2,3]
550 ; X86-NEXT: psrad $3, %xmm0
553 ; X64-LABEL: freeze_ashr_vec_outofrange:
555 ; X64-NEXT: vpsravd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
556 ; X64-NEXT: vpsrad $2, %xmm0, %xmm0
558 %x = ashr <4 x i32> %a0, <i32 1, i32 33, i32 1, i32 1>
559 %y = freeze <4 x i32> %x
560 %z = ashr <4 x i32> %y, <i32 2, i32 2, i32 2, i32 2>
564 define i32 @freeze_lshr(i32 %a0) nounwind {
565 ; X86-LABEL: freeze_lshr:
567 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
568 ; X86-NEXT: shrl $2, %eax
569 ; X86-NEXT: shrl %eax
572 ; X64-LABEL: freeze_lshr:
574 ; X64-NEXT: movl %edi, %eax
575 ; X64-NEXT: shrl $3, %eax
583 define i32 @freeze_lshr_exact(i32 %a0) nounwind {
584 ; X86-LABEL: freeze_lshr_exact:
586 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
587 ; X86-NEXT: shrl $3, %eax
588 ; X86-NEXT: shrl $5, %eax
591 ; X64-LABEL: freeze_lshr_exact:
593 ; X64-NEXT: movl %edi, %eax
594 ; X64-NEXT: shrl $3, %eax
595 ; X64-NEXT: shrl $5, %eax
597 %x = lshr exact i32 %a0, 3
603 define i32 @freeze_lshr_exact_extra_use(i32 %a0, ptr %escape) nounwind {
604 ; X86-LABEL: freeze_lshr_exact_extra_use:
606 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
607 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
608 ; X86-NEXT: shrl $3, %eax
609 ; X86-NEXT: movl %eax, (%ecx)
610 ; X86-NEXT: shrl $5, %eax
613 ; X64-LABEL: freeze_lshr_exact_extra_use:
615 ; X64-NEXT: movl %edi, %eax
616 ; X64-NEXT: shrl $3, %eax
617 ; X64-NEXT: movl %eax, (%rsi)
618 ; X64-NEXT: shrl $5, %eax
620 %x = lshr exact i32 %a0, 3
623 store i32 %x, ptr %escape
627 define i32 @freeze_lshr_outofrange(i32 %a0) nounwind {
628 ; X86-LABEL: freeze_lshr_outofrange:
630 ; X86-NEXT: shrl %eax
633 ; X64-LABEL: freeze_lshr_outofrange:
635 ; X64-NEXT: shrl %eax
637 %x = lshr i32 %a0, 32
643 define <8 x i16> @freeze_lshr_vec(<8 x i16> %a0) nounwind {
644 ; X86-LABEL: freeze_lshr_vec:
646 ; X86-NEXT: psrlw $3, %xmm0
649 ; X64-LABEL: freeze_lshr_vec:
651 ; X64-NEXT: vpsrlw $3, %xmm0, %xmm0
653 %x = lshr <8 x i16> %a0, <i16 2, i16 1, i16 2, i16 1, i16 2, i16 1, i16 2, i16 1>
654 %y = freeze <8 x i16> %x
655 %z = lshr <8 x i16> %y, <i16 1, i16 2, i16 1, i16 2, i16 1, i16 2, i16 1, i16 2>
659 define <4 x i32> @freeze_lshr_vec_outofrange(<4 x i32> %a0) nounwind {
660 ; X86-LABEL: freeze_lshr_vec_outofrange:
662 ; X86-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,3,2,3]
663 ; X86-NEXT: psrld $3, %xmm0
666 ; X64-LABEL: freeze_lshr_vec_outofrange:
668 ; X64-NEXT: vpsrlvd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0, %xmm0
669 ; X64-NEXT: vpsrld $2, %xmm0, %xmm0
671 %x = lshr <4 x i32> %a0, <i32 1, i32 33, i32 1, i32 1>
672 %y = freeze <4 x i32> %x
673 %z = lshr <4 x i32> %y, <i32 2, i32 2, i32 2, i32 2>
677 define i32 @freeze_rotl(i32 %a0) nounwind {
678 ; X86-LABEL: freeze_rotl:
680 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
681 ; X86-NEXT: roll $10, %eax
684 ; X64-LABEL: freeze_rotl:
686 ; X64-NEXT: movl %edi, %eax
687 ; X64-NEXT: roll $10, %eax
689 %x = call i32 @llvm.fshl.i32(i32 %a0, i32 %a0, i32 5)
691 %z = call i32 @llvm.fshl.i32(i32 %y, i32 %y, i32 5)
694 declare i32 @llvm.fshl.i32(i32, i32, i32)
696 define <4 x i32> @freeze_rotl_vec(<4 x i32> %a0) nounwind {
697 ; X86-LABEL: freeze_rotl_vec:
699 ; X86-NEXT: movdqa %xmm0, %xmm1
700 ; X86-NEXT: psrld $2, %xmm1
701 ; X86-NEXT: pslld $30, %xmm0
702 ; X86-NEXT: por %xmm1, %xmm0
705 ; X64-LABEL: freeze_rotl_vec:
707 ; X64-NEXT: vpsrld $2, %xmm0, %xmm1
708 ; X64-NEXT: vpslld $30, %xmm0, %xmm0
709 ; X64-NEXT: vpor %xmm1, %xmm0, %xmm0
711 %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>)
712 %y = freeze <4 x i32> %x
713 %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>)
716 declare <4 x i32> @llvm.fshl.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
718 define i32 @freeze_rotr(i32 %a0) nounwind {
719 ; X86-LABEL: freeze_rotr:
721 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
722 ; X86-NEXT: rorl $24, %eax
725 ; X64-LABEL: freeze_rotr:
727 ; X64-NEXT: movl %edi, %eax
728 ; X64-NEXT: rorl $24, %eax
730 %x = call i32 @llvm.fshr.i32(i32 %a0, i32 %a0, i32 11)
732 %z = call i32 @llvm.fshr.i32(i32 %y, i32 %y, i32 13)
735 declare i32 @llvm.fshr.i32(i32, i32, i32)
737 define <4 x i32> @freeze_rotr_vec(<4 x i32> %a0) nounwind {
738 ; X86-LABEL: freeze_rotr_vec:
740 ; X86-NEXT: movdqa %xmm0, %xmm1
741 ; X86-NEXT: psrld $31, %xmm1
742 ; X86-NEXT: paddd %xmm0, %xmm0
743 ; X86-NEXT: por %xmm1, %xmm0
746 ; X64-LABEL: freeze_rotr_vec:
748 ; X64-NEXT: vpsrld $31, %xmm0, %xmm1
749 ; X64-NEXT: vpaddd %xmm0, %xmm0, %xmm0
750 ; X64-NEXT: vpor %xmm1, %xmm0, %xmm0
752 %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>)
753 %y = freeze <4 x i32> %x
754 %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>)
757 declare <4 x i32> @llvm.fshr.v4i32(<4 x i32>, <4 x i32>, <4 x i32>)
759 define i32 @freeze_fshl(i32 %a0, i32 %a1, i32 %a2) nounwind {
760 ; X86-LABEL: freeze_fshl:
762 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
763 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
764 ; X86-NEXT: shrl $27, %eax
765 ; X86-NEXT: shldl $27, %ecx, %eax
768 ; X64-LABEL: freeze_fshl:
770 ; X64-NEXT: movl %esi, %eax
771 ; X64-NEXT: shrl $27, %eax
772 ; X64-NEXT: shldl $27, %edx, %eax
776 %x = call i32 @llvm.fshl.i32(i32 %a0, i32 %f1, i32 5)
778 %z = call i32 @llvm.fshl.i32(i32 %y, i32 %f2, i32 27)
782 define i32 @freeze_fshr(i32 %a0, i32 %a1, i32 %a2) nounwind {
783 ; X86-LABEL: freeze_fshr:
785 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
786 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
787 ; X86-NEXT: shrl %eax
788 ; X86-NEXT: shldl $1, %ecx, %eax
791 ; X64-LABEL: freeze_fshr:
793 ; X64-NEXT: movl %esi, %eax
794 ; X64-NEXT: shrl %eax
795 ; X64-NEXT: shldl $1, %edx, %eax
799 %x = call i32 @llvm.fshr.i32(i32 %a0, i32 %f1, i32 1)
801 %z = call i32 @llvm.fshr.i32(i32 %y, i32 %f2, i32 31)
805 define void @pr59676_frozen(ptr %dst, i32 %x.orig) {
806 ; X86-LABEL: pr59676_frozen:
808 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
809 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
810 ; X86-NEXT: imull %eax, %eax
811 ; X86-NEXT: imull $84, %eax, %eax
812 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
813 ; X86-NEXT: imull %edx
814 ; X86-NEXT: movl %edx, %eax
815 ; X86-NEXT: shrl $31, %eax
816 ; X86-NEXT: sarl $3, %edx
817 ; X86-NEXT: addl %eax, %edx
818 ; X86-NEXT: movl %edx, (%ecx)
821 ; X64-LABEL: pr59676_frozen:
823 ; X64-NEXT: imull %esi, %esi
824 ; X64-NEXT: imull $84, %esi, %eax
826 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
827 ; X64-NEXT: movq %rax, %rcx
828 ; X64-NEXT: shrq $63, %rcx
829 ; X64-NEXT: sarq $35, %rax
830 ; X64-NEXT: addl %ecx, %eax
831 ; X64-NEXT: movl %eax, (%rdi)
833 %x = freeze i32 %x.orig
834 %mul = mul i32 %x, 42
836 %mul.frozen = freeze i32 %mul
837 %shl.frozen = freeze i32 %shl
838 %area = mul i32 %mul.frozen, %shl.frozen
839 %div = sdiv i32 %area, 42
840 store i32 %div, ptr %dst, align 4
843 define void @pr59676_nsw_frozen(ptr %dst, i32 %x.orig) {
844 ; X86-LABEL: pr59676_nsw_frozen:
846 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
847 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
848 ; X86-NEXT: imull %eax, %eax
849 ; X86-NEXT: imull $84, %eax, %eax
850 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
851 ; X86-NEXT: imull %edx
852 ; X86-NEXT: movl %edx, %eax
853 ; X86-NEXT: shrl $31, %eax
854 ; X86-NEXT: sarl $3, %edx
855 ; X86-NEXT: addl %eax, %edx
856 ; X86-NEXT: movl %edx, (%ecx)
859 ; X64-LABEL: pr59676_nsw_frozen:
861 ; X64-NEXT: imull %esi, %esi
862 ; X64-NEXT: imull $84, %esi, %eax
864 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
865 ; X64-NEXT: movq %rax, %rcx
866 ; X64-NEXT: shrq $63, %rcx
867 ; X64-NEXT: sarq $35, %rax
868 ; X64-NEXT: addl %ecx, %eax
869 ; X64-NEXT: movl %eax, (%rdi)
871 %x = freeze i32 %x.orig
872 %mul = mul nsw i32 %x, 42
874 %mul.frozen = freeze i32 %mul
875 %shl.frozen = freeze i32 %shl
876 %area = mul i32 %mul.frozen, %shl.frozen
877 %div = sdiv i32 %area, 42
878 store i32 %div, ptr %dst, align 4
881 define void @pr59676_nsw(ptr %dst, i32 %x) {
882 ; X86-LABEL: pr59676_nsw:
884 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
885 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
886 ; X86-NEXT: imull %eax, %eax
887 ; X86-NEXT: imull $84, %eax, %eax
888 ; X86-NEXT: movl $818089009, %edx # imm = 0x30C30C31
889 ; X86-NEXT: imull %edx
890 ; X86-NEXT: movl %edx, %eax
891 ; X86-NEXT: shrl $31, %eax
892 ; X86-NEXT: sarl $3, %edx
893 ; X86-NEXT: addl %eax, %edx
894 ; X86-NEXT: movl %edx, (%ecx)
897 ; X64-LABEL: pr59676_nsw:
899 ; X64-NEXT: imull %esi, %esi
900 ; X64-NEXT: imull $84, %esi, %eax
902 ; X64-NEXT: imulq $818089009, %rax, %rax # imm = 0x30C30C31
903 ; X64-NEXT: movq %rax, %rcx
904 ; X64-NEXT: shrq $63, %rcx
905 ; X64-NEXT: sarq $35, %rax
906 ; X64-NEXT: addl %ecx, %eax
907 ; X64-NEXT: movl %eax, (%rdi)
909 %mul = mul nsw i32 %x, 42
911 %mul.frozen = freeze i32 %mul
912 %shl.frozen = freeze i32 %shl
913 %area = mul i32 %mul.frozen, %shl.frozen
914 %div = sdiv i32 %area, 42
915 store i32 %div, ptr %dst, align 4