1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefixes=ALL,X32
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=ALL,X64
5 ; The mask is all-ones, potentially shifted.
7 ;------------------------------------------------------------------------------;
9 ;------------------------------------------------------------------------------;
13 define i8 @test_i8_7_mask_lshr_1(i8 %a0) {
14 ; X32-LABEL: test_i8_7_mask_lshr_1:
16 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
17 ; X32-NEXT: andb $6, %al
21 ; X64-LABEL: test_i8_7_mask_lshr_1:
23 ; X64-NEXT: movl %edi, %eax
24 ; X64-NEXT: andb $6, %al
26 ; X64-NEXT: # kill: def $al killed $al killed $eax
33 define i8 @test_i8_28_mask_lshr_1(i8 %a0) {
34 ; X32-LABEL: test_i8_28_mask_lshr_1:
36 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
37 ; X32-NEXT: andb $28, %al
41 ; X64-LABEL: test_i8_28_mask_lshr_1:
43 ; X64-NEXT: movl %edi, %eax
44 ; X64-NEXT: andb $28, %al
46 ; X64-NEXT: # kill: def $al killed $al killed $eax
52 define i8 @test_i8_28_mask_lshr_2(i8 %a0) {
53 ; X32-LABEL: test_i8_28_mask_lshr_2:
55 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
56 ; X32-NEXT: andb $28, %al
57 ; X32-NEXT: shrb $2, %al
60 ; X64-LABEL: test_i8_28_mask_lshr_2:
62 ; X64-NEXT: movl %edi, %eax
63 ; X64-NEXT: andb $28, %al
64 ; X64-NEXT: shrb $2, %al
65 ; X64-NEXT: # kill: def $al killed $al killed $eax
71 define i8 @test_i8_28_mask_lshr_3(i8 %a0) {
72 ; X32-LABEL: test_i8_28_mask_lshr_3:
74 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
75 ; X32-NEXT: andb $24, %al
76 ; X32-NEXT: shrb $3, %al
79 ; X64-LABEL: test_i8_28_mask_lshr_3:
81 ; X64-NEXT: movl %edi, %eax
82 ; X64-NEXT: andb $24, %al
83 ; X64-NEXT: shrb $3, %al
84 ; X64-NEXT: # kill: def $al killed $al killed $eax
90 define i8 @test_i8_28_mask_lshr_4(i8 %a0) {
91 ; X32-LABEL: test_i8_28_mask_lshr_4:
93 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
94 ; X32-NEXT: andb $16, %al
95 ; X32-NEXT: shrb $4, %al
98 ; X64-LABEL: test_i8_28_mask_lshr_4:
100 ; X64-NEXT: movl %edi, %eax
101 ; X64-NEXT: andb $16, %al
102 ; X64-NEXT: shrb $4, %al
103 ; X64-NEXT: # kill: def $al killed $al killed $eax
110 define i8 @test_i8_224_mask_lshr_1(i8 %a0) {
111 ; X32-LABEL: test_i8_224_mask_lshr_1:
113 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
114 ; X32-NEXT: andb $-32, %al
118 ; X64-LABEL: test_i8_224_mask_lshr_1:
120 ; X64-NEXT: movl %edi, %eax
121 ; X64-NEXT: andb $-32, %al
123 ; X64-NEXT: # kill: def $al killed $al killed $eax
125 %t0 = and i8 %a0, 224
129 define i8 @test_i8_224_mask_lshr_4(i8 %a0) {
130 ; X32-LABEL: test_i8_224_mask_lshr_4:
132 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
133 ; X32-NEXT: andb $-32, %al
134 ; X32-NEXT: shrb $4, %al
137 ; X64-LABEL: test_i8_224_mask_lshr_4:
139 ; X64-NEXT: movl %edi, %eax
140 ; X64-NEXT: andb $-32, %al
141 ; X64-NEXT: shrb $4, %al
142 ; X64-NEXT: # kill: def $al killed $al killed $eax
144 %t0 = and i8 %a0, 224
148 define i8 @test_i8_224_mask_lshr_5(i8 %a0) {
149 ; X32-LABEL: test_i8_224_mask_lshr_5:
151 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
152 ; X32-NEXT: shrb $5, %al
155 ; X64-LABEL: test_i8_224_mask_lshr_5:
157 ; X64-NEXT: movl %edi, %eax
158 ; X64-NEXT: shrb $5, %al
159 ; X64-NEXT: # kill: def $al killed $al killed $eax
161 %t0 = and i8 %a0, 224
165 define i8 @test_i8_224_mask_lshr_6(i8 %a0) {
166 ; X32-LABEL: test_i8_224_mask_lshr_6:
168 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
169 ; X32-NEXT: shrb $6, %al
172 ; X64-LABEL: test_i8_224_mask_lshr_6:
174 ; X64-NEXT: movl %edi, %eax
175 ; X64-NEXT: shrb $6, %al
176 ; X64-NEXT: # kill: def $al killed $al killed $eax
178 %t0 = and i8 %a0, 224
185 define i8 @test_i8_7_mask_ashr_1(i8 %a0) {
186 ; X32-LABEL: test_i8_7_mask_ashr_1:
188 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
189 ; X32-NEXT: andb $6, %al
193 ; X64-LABEL: test_i8_7_mask_ashr_1:
195 ; X64-NEXT: movl %edi, %eax
196 ; X64-NEXT: andb $6, %al
198 ; X64-NEXT: # kill: def $al killed $al killed $eax
205 define i8 @test_i8_28_mask_ashr_1(i8 %a0) {
206 ; X32-LABEL: test_i8_28_mask_ashr_1:
208 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
209 ; X32-NEXT: andb $28, %al
213 ; X64-LABEL: test_i8_28_mask_ashr_1:
215 ; X64-NEXT: movl %edi, %eax
216 ; X64-NEXT: andb $28, %al
218 ; X64-NEXT: # kill: def $al killed $al killed $eax
224 define i8 @test_i8_28_mask_ashr_2(i8 %a0) {
225 ; X32-LABEL: test_i8_28_mask_ashr_2:
227 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
228 ; X32-NEXT: andb $28, %al
229 ; X32-NEXT: shrb $2, %al
232 ; X64-LABEL: test_i8_28_mask_ashr_2:
234 ; X64-NEXT: movl %edi, %eax
235 ; X64-NEXT: andb $28, %al
236 ; X64-NEXT: shrb $2, %al
237 ; X64-NEXT: # kill: def $al killed $al killed $eax
243 define i8 @test_i8_28_mask_ashr_3(i8 %a0) {
244 ; X32-LABEL: test_i8_28_mask_ashr_3:
246 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
247 ; X32-NEXT: andb $24, %al
248 ; X32-NEXT: shrb $3, %al
251 ; X64-LABEL: test_i8_28_mask_ashr_3:
253 ; X64-NEXT: movl %edi, %eax
254 ; X64-NEXT: andb $24, %al
255 ; X64-NEXT: shrb $3, %al
256 ; X64-NEXT: # kill: def $al killed $al killed $eax
262 define i8 @test_i8_28_mask_ashr_4(i8 %a0) {
263 ; X32-LABEL: test_i8_28_mask_ashr_4:
265 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
266 ; X32-NEXT: andb $16, %al
267 ; X32-NEXT: shrb $4, %al
270 ; X64-LABEL: test_i8_28_mask_ashr_4:
272 ; X64-NEXT: movl %edi, %eax
273 ; X64-NEXT: andb $16, %al
274 ; X64-NEXT: shrb $4, %al
275 ; X64-NEXT: # kill: def $al killed $al killed $eax
282 define i8 @test_i8_224_mask_ashr_1(i8 %a0) {
283 ; X32-LABEL: test_i8_224_mask_ashr_1:
285 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
286 ; X32-NEXT: andb $-32, %al
290 ; X64-LABEL: test_i8_224_mask_ashr_1:
292 ; X64-NEXT: movl %edi, %eax
293 ; X64-NEXT: andb $-32, %al
295 ; X64-NEXT: # kill: def $al killed $al killed $eax
297 %t0 = and i8 %a0, 224
301 define i8 @test_i8_224_mask_ashr_4(i8 %a0) {
302 ; X32-LABEL: test_i8_224_mask_ashr_4:
304 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
305 ; X32-NEXT: andb $-32, %al
306 ; X32-NEXT: sarb $4, %al
309 ; X64-LABEL: test_i8_224_mask_ashr_4:
311 ; X64-NEXT: movl %edi, %eax
312 ; X64-NEXT: andb $-32, %al
313 ; X64-NEXT: sarb $4, %al
314 ; X64-NEXT: # kill: def $al killed $al killed $eax
316 %t0 = and i8 %a0, 224
320 define i8 @test_i8_224_mask_ashr_5(i8 %a0) {
321 ; X32-LABEL: test_i8_224_mask_ashr_5:
323 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
324 ; X32-NEXT: sarb $5, %al
327 ; X64-LABEL: test_i8_224_mask_ashr_5:
329 ; X64-NEXT: movl %edi, %eax
330 ; X64-NEXT: sarb $5, %al
331 ; X64-NEXT: # kill: def $al killed $al killed $eax
333 %t0 = and i8 %a0, 224
337 define i8 @test_i8_224_mask_ashr_6(i8 %a0) {
338 ; X32-LABEL: test_i8_224_mask_ashr_6:
340 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
341 ; X32-NEXT: sarb $6, %al
344 ; X64-LABEL: test_i8_224_mask_ashr_6:
346 ; X64-NEXT: movl %edi, %eax
347 ; X64-NEXT: sarb $6, %al
348 ; X64-NEXT: # kill: def $al killed $al killed $eax
350 %t0 = and i8 %a0, 224
357 define i8 @test_i8_7_mask_shl_1(i8 %a0) {
358 ; X32-LABEL: test_i8_7_mask_shl_1:
360 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
361 ; X32-NEXT: andb $7, %al
362 ; X32-NEXT: addb %al, %al
365 ; X64-LABEL: test_i8_7_mask_shl_1:
367 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
368 ; X64-NEXT: andb $7, %dil
369 ; X64-NEXT: leal (%rdi,%rdi), %eax
370 ; X64-NEXT: # kill: def $al killed $al killed $eax
376 define i8 @test_i8_7_mask_shl_4(i8 %a0) {
377 ; X32-LABEL: test_i8_7_mask_shl_4:
379 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
380 ; X32-NEXT: andb $7, %al
381 ; X32-NEXT: shlb $4, %al
384 ; X64-LABEL: test_i8_7_mask_shl_4:
386 ; X64-NEXT: movl %edi, %eax
387 ; X64-NEXT: andb $7, %al
388 ; X64-NEXT: shlb $4, %al
389 ; X64-NEXT: # kill: def $al killed $al killed $eax
395 define i8 @test_i8_7_mask_shl_5(i8 %a0) {
396 ; X32-LABEL: test_i8_7_mask_shl_5:
398 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
399 ; X32-NEXT: shlb $5, %al
402 ; X64-LABEL: test_i8_7_mask_shl_5:
404 ; X64-NEXT: movl %edi, %eax
405 ; X64-NEXT: shlb $5, %al
406 ; X64-NEXT: # kill: def $al killed $al killed $eax
412 define i8 @test_i8_7_mask_shl_6(i8 %a0) {
413 ; X32-LABEL: test_i8_7_mask_shl_6:
415 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
416 ; X32-NEXT: shlb $6, %al
419 ; X64-LABEL: test_i8_7_mask_shl_6:
421 ; X64-NEXT: movl %edi, %eax
422 ; X64-NEXT: shlb $6, %al
423 ; X64-NEXT: # kill: def $al killed $al killed $eax
430 define i8 @test_i8_28_mask_shl_1(i8 %a0) {
431 ; X32-LABEL: test_i8_28_mask_shl_1:
433 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
434 ; X32-NEXT: andb $28, %al
435 ; X32-NEXT: addb %al, %al
438 ; X64-LABEL: test_i8_28_mask_shl_1:
440 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
441 ; X64-NEXT: andb $28, %dil
442 ; X64-NEXT: leal (%rdi,%rdi), %eax
443 ; X64-NEXT: # kill: def $al killed $al killed $eax
449 define i8 @test_i8_28_mask_shl_2(i8 %a0) {
450 ; X32-LABEL: test_i8_28_mask_shl_2:
452 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
453 ; X32-NEXT: andb $28, %al
454 ; X32-NEXT: shlb $2, %al
457 ; X64-LABEL: test_i8_28_mask_shl_2:
459 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
460 ; X64-NEXT: andb $28, %dil
461 ; X64-NEXT: leal (,%rdi,4), %eax
462 ; X64-NEXT: # kill: def $al killed $al killed $eax
468 define i8 @test_i8_28_mask_shl_3(i8 %a0) {
469 ; X32-LABEL: test_i8_28_mask_shl_3:
471 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
472 ; X32-NEXT: andb $28, %al
473 ; X32-NEXT: shlb $3, %al
476 ; X64-LABEL: test_i8_28_mask_shl_3:
478 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
479 ; X64-NEXT: andb $28, %dil
480 ; X64-NEXT: leal (,%rdi,8), %eax
481 ; X64-NEXT: # kill: def $al killed $al killed $eax
487 define i8 @test_i8_28_mask_shl_4(i8 %a0) {
488 ; X32-LABEL: test_i8_28_mask_shl_4:
490 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
491 ; X32-NEXT: andb $12, %al
492 ; X32-NEXT: shlb $4, %al
495 ; X64-LABEL: test_i8_28_mask_shl_4:
497 ; X64-NEXT: movl %edi, %eax
498 ; X64-NEXT: andb $12, %al
499 ; X64-NEXT: shlb $4, %al
500 ; X64-NEXT: # kill: def $al killed $al killed $eax
507 define i8 @test_i8_224_mask_shl_1(i8 %a0) {
508 ; X32-LABEL: test_i8_224_mask_shl_1:
510 ; X32-NEXT: movb {{[0-9]+}}(%esp), %al
511 ; X32-NEXT: andb $96, %al
512 ; X32-NEXT: addb %al, %al
515 ; X64-LABEL: test_i8_224_mask_shl_1:
517 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
518 ; X64-NEXT: andb $96, %dil
519 ; X64-NEXT: leal (%rdi,%rdi), %eax
520 ; X64-NEXT: # kill: def $al killed $al killed $eax
522 %t0 = and i8 %a0, 224
527 ;------------------------------------------------------------------------------;
529 ;------------------------------------------------------------------------------;
533 define i16 @test_i16_127_mask_lshr_1(i16 %a0) {
534 ; X32-LABEL: test_i16_127_mask_lshr_1:
536 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
537 ; X32-NEXT: andl $126, %eax
538 ; X32-NEXT: shrl %eax
539 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
542 ; X64-LABEL: test_i16_127_mask_lshr_1:
544 ; X64-NEXT: movl %edi, %eax
545 ; X64-NEXT: andl $126, %eax
546 ; X64-NEXT: shrl %eax
547 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
549 %t0 = and i16 %a0, 127
550 %t1 = lshr i16 %t0, 1
554 define i16 @test_i16_2032_mask_lshr_3(i16 %a0) {
555 ; X32-LABEL: test_i16_2032_mask_lshr_3:
557 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
558 ; X32-NEXT: andl $2032, %eax # imm = 0x7F0
559 ; X32-NEXT: shrl $3, %eax
560 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
563 ; X64-LABEL: test_i16_2032_mask_lshr_3:
565 ; X64-NEXT: movl %edi, %eax
566 ; X64-NEXT: andl $2032, %eax # imm = 0x7F0
567 ; X64-NEXT: shrl $3, %eax
568 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
570 %t0 = and i16 %a0, 2032
571 %t1 = lshr i16 %t0, 3
574 define i16 @test_i16_2032_mask_lshr_4(i16 %a0) {
575 ; X32-LABEL: test_i16_2032_mask_lshr_4:
577 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
578 ; X32-NEXT: shrl $4, %eax
579 ; X32-NEXT: andl $127, %eax
580 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
583 ; X64-LABEL: test_i16_2032_mask_lshr_4:
585 ; X64-NEXT: movl %edi, %eax
586 ; X64-NEXT: shrl $4, %eax
587 ; X64-NEXT: andl $127, %eax
588 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
590 %t0 = and i16 %a0, 2032
591 %t1 = lshr i16 %t0, 4
594 define i16 @test_i16_2032_mask_lshr_5(i16 %a0) {
595 ; X32-LABEL: test_i16_2032_mask_lshr_5:
597 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
598 ; X32-NEXT: shrl $5, %eax
599 ; X32-NEXT: andl $63, %eax
600 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
603 ; X64-LABEL: test_i16_2032_mask_lshr_5:
605 ; X64-NEXT: movl %edi, %eax
606 ; X64-NEXT: shrl $5, %eax
607 ; X64-NEXT: andl $63, %eax
608 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
610 %t0 = and i16 %a0, 2032
611 %t1 = lshr i16 %t0, 5
614 define i16 @test_i16_2032_mask_lshr_6(i16 %a0) {
615 ; X32-LABEL: test_i16_2032_mask_lshr_6:
617 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
618 ; X32-NEXT: shrl $6, %eax
619 ; X32-NEXT: andl $31, %eax
620 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
623 ; X64-LABEL: test_i16_2032_mask_lshr_6:
625 ; X64-NEXT: movl %edi, %eax
626 ; X64-NEXT: shrl $6, %eax
627 ; X64-NEXT: andl $31, %eax
628 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
630 %t0 = and i16 %a0, 2032
631 %t1 = lshr i16 %t0, 6
635 define i16 @test_i16_65024_mask_lshr_1(i16 %a0) {
636 ; X32-LABEL: test_i16_65024_mask_lshr_1:
638 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
639 ; X32-NEXT: andl $65024, %eax # imm = 0xFE00
640 ; X32-NEXT: shrl %eax
641 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
644 ; X64-LABEL: test_i16_65024_mask_lshr_1:
646 ; X64-NEXT: movl %edi, %eax
647 ; X64-NEXT: andl $65024, %eax # imm = 0xFE00
648 ; X64-NEXT: shrl %eax
649 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
651 %t0 = and i16 %a0, 65024
652 %t1 = lshr i16 %t0, 1
655 define i16 @test_i16_65024_mask_lshr_8(i16 %a0) {
656 ; X32-LABEL: test_i16_65024_mask_lshr_8:
658 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
659 ; X32-NEXT: andl $65024, %eax # imm = 0xFE00
660 ; X32-NEXT: shrl $8, %eax
661 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
664 ; X64-LABEL: test_i16_65024_mask_lshr_8:
666 ; X64-NEXT: movl %edi, %eax
667 ; X64-NEXT: andl $65024, %eax # imm = 0xFE00
668 ; X64-NEXT: shrl $8, %eax
669 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
671 %t0 = and i16 %a0, 65024
672 %t1 = lshr i16 %t0, 8
675 define i16 @test_i16_65024_mask_lshr_9(i16 %a0) {
676 ; X32-LABEL: test_i16_65024_mask_lshr_9:
678 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
679 ; X32-NEXT: shrl $9, %eax
680 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
683 ; X64-LABEL: test_i16_65024_mask_lshr_9:
685 ; X64-NEXT: movzwl %di, %eax
686 ; X64-NEXT: shrl $9, %eax
687 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
689 %t0 = and i16 %a0, 65024
690 %t1 = lshr i16 %t0, 9
693 define i16 @test_i16_65024_mask_lshr_10(i16 %a0) {
694 ; X32-LABEL: test_i16_65024_mask_lshr_10:
696 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
697 ; X32-NEXT: shrl $10, %eax
698 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
701 ; X64-LABEL: test_i16_65024_mask_lshr_10:
703 ; X64-NEXT: movzwl %di, %eax
704 ; X64-NEXT: shrl $10, %eax
705 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
707 %t0 = and i16 %a0, 65024
708 %t1 = lshr i16 %t0, 10
714 define i16 @test_i16_127_mask_ashr_1(i16 %a0) {
715 ; X32-LABEL: test_i16_127_mask_ashr_1:
717 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
718 ; X32-NEXT: andl $126, %eax
719 ; X32-NEXT: shrl %eax
720 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
723 ; X64-LABEL: test_i16_127_mask_ashr_1:
725 ; X64-NEXT: movl %edi, %eax
726 ; X64-NEXT: andl $126, %eax
727 ; X64-NEXT: shrl %eax
728 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
730 %t0 = and i16 %a0, 127
731 %t1 = ashr i16 %t0, 1
735 define i16 @test_i16_2032_mask_ashr_3(i16 %a0) {
736 ; X32-LABEL: test_i16_2032_mask_ashr_3:
738 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
739 ; X32-NEXT: andl $2032, %eax # imm = 0x7F0
740 ; X32-NEXT: shrl $3, %eax
741 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
744 ; X64-LABEL: test_i16_2032_mask_ashr_3:
746 ; X64-NEXT: movl %edi, %eax
747 ; X64-NEXT: andl $2032, %eax # imm = 0x7F0
748 ; X64-NEXT: shrl $3, %eax
749 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
751 %t0 = and i16 %a0, 2032
752 %t1 = ashr i16 %t0, 3
755 define i16 @test_i16_2032_mask_ashr_4(i16 %a0) {
756 ; X32-LABEL: test_i16_2032_mask_ashr_4:
758 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
759 ; X32-NEXT: shrl $4, %eax
760 ; X32-NEXT: andl $127, %eax
761 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
764 ; X64-LABEL: test_i16_2032_mask_ashr_4:
766 ; X64-NEXT: movl %edi, %eax
767 ; X64-NEXT: shrl $4, %eax
768 ; X64-NEXT: andl $127, %eax
769 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
771 %t0 = and i16 %a0, 2032
772 %t1 = ashr i16 %t0, 4
775 define i16 @test_i16_2032_mask_ashr_5(i16 %a0) {
776 ; X32-LABEL: test_i16_2032_mask_ashr_5:
778 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
779 ; X32-NEXT: shrl $5, %eax
780 ; X32-NEXT: andl $63, %eax
781 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
784 ; X64-LABEL: test_i16_2032_mask_ashr_5:
786 ; X64-NEXT: movl %edi, %eax
787 ; X64-NEXT: shrl $5, %eax
788 ; X64-NEXT: andl $63, %eax
789 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
791 %t0 = and i16 %a0, 2032
792 %t1 = ashr i16 %t0, 5
795 define i16 @test_i16_2032_mask_ashr_6(i16 %a0) {
796 ; X32-LABEL: test_i16_2032_mask_ashr_6:
798 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
799 ; X32-NEXT: shrl $6, %eax
800 ; X32-NEXT: andl $31, %eax
801 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
804 ; X64-LABEL: test_i16_2032_mask_ashr_6:
806 ; X64-NEXT: movl %edi, %eax
807 ; X64-NEXT: shrl $6, %eax
808 ; X64-NEXT: andl $31, %eax
809 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
811 %t0 = and i16 %a0, 2032
812 %t1 = ashr i16 %t0, 6
816 define i16 @test_i16_65024_mask_ashr_1(i16 %a0) {
817 ; X32-LABEL: test_i16_65024_mask_ashr_1:
819 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
820 ; X32-NEXT: andl $65024, %eax # imm = 0xFE00
822 ; X32-NEXT: shrl %eax
823 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
826 ; X64-LABEL: test_i16_65024_mask_ashr_1:
828 ; X64-NEXT: andl $65024, %edi # imm = 0xFE00
829 ; X64-NEXT: movswl %di, %eax
830 ; X64-NEXT: shrl %eax
831 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
833 %t0 = and i16 %a0, 65024
834 %t1 = ashr i16 %t0, 1
837 define i16 @test_i16_65024_mask_ashr_8(i16 %a0) {
838 ; X32-LABEL: test_i16_65024_mask_ashr_8:
840 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
841 ; X32-NEXT: andl $65024, %eax # imm = 0xFE00
843 ; X32-NEXT: shrl $8, %eax
844 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
847 ; X64-LABEL: test_i16_65024_mask_ashr_8:
849 ; X64-NEXT: andl $65024, %edi # imm = 0xFE00
850 ; X64-NEXT: movswl %di, %eax
851 ; X64-NEXT: shrl $8, %eax
852 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
854 %t0 = and i16 %a0, 65024
855 %t1 = ashr i16 %t0, 8
858 define i16 @test_i16_65024_mask_ashr_9(i16 %a0) {
859 ; X32-LABEL: test_i16_65024_mask_ashr_9:
861 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
862 ; X32-NEXT: shrl $9, %eax
863 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
866 ; X64-LABEL: test_i16_65024_mask_ashr_9:
868 ; X64-NEXT: movswl %di, %eax
869 ; X64-NEXT: shrl $9, %eax
870 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
872 %t0 = and i16 %a0, 65024
873 %t1 = ashr i16 %t0, 9
876 define i16 @test_i16_65024_mask_ashr_10(i16 %a0) {
877 ; X32-LABEL: test_i16_65024_mask_ashr_10:
879 ; X32-NEXT: movswl {{[0-9]+}}(%esp), %eax
880 ; X32-NEXT: shrl $10, %eax
881 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
884 ; X64-LABEL: test_i16_65024_mask_ashr_10:
886 ; X64-NEXT: movswl %di, %eax
887 ; X64-NEXT: shrl $10, %eax
888 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
890 %t0 = and i16 %a0, 65024
891 %t1 = ashr i16 %t0, 10
897 define i16 @test_i16_127_mask_shl_1(i16 %a0) {
898 ; X32-LABEL: test_i16_127_mask_shl_1:
900 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
901 ; X32-NEXT: andl $127, %eax
902 ; X32-NEXT: addl %eax, %eax
903 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
906 ; X64-LABEL: test_i16_127_mask_shl_1:
908 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
909 ; X64-NEXT: andl $127, %edi
910 ; X64-NEXT: leal (%rdi,%rdi), %eax
911 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
913 %t0 = and i16 %a0, 127
917 define i16 @test_i16_127_mask_shl_8(i16 %a0) {
918 ; X32-LABEL: test_i16_127_mask_shl_8:
920 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
921 ; X32-NEXT: andl $127, %eax
922 ; X32-NEXT: shll $8, %eax
923 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
926 ; X64-LABEL: test_i16_127_mask_shl_8:
928 ; X64-NEXT: movl %edi, %eax
929 ; X64-NEXT: andl $127, %eax
930 ; X64-NEXT: shll $8, %eax
931 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
933 %t0 = and i16 %a0, 127
937 define i16 @test_i16_127_mask_shl_9(i16 %a0) {
938 ; X32-LABEL: test_i16_127_mask_shl_9:
940 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
941 ; X32-NEXT: shll $9, %eax
942 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
945 ; X64-LABEL: test_i16_127_mask_shl_9:
947 ; X64-NEXT: movl %edi, %eax
948 ; X64-NEXT: shll $9, %eax
949 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
951 %t0 = and i16 %a0, 127
955 define i16 @test_i16_127_mask_shl_10(i16 %a0) {
956 ; X32-LABEL: test_i16_127_mask_shl_10:
958 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
959 ; X32-NEXT: shll $10, %eax
960 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
963 ; X64-LABEL: test_i16_127_mask_shl_10:
965 ; X64-NEXT: movl %edi, %eax
966 ; X64-NEXT: shll $10, %eax
967 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
969 %t0 = and i16 %a0, 127
970 %t1 = shl i16 %t0, 10
974 define i16 @test_i16_2032_mask_shl_3(i16 %a0) {
975 ; X32-LABEL: test_i16_2032_mask_shl_3:
977 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
978 ; X32-NEXT: andl $2032, %eax # imm = 0x7F0
979 ; X32-NEXT: shll $3, %eax
980 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
983 ; X64-LABEL: test_i16_2032_mask_shl_3:
985 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
986 ; X64-NEXT: andl $2032, %edi # imm = 0x7F0
987 ; X64-NEXT: leal (,%rdi,8), %eax
988 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
990 %t0 = and i16 %a0, 2032
994 define i16 @test_i16_2032_mask_shl_4(i16 %a0) {
995 ; X32-LABEL: test_i16_2032_mask_shl_4:
997 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
998 ; X32-NEXT: andl $2032, %eax # imm = 0x7F0
999 ; X32-NEXT: shll $4, %eax
1000 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
1003 ; X64-LABEL: test_i16_2032_mask_shl_4:
1005 ; X64-NEXT: movl %edi, %eax
1006 ; X64-NEXT: andl $2032, %eax # imm = 0x7F0
1007 ; X64-NEXT: shll $4, %eax
1008 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1010 %t0 = and i16 %a0, 2032
1011 %t1 = shl i16 %t0, 4
1014 define i16 @test_i16_2032_mask_shl_5(i16 %a0) {
1015 ; X32-LABEL: test_i16_2032_mask_shl_5:
1017 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1018 ; X32-NEXT: andl $2032, %eax # imm = 0x7F0
1019 ; X32-NEXT: shll $5, %eax
1020 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
1023 ; X64-LABEL: test_i16_2032_mask_shl_5:
1025 ; X64-NEXT: movl %edi, %eax
1026 ; X64-NEXT: andl $2032, %eax # imm = 0x7F0
1027 ; X64-NEXT: shll $5, %eax
1028 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1030 %t0 = and i16 %a0, 2032
1031 %t1 = shl i16 %t0, 5
1034 define i16 @test_i16_2032_mask_shl_6(i16 %a0) {
1035 ; X32-LABEL: test_i16_2032_mask_shl_6:
1037 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1038 ; X32-NEXT: andl $1008, %eax # imm = 0x3F0
1039 ; X32-NEXT: shll $6, %eax
1040 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
1043 ; X64-LABEL: test_i16_2032_mask_shl_6:
1045 ; X64-NEXT: movl %edi, %eax
1046 ; X64-NEXT: andl $1008, %eax # imm = 0x3F0
1047 ; X64-NEXT: shll $6, %eax
1048 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1050 %t0 = and i16 %a0, 2032
1051 %t1 = shl i16 %t0, 6
1055 define i16 @test_i16_65024_mask_shl_1(i16 %a0) {
1056 ; X32-LABEL: test_i16_65024_mask_shl_1:
1058 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1059 ; X32-NEXT: andl $32256, %eax # imm = 0x7E00
1060 ; X32-NEXT: addl %eax, %eax
1061 ; X32-NEXT: # kill: def $ax killed $ax killed $eax
1064 ; X64-LABEL: test_i16_65024_mask_shl_1:
1066 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
1067 ; X64-NEXT: andl $32256, %edi # imm = 0x7E00
1068 ; X64-NEXT: leal (%rdi,%rdi), %eax
1069 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
1071 %t0 = and i16 %a0, 65024
1072 %t1 = shl i16 %t0, 1
1076 ;------------------------------------------------------------------------------;
1078 ;------------------------------------------------------------------------------;
1082 define i32 @test_i32_32767_mask_lshr_1(i32 %a0) {
1083 ; X32-LABEL: test_i32_32767_mask_lshr_1:
1085 ; X32-NEXT: movl $32766, %eax # imm = 0x7FFE
1086 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1087 ; X32-NEXT: shrl %eax
1090 ; X64-LABEL: test_i32_32767_mask_lshr_1:
1092 ; X64-NEXT: movl %edi, %eax
1093 ; X64-NEXT: andl $32766, %eax # imm = 0x7FFE
1094 ; X64-NEXT: shrl %eax
1096 %t0 = and i32 %a0, 32767
1097 %t1 = lshr i32 %t0, 1
1101 define i32 @test_i32_8388352_mask_lshr_7(i32 %a0) {
1102 ; X32-LABEL: test_i32_8388352_mask_lshr_7:
1104 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1105 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1106 ; X32-NEXT: shrl $7, %eax
1109 ; X64-LABEL: test_i32_8388352_mask_lshr_7:
1111 ; X64-NEXT: movl %edi, %eax
1112 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1113 ; X64-NEXT: shrl $7, %eax
1115 %t0 = and i32 %a0, 8388352
1116 %t1 = lshr i32 %t0, 7
1119 define i32 @test_i32_8388352_mask_lshr_8(i32 %a0) {
1120 ; X32-LABEL: test_i32_8388352_mask_lshr_8:
1122 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1123 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1124 ; X32-NEXT: shrl $8, %eax
1127 ; X64-LABEL: test_i32_8388352_mask_lshr_8:
1129 ; X64-NEXT: movl %edi, %eax
1130 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1131 ; X64-NEXT: shrl $8, %eax
1133 %t0 = and i32 %a0, 8388352
1134 %t1 = lshr i32 %t0, 8
1137 define i32 @test_i32_8388352_mask_lshr_9(i32 %a0) {
1138 ; X32-LABEL: test_i32_8388352_mask_lshr_9:
1140 ; X32-NEXT: movl $8388096, %eax # imm = 0x7FFE00
1141 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1142 ; X32-NEXT: shrl $9, %eax
1145 ; X64-LABEL: test_i32_8388352_mask_lshr_9:
1147 ; X64-NEXT: movl %edi, %eax
1148 ; X64-NEXT: andl $8388096, %eax # imm = 0x7FFE00
1149 ; X64-NEXT: shrl $9, %eax
1151 %t0 = and i32 %a0, 8388352
1152 %t1 = lshr i32 %t0, 9
1155 define i32 @test_i32_8388352_mask_lshr_10(i32 %a0) {
1156 ; X32-LABEL: test_i32_8388352_mask_lshr_10:
1158 ; X32-NEXT: movl $8387584, %eax # imm = 0x7FFC00
1159 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1160 ; X32-NEXT: shrl $10, %eax
1163 ; X64-LABEL: test_i32_8388352_mask_lshr_10:
1165 ; X64-NEXT: movl %edi, %eax
1166 ; X64-NEXT: andl $8387584, %eax # imm = 0x7FFC00
1167 ; X64-NEXT: shrl $10, %eax
1169 %t0 = and i32 %a0, 8388352
1170 %t1 = lshr i32 %t0, 10
1174 define i32 @test_i32_4294836224_mask_lshr_1(i32 %a0) {
1175 ; X32-LABEL: test_i32_4294836224_mask_lshr_1:
1177 ; X32-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1178 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1179 ; X32-NEXT: shrl %eax
1182 ; X64-LABEL: test_i32_4294836224_mask_lshr_1:
1184 ; X64-NEXT: movl %edi, %eax
1185 ; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE0000
1186 ; X64-NEXT: shrl %eax
1188 %t0 = and i32 %a0, 4294836224
1189 %t1 = lshr i32 %t0, 1
1192 define i32 @test_i32_4294836224_mask_lshr_16(i32 %a0) {
1193 ; X32-LABEL: test_i32_4294836224_mask_lshr_16:
1195 ; X32-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1196 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1197 ; X32-NEXT: shrl $16, %eax
1200 ; X64-LABEL: test_i32_4294836224_mask_lshr_16:
1202 ; X64-NEXT: movl %edi, %eax
1203 ; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE0000
1204 ; X64-NEXT: shrl $16, %eax
1206 %t0 = and i32 %a0, 4294836224
1207 %t1 = lshr i32 %t0, 16
1210 define i32 @test_i32_4294836224_mask_lshr_17(i32 %a0) {
1211 ; X32-LABEL: test_i32_4294836224_mask_lshr_17:
1213 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1214 ; X32-NEXT: shrl $17, %eax
1217 ; X64-LABEL: test_i32_4294836224_mask_lshr_17:
1219 ; X64-NEXT: movl %edi, %eax
1220 ; X64-NEXT: shrl $17, %eax
1222 %t0 = and i32 %a0, 4294836224
1223 %t1 = lshr i32 %t0, 17
1226 define i32 @test_i32_4294836224_mask_lshr_18(i32 %a0) {
1227 ; X32-LABEL: test_i32_4294836224_mask_lshr_18:
1229 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1230 ; X32-NEXT: shrl $18, %eax
1233 ; X64-LABEL: test_i32_4294836224_mask_lshr_18:
1235 ; X64-NEXT: movl %edi, %eax
1236 ; X64-NEXT: shrl $18, %eax
1238 %t0 = and i32 %a0, 4294836224
1239 %t1 = lshr i32 %t0, 18
1245 define i32 @test_i32_32767_mask_ashr_1(i32 %a0) {
1246 ; X32-LABEL: test_i32_32767_mask_ashr_1:
1248 ; X32-NEXT: movl $32766, %eax # imm = 0x7FFE
1249 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1250 ; X32-NEXT: shrl %eax
1253 ; X64-LABEL: test_i32_32767_mask_ashr_1:
1255 ; X64-NEXT: movl %edi, %eax
1256 ; X64-NEXT: andl $32766, %eax # imm = 0x7FFE
1257 ; X64-NEXT: shrl %eax
1259 %t0 = and i32 %a0, 32767
1260 %t1 = ashr i32 %t0, 1
1264 define i32 @test_i32_8388352_mask_ashr_7(i32 %a0) {
1265 ; X32-LABEL: test_i32_8388352_mask_ashr_7:
1267 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1268 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1269 ; X32-NEXT: shrl $7, %eax
1272 ; X64-LABEL: test_i32_8388352_mask_ashr_7:
1274 ; X64-NEXT: movl %edi, %eax
1275 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1276 ; X64-NEXT: shrl $7, %eax
1278 %t0 = and i32 %a0, 8388352
1279 %t1 = ashr i32 %t0, 7
1282 define i32 @test_i32_8388352_mask_ashr_8(i32 %a0) {
1283 ; X32-LABEL: test_i32_8388352_mask_ashr_8:
1285 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1286 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1287 ; X32-NEXT: shrl $8, %eax
1290 ; X64-LABEL: test_i32_8388352_mask_ashr_8:
1292 ; X64-NEXT: movl %edi, %eax
1293 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1294 ; X64-NEXT: shrl $8, %eax
1296 %t0 = and i32 %a0, 8388352
1297 %t1 = ashr i32 %t0, 8
1300 define i32 @test_i32_8388352_mask_ashr_9(i32 %a0) {
1301 ; X32-LABEL: test_i32_8388352_mask_ashr_9:
1303 ; X32-NEXT: movl $8388096, %eax # imm = 0x7FFE00
1304 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1305 ; X32-NEXT: shrl $9, %eax
1308 ; X64-LABEL: test_i32_8388352_mask_ashr_9:
1310 ; X64-NEXT: movl %edi, %eax
1311 ; X64-NEXT: andl $8388096, %eax # imm = 0x7FFE00
1312 ; X64-NEXT: shrl $9, %eax
1314 %t0 = and i32 %a0, 8388352
1315 %t1 = ashr i32 %t0, 9
1318 define i32 @test_i32_8388352_mask_ashr_10(i32 %a0) {
1319 ; X32-LABEL: test_i32_8388352_mask_ashr_10:
1321 ; X32-NEXT: movl $8387584, %eax # imm = 0x7FFC00
1322 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1323 ; X32-NEXT: shrl $10, %eax
1326 ; X64-LABEL: test_i32_8388352_mask_ashr_10:
1328 ; X64-NEXT: movl %edi, %eax
1329 ; X64-NEXT: andl $8387584, %eax # imm = 0x7FFC00
1330 ; X64-NEXT: shrl $10, %eax
1332 %t0 = and i32 %a0, 8388352
1333 %t1 = ashr i32 %t0, 10
1337 define i32 @test_i32_4294836224_mask_ashr_1(i32 %a0) {
1338 ; X32-LABEL: test_i32_4294836224_mask_ashr_1:
1340 ; X32-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1341 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1342 ; X32-NEXT: sarl %eax
1345 ; X64-LABEL: test_i32_4294836224_mask_ashr_1:
1347 ; X64-NEXT: movl %edi, %eax
1348 ; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE0000
1349 ; X64-NEXT: sarl %eax
1351 %t0 = and i32 %a0, 4294836224
1352 %t1 = ashr i32 %t0, 1
1355 define i32 @test_i32_4294836224_mask_ashr_16(i32 %a0) {
1356 ; X32-LABEL: test_i32_4294836224_mask_ashr_16:
1358 ; X32-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1359 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1360 ; X32-NEXT: sarl $16, %eax
1363 ; X64-LABEL: test_i32_4294836224_mask_ashr_16:
1365 ; X64-NEXT: movl %edi, %eax
1366 ; X64-NEXT: andl $-131072, %eax # imm = 0xFFFE0000
1367 ; X64-NEXT: sarl $16, %eax
1369 %t0 = and i32 %a0, 4294836224
1370 %t1 = ashr i32 %t0, 16
1373 define i32 @test_i32_4294836224_mask_ashr_17(i32 %a0) {
1374 ; X32-LABEL: test_i32_4294836224_mask_ashr_17:
1376 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1377 ; X32-NEXT: sarl $17, %eax
1380 ; X64-LABEL: test_i32_4294836224_mask_ashr_17:
1382 ; X64-NEXT: movl %edi, %eax
1383 ; X64-NEXT: sarl $17, %eax
1385 %t0 = and i32 %a0, 4294836224
1386 %t1 = ashr i32 %t0, 17
1389 define i32 @test_i32_4294836224_mask_ashr_18(i32 %a0) {
1390 ; X32-LABEL: test_i32_4294836224_mask_ashr_18:
1392 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1393 ; X32-NEXT: sarl $18, %eax
1396 ; X64-LABEL: test_i32_4294836224_mask_ashr_18:
1398 ; X64-NEXT: movl %edi, %eax
1399 ; X64-NEXT: sarl $18, %eax
1401 %t0 = and i32 %a0, 4294836224
1402 %t1 = ashr i32 %t0, 18
1408 define i32 @test_i32_32767_mask_shl_1(i32 %a0) {
1409 ; X32-LABEL: test_i32_32767_mask_shl_1:
1411 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1412 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1413 ; X32-NEXT: addl %eax, %eax
1416 ; X64-LABEL: test_i32_32767_mask_shl_1:
1418 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
1419 ; X64-NEXT: andl $32767, %edi # imm = 0x7FFF
1420 ; X64-NEXT: leal (%rdi,%rdi), %eax
1422 %t0 = and i32 %a0, 32767
1423 %t1 = shl i32 %t0, 1
1426 define i32 @test_i32_32767_mask_shl_16(i32 %a0) {
1427 ; X32-LABEL: test_i32_32767_mask_shl_16:
1429 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1430 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1431 ; X32-NEXT: shll $16, %eax
1434 ; X64-LABEL: test_i32_32767_mask_shl_16:
1436 ; X64-NEXT: movl %edi, %eax
1437 ; X64-NEXT: andl $32767, %eax # imm = 0x7FFF
1438 ; X64-NEXT: shll $16, %eax
1440 %t0 = and i32 %a0, 32767
1441 %t1 = shl i32 %t0, 16
1444 define i32 @test_i32_32767_mask_shl_17(i32 %a0) {
1445 ; X32-LABEL: test_i32_32767_mask_shl_17:
1447 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1448 ; X32-NEXT: shll $17, %eax
1451 ; X64-LABEL: test_i32_32767_mask_shl_17:
1453 ; X64-NEXT: movl %edi, %eax
1454 ; X64-NEXT: shll $17, %eax
1456 %t0 = and i32 %a0, 32767
1457 %t1 = shl i32 %t0, 17
1460 define i32 @test_i32_32767_mask_shl_18(i32 %a0) {
1461 ; X32-LABEL: test_i32_32767_mask_shl_18:
1463 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1464 ; X32-NEXT: shll $18, %eax
1467 ; X64-LABEL: test_i32_32767_mask_shl_18:
1469 ; X64-NEXT: movl %edi, %eax
1470 ; X64-NEXT: shll $18, %eax
1472 %t0 = and i32 %a0, 32767
1473 %t1 = shl i32 %t0, 18
1477 define i32 @test_i32_8388352_mask_shl_7(i32 %a0) {
1478 ; X32-LABEL: test_i32_8388352_mask_shl_7:
1480 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1481 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1482 ; X32-NEXT: shll $7, %eax
1485 ; X64-LABEL: test_i32_8388352_mask_shl_7:
1487 ; X64-NEXT: movl %edi, %eax
1488 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1489 ; X64-NEXT: shll $7, %eax
1491 %t0 = and i32 %a0, 8388352
1492 %t1 = shl i32 %t0, 7
1495 define i32 @test_i32_8388352_mask_shl_8(i32 %a0) {
1496 ; X32-LABEL: test_i32_8388352_mask_shl_8:
1498 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1499 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1500 ; X32-NEXT: shll $8, %eax
1503 ; X64-LABEL: test_i32_8388352_mask_shl_8:
1505 ; X64-NEXT: movl %edi, %eax
1506 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1507 ; X64-NEXT: shll $8, %eax
1509 %t0 = and i32 %a0, 8388352
1510 %t1 = shl i32 %t0, 8
1513 define i32 @test_i32_8388352_mask_shl_9(i32 %a0) {
1514 ; X32-LABEL: test_i32_8388352_mask_shl_9:
1516 ; X32-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1517 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1518 ; X32-NEXT: shll $9, %eax
1521 ; X64-LABEL: test_i32_8388352_mask_shl_9:
1523 ; X64-NEXT: movl %edi, %eax
1524 ; X64-NEXT: andl $8388352, %eax # imm = 0x7FFF00
1525 ; X64-NEXT: shll $9, %eax
1527 %t0 = and i32 %a0, 8388352
1528 %t1 = shl i32 %t0, 9
1531 define i32 @test_i32_8388352_mask_shl_10(i32 %a0) {
1532 ; X32-LABEL: test_i32_8388352_mask_shl_10:
1534 ; X32-NEXT: movl $4194048, %eax # imm = 0x3FFF00
1535 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1536 ; X32-NEXT: shll $10, %eax
1539 ; X64-LABEL: test_i32_8388352_mask_shl_10:
1541 ; X64-NEXT: movl %edi, %eax
1542 ; X64-NEXT: andl $4194048, %eax # imm = 0x3FFF00
1543 ; X64-NEXT: shll $10, %eax
1545 %t0 = and i32 %a0, 8388352
1546 %t1 = shl i32 %t0, 10
1550 define i32 @test_i32_4294836224_mask_shl_1(i32 %a0) {
1551 ; X32-LABEL: test_i32_4294836224_mask_shl_1:
1553 ; X32-NEXT: movl $2147352576, %eax # imm = 0x7FFE0000
1554 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1555 ; X32-NEXT: addl %eax, %eax
1558 ; X64-LABEL: test_i32_4294836224_mask_shl_1:
1560 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
1561 ; X64-NEXT: andl $2147352576, %edi # imm = 0x7FFE0000
1562 ; X64-NEXT: leal (%rdi,%rdi), %eax
1564 %t0 = and i32 %a0, 4294836224
1565 %t1 = shl i32 %t0, 1
1569 ;------------------------------------------------------------------------------;
1571 ;------------------------------------------------------------------------------;
1575 define i64 @test_i64_2147483647_mask_lshr_1(i64 %a0) {
1576 ; X32-LABEL: test_i64_2147483647_mask_lshr_1:
1578 ; X32-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE
1579 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1580 ; X32-NEXT: shrl %eax
1581 ; X32-NEXT: xorl %edx, %edx
1584 ; X64-LABEL: test_i64_2147483647_mask_lshr_1:
1586 ; X64-NEXT: movq %rdi, %rax
1587 ; X64-NEXT: andl $2147483646, %eax # imm = 0x7FFFFFFE
1588 ; X64-NEXT: shrq %rax
1590 %t0 = and i64 %a0, 2147483647
1591 %t1 = lshr i64 %t0, 1
1595 define i64 @test_i64_140737488289792_mask_lshr_15(i64 %a0) {
1596 ; X32-LABEL: test_i64_140737488289792_mask_lshr_15:
1598 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1599 ; X32-NEXT: shll $16, %ecx
1600 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1601 ; X32-NEXT: shldl $17, %ecx, %eax
1602 ; X32-NEXT: xorl %edx, %edx
1605 ; X64-LABEL: test_i64_140737488289792_mask_lshr_15:
1607 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
1608 ; X64-NEXT: andq %rdi, %rax
1609 ; X64-NEXT: shrq $15, %rax
1611 %t0 = and i64 %a0, 140737488289792
1612 %t1 = lshr i64 %t0, 15
1615 define i64 @test_i64_140737488289792_mask_lshr_16(i64 %a0) {
1616 ; X32-LABEL: test_i64_140737488289792_mask_lshr_16:
1618 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1619 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1620 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1621 ; X32-NEXT: shll $16, %eax
1622 ; X32-NEXT: orl %ecx, %eax
1623 ; X32-NEXT: xorl %edx, %edx
1626 ; X64-LABEL: test_i64_140737488289792_mask_lshr_16:
1628 ; X64-NEXT: movq %rdi, %rax
1629 ; X64-NEXT: shrq $16, %rax
1630 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1632 %t0 = and i64 %a0, 140737488289792
1633 %t1 = lshr i64 %t0, 16
1636 define i64 @test_i64_140737488289792_mask_lshr_17(i64 %a0) {
1637 ; X32-LABEL: test_i64_140737488289792_mask_lshr_17:
1639 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
1640 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1641 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1642 ; X32-NEXT: shldl $15, %ecx, %eax
1643 ; X32-NEXT: xorl %edx, %edx
1646 ; X64-LABEL: test_i64_140737488289792_mask_lshr_17:
1648 ; X64-NEXT: movq %rdi, %rax
1649 ; X64-NEXT: shrq $17, %rax
1650 ; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF
1652 %t0 = and i64 %a0, 140737488289792
1653 %t1 = lshr i64 %t0, 17
1656 define i64 @test_i64_140737488289792_mask_lshr_18(i64 %a0) {
1657 ; X32-LABEL: test_i64_140737488289792_mask_lshr_18:
1659 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
1660 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1661 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1662 ; X32-NEXT: shldl $14, %ecx, %eax
1663 ; X32-NEXT: xorl %edx, %edx
1666 ; X64-LABEL: test_i64_140737488289792_mask_lshr_18:
1668 ; X64-NEXT: movq %rdi, %rax
1669 ; X64-NEXT: shrq $18, %rax
1670 ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF
1672 %t0 = and i64 %a0, 140737488289792
1673 %t1 = lshr i64 %t0, 18
1677 define i64 @test_i64_18446744065119617024_mask_lshr_1(i64 %a0) {
1678 ; X32-LABEL: test_i64_18446744065119617024_mask_lshr_1:
1680 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1681 ; X32-NEXT: shrl %edx
1682 ; X32-NEXT: xorl %eax, %eax
1685 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_1:
1687 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1688 ; X64-NEXT: andq %rdi, %rax
1689 ; X64-NEXT: shrq %rax
1691 %t0 = and i64 %a0, 18446744065119617024
1692 %t1 = lshr i64 %t0, 1
1695 define i64 @test_i64_18446744065119617024_mask_lshr_32(i64 %a0) {
1696 ; X32-LABEL: test_i64_18446744065119617024_mask_lshr_32:
1698 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1699 ; X32-NEXT: andl $-2, %eax
1700 ; X32-NEXT: xorl %edx, %edx
1703 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_32:
1705 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1706 ; X64-NEXT: andq %rdi, %rax
1707 ; X64-NEXT: shrq $32, %rax
1709 %t0 = and i64 %a0, 18446744065119617024
1710 %t1 = lshr i64 %t0, 32
1713 define i64 @test_i64_18446744065119617024_mask_lshr_33(i64 %a0) {
1714 ; X32-LABEL: test_i64_18446744065119617024_mask_lshr_33:
1716 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1717 ; X32-NEXT: shrl %eax
1718 ; X32-NEXT: xorl %edx, %edx
1721 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_33:
1723 ; X64-NEXT: movq %rdi, %rax
1724 ; X64-NEXT: shrq $33, %rax
1726 %t0 = and i64 %a0, 18446744065119617024
1727 %t1 = lshr i64 %t0, 33
1730 define i64 @test_i64_18446744065119617024_mask_lshr_34(i64 %a0) {
1731 ; X32-LABEL: test_i64_18446744065119617024_mask_lshr_34:
1733 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1734 ; X32-NEXT: shrl $2, %eax
1735 ; X32-NEXT: xorl %edx, %edx
1738 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_34:
1740 ; X64-NEXT: movq %rdi, %rax
1741 ; X64-NEXT: shrq $34, %rax
1743 %t0 = and i64 %a0, 18446744065119617024
1744 %t1 = lshr i64 %t0, 34
1750 define i64 @test_i64_2147483647_mask_ashr_1(i64 %a0) {
1751 ; X32-LABEL: test_i64_2147483647_mask_ashr_1:
1753 ; X32-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE
1754 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1755 ; X32-NEXT: shrl %eax
1756 ; X32-NEXT: xorl %edx, %edx
1759 ; X64-LABEL: test_i64_2147483647_mask_ashr_1:
1761 ; X64-NEXT: movq %rdi, %rax
1762 ; X64-NEXT: andl $2147483646, %eax # imm = 0x7FFFFFFE
1763 ; X64-NEXT: shrq %rax
1765 %t0 = and i64 %a0, 2147483647
1766 %t1 = ashr i64 %t0, 1
1770 define i64 @test_i64_140737488289792_mask_ashr_15(i64 %a0) {
1771 ; X32-LABEL: test_i64_140737488289792_mask_ashr_15:
1773 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1774 ; X32-NEXT: shll $16, %ecx
1775 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1776 ; X32-NEXT: shldl $17, %ecx, %eax
1777 ; X32-NEXT: xorl %edx, %edx
1780 ; X64-LABEL: test_i64_140737488289792_mask_ashr_15:
1782 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
1783 ; X64-NEXT: andq %rdi, %rax
1784 ; X64-NEXT: shrq $15, %rax
1786 %t0 = and i64 %a0, 140737488289792
1787 %t1 = ashr i64 %t0, 15
1790 define i64 @test_i64_140737488289792_mask_ashr_16(i64 %a0) {
1791 ; X32-LABEL: test_i64_140737488289792_mask_ashr_16:
1793 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1794 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1795 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1796 ; X32-NEXT: shll $16, %eax
1797 ; X32-NEXT: orl %ecx, %eax
1798 ; X32-NEXT: xorl %edx, %edx
1801 ; X64-LABEL: test_i64_140737488289792_mask_ashr_16:
1803 ; X64-NEXT: movq %rdi, %rax
1804 ; X64-NEXT: shrq $16, %rax
1805 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1807 %t0 = and i64 %a0, 140737488289792
1808 %t1 = ashr i64 %t0, 16
1811 define i64 @test_i64_140737488289792_mask_ashr_17(i64 %a0) {
1812 ; X32-LABEL: test_i64_140737488289792_mask_ashr_17:
1814 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
1815 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1816 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1817 ; X32-NEXT: shldl $15, %ecx, %eax
1818 ; X32-NEXT: xorl %edx, %edx
1821 ; X64-LABEL: test_i64_140737488289792_mask_ashr_17:
1823 ; X64-NEXT: movq %rdi, %rax
1824 ; X64-NEXT: shrq $17, %rax
1825 ; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF
1827 %t0 = and i64 %a0, 140737488289792
1828 %t1 = ashr i64 %t0, 17
1831 define i64 @test_i64_140737488289792_mask_ashr_18(i64 %a0) {
1832 ; X32-LABEL: test_i64_140737488289792_mask_ashr_18:
1834 ; X32-NEXT: movl {{[0-9]+}}(%esp), %ecx
1835 ; X32-NEXT: movl $32767, %eax # imm = 0x7FFF
1836 ; X32-NEXT: andl {{[0-9]+}}(%esp), %eax
1837 ; X32-NEXT: shldl $14, %ecx, %eax
1838 ; X32-NEXT: xorl %edx, %edx
1841 ; X64-LABEL: test_i64_140737488289792_mask_ashr_18:
1843 ; X64-NEXT: movq %rdi, %rax
1844 ; X64-NEXT: shrq $18, %rax
1845 ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF
1847 %t0 = and i64 %a0, 140737488289792
1848 %t1 = ashr i64 %t0, 18
1852 define i64 @test_i64_18446744065119617024_mask_ashr_1(i64 %a0) {
1853 ; X32-LABEL: test_i64_18446744065119617024_mask_ashr_1:
1855 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1856 ; X32-NEXT: sarl %edx
1857 ; X32-NEXT: xorl %eax, %eax
1860 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_1:
1862 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1863 ; X64-NEXT: andq %rdi, %rax
1864 ; X64-NEXT: sarq %rax
1866 %t0 = and i64 %a0, 18446744065119617024
1867 %t1 = ashr i64 %t0, 1
1870 define i64 @test_i64_18446744065119617024_mask_ashr_32(i64 %a0) {
1871 ; X32-LABEL: test_i64_18446744065119617024_mask_ashr_32:
1873 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1874 ; X32-NEXT: andl $-2, %eax
1875 ; X32-NEXT: movl %eax, %edx
1876 ; X32-NEXT: sarl $31, %edx
1879 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_32:
1881 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1882 ; X64-NEXT: andq %rdi, %rax
1883 ; X64-NEXT: sarq $32, %rax
1885 %t0 = and i64 %a0, 18446744065119617024
1886 %t1 = ashr i64 %t0, 32
1889 define i64 @test_i64_18446744065119617024_mask_ashr_33(i64 %a0) {
1890 ; X32-LABEL: test_i64_18446744065119617024_mask_ashr_33:
1892 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1893 ; X32-NEXT: movl %edx, %eax
1894 ; X32-NEXT: sarl %eax
1895 ; X32-NEXT: sarl $31, %edx
1898 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_33:
1900 ; X64-NEXT: movq %rdi, %rax
1901 ; X64-NEXT: sarq $33, %rax
1903 %t0 = and i64 %a0, 18446744065119617024
1904 %t1 = ashr i64 %t0, 33
1907 define i64 @test_i64_18446744065119617024_mask_ashr_34(i64 %a0) {
1908 ; X32-LABEL: test_i64_18446744065119617024_mask_ashr_34:
1910 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1911 ; X32-NEXT: movl %edx, %eax
1912 ; X32-NEXT: sarl $2, %eax
1913 ; X32-NEXT: sarl $31, %edx
1916 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_34:
1918 ; X64-NEXT: movq %rdi, %rax
1919 ; X64-NEXT: sarq $34, %rax
1921 %t0 = and i64 %a0, 18446744065119617024
1922 %t1 = ashr i64 %t0, 34
1928 define i64 @test_i64_2147483647_mask_shl_1(i64 %a0) {
1929 ; X32-LABEL: test_i64_2147483647_mask_shl_1:
1931 ; X32-NEXT: movl {{[0-9]+}}(%esp), %eax
1932 ; X32-NEXT: addl %eax, %eax
1933 ; X32-NEXT: xorl %edx, %edx
1936 ; X64-LABEL: test_i64_2147483647_mask_shl_1:
1938 ; X64-NEXT: andl $2147483647, %edi # imm = 0x7FFFFFFF
1939 ; X64-NEXT: leaq (%rdi,%rdi), %rax
1941 %t0 = and i64 %a0, 2147483647
1942 %t1 = shl i64 %t0, 1
1945 define i64 @test_i64_2147483647_mask_shl_32(i64 %a0) {
1946 ; X32-LABEL: test_i64_2147483647_mask_shl_32:
1948 ; X32-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF
1949 ; X32-NEXT: andl {{[0-9]+}}(%esp), %edx
1950 ; X32-NEXT: xorl %eax, %eax
1953 ; X64-LABEL: test_i64_2147483647_mask_shl_32:
1955 ; X64-NEXT: movq %rdi, %rax
1956 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1957 ; X64-NEXT: shlq $32, %rax
1959 %t0 = and i64 %a0, 2147483647
1960 %t1 = shl i64 %t0, 32
1963 define i64 @test_i64_2147483647_mask_shl_33(i64 %a0) {
1964 ; X32-LABEL: test_i64_2147483647_mask_shl_33:
1966 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1967 ; X32-NEXT: addl %edx, %edx
1968 ; X32-NEXT: xorl %eax, %eax
1971 ; X64-LABEL: test_i64_2147483647_mask_shl_33:
1973 ; X64-NEXT: movq %rdi, %rax
1974 ; X64-NEXT: shlq $33, %rax
1976 %t0 = and i64 %a0, 2147483647
1977 %t1 = shl i64 %t0, 33
1980 define i64 @test_i64_2147483647_mask_shl_34(i64 %a0) {
1981 ; X32-LABEL: test_i64_2147483647_mask_shl_34:
1983 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
1984 ; X32-NEXT: shll $2, %edx
1985 ; X32-NEXT: xorl %eax, %eax
1988 ; X64-LABEL: test_i64_2147483647_mask_shl_34:
1990 ; X64-NEXT: movq %rdi, %rax
1991 ; X64-NEXT: shlq $34, %rax
1993 %t0 = and i64 %a0, 2147483647
1994 %t1 = shl i64 %t0, 34
1998 define i64 @test_i64_140737488289792_mask_shl_15(i64 %a0) {
1999 ; X32-LABEL: test_i64_140737488289792_mask_shl_15:
2001 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2002 ; X32-NEXT: movl %eax, %ecx
2003 ; X32-NEXT: shll $16, %ecx
2004 ; X32-NEXT: movl $32767, %edx # imm = 0x7FFF
2005 ; X32-NEXT: andl {{[0-9]+}}(%esp), %edx
2006 ; X32-NEXT: shldl $15, %ecx, %edx
2007 ; X32-NEXT: shll $31, %eax
2010 ; X64-LABEL: test_i64_140737488289792_mask_shl_15:
2012 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2013 ; X64-NEXT: andq %rdi, %rax
2014 ; X64-NEXT: shlq $15, %rax
2016 %t0 = and i64 %a0, 140737488289792
2017 %t1 = shl i64 %t0, 15
2020 define i64 @test_i64_140737488289792_mask_shl_16(i64 %a0) {
2021 ; X32-LABEL: test_i64_140737488289792_mask_shl_16:
2023 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2024 ; X32-NEXT: shll $16, %eax
2025 ; X32-NEXT: movl $32767, %edx # imm = 0x7FFF
2026 ; X32-NEXT: andl {{[0-9]+}}(%esp), %edx
2027 ; X32-NEXT: shldl $16, %eax, %edx
2028 ; X32-NEXT: xorl %eax, %eax
2031 ; X64-LABEL: test_i64_140737488289792_mask_shl_16:
2033 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2034 ; X64-NEXT: andq %rdi, %rax
2035 ; X64-NEXT: shlq $16, %rax
2037 %t0 = and i64 %a0, 140737488289792
2038 %t1 = shl i64 %t0, 16
2041 define i64 @test_i64_140737488289792_mask_shl_17(i64 %a0) {
2042 ; X32-LABEL: test_i64_140737488289792_mask_shl_17:
2044 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2045 ; X32-NEXT: shll $16, %eax
2046 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
2047 ; X32-NEXT: shldl $17, %eax, %edx
2048 ; X32-NEXT: xorl %eax, %eax
2051 ; X64-LABEL: test_i64_140737488289792_mask_shl_17:
2053 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2054 ; X64-NEXT: andq %rdi, %rax
2055 ; X64-NEXT: shlq $17, %rax
2057 %t0 = and i64 %a0, 140737488289792
2058 %t1 = shl i64 %t0, 17
2061 define i64 @test_i64_140737488289792_mask_shl_18(i64 %a0) {
2062 ; X32-LABEL: test_i64_140737488289792_mask_shl_18:
2064 ; X32-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2065 ; X32-NEXT: shll $16, %eax
2066 ; X32-NEXT: movl {{[0-9]+}}(%esp), %edx
2067 ; X32-NEXT: shldl $18, %eax, %edx
2068 ; X32-NEXT: xorl %eax, %eax
2071 ; X64-LABEL: test_i64_140737488289792_mask_shl_18:
2073 ; X64-NEXT: movabsq $70368744112128, %rax # imm = 0x3FFFFFFF0000
2074 ; X64-NEXT: andq %rdi, %rax
2075 ; X64-NEXT: shlq $18, %rax
2077 %t0 = and i64 %a0, 140737488289792
2078 %t1 = shl i64 %t0, 18
2082 define i64 @test_i64_18446744065119617024_mask_shl_1(i64 %a0) {
2083 ; X32-LABEL: test_i64_18446744065119617024_mask_shl_1:
2085 ; X32-NEXT: movl $2147483646, %edx # imm = 0x7FFFFFFE
2086 ; X32-NEXT: andl {{[0-9]+}}(%esp), %edx
2087 ; X32-NEXT: addl %edx, %edx
2088 ; X32-NEXT: xorl %eax, %eax
2091 ; X64-LABEL: test_i64_18446744065119617024_mask_shl_1:
2093 ; X64-NEXT: movabsq $9223372028264841216, %rax # imm = 0x7FFFFFFE00000000
2094 ; X64-NEXT: andq %rdi, %rax
2095 ; X64-NEXT: addq %rax, %rax
2097 %t0 = and i64 %a0, 18446744065119617024
2098 %t1 = shl i64 %t0, 1