1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=X64
5 ; The mask is all-ones, potentially shifted.
7 ;------------------------------------------------------------------------------;
9 ;------------------------------------------------------------------------------;
13 define i8 @test_i8_7_mask_lshr_1(i8 %a0) {
14 ; X86-LABEL: test_i8_7_mask_lshr_1:
16 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
17 ; X86-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 ; X86-LABEL: test_i8_28_mask_lshr_1:
36 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
37 ; X86-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 ; X86-LABEL: test_i8_28_mask_lshr_2:
55 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
56 ; X86-NEXT: andb $28, %al
57 ; X86-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 ; X86-LABEL: test_i8_28_mask_lshr_3:
74 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
75 ; X86-NEXT: andb $24, %al
76 ; X86-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 ; X86-LABEL: test_i8_28_mask_lshr_4:
93 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
94 ; X86-NEXT: andb $16, %al
95 ; X86-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 ; X86-LABEL: test_i8_224_mask_lshr_1:
113 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
114 ; X86-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 ; X86-LABEL: test_i8_224_mask_lshr_4:
132 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
133 ; X86-NEXT: andb $-32, %al
134 ; X86-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 ; X86-LABEL: test_i8_224_mask_lshr_5:
151 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
152 ; X86-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 ; X86-LABEL: test_i8_224_mask_lshr_6:
168 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
169 ; X86-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 ; X86-LABEL: test_i8_7_mask_ashr_1:
188 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
189 ; X86-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 ; X86-LABEL: test_i8_28_mask_ashr_1:
208 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
209 ; X86-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 ; X86-LABEL: test_i8_28_mask_ashr_2:
227 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
228 ; X86-NEXT: andb $28, %al
229 ; X86-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 ; X86-LABEL: test_i8_28_mask_ashr_3:
246 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
247 ; X86-NEXT: andb $24, %al
248 ; X86-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 ; X86-LABEL: test_i8_28_mask_ashr_4:
265 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
266 ; X86-NEXT: andb $16, %al
267 ; X86-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 ; X86-LABEL: test_i8_224_mask_ashr_1:
285 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
286 ; X86-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 ; X86-LABEL: test_i8_224_mask_ashr_4:
304 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
305 ; X86-NEXT: andb $-32, %al
306 ; X86-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 ; X86-LABEL: test_i8_224_mask_ashr_5:
323 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
324 ; X86-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 ; X86-LABEL: test_i8_224_mask_ashr_6:
340 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
341 ; X86-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 ; X86-LABEL: test_i8_7_mask_shl_1:
360 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
361 ; X86-NEXT: andb $7, %al
362 ; X86-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 ; X86-LABEL: test_i8_7_mask_shl_4:
379 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
380 ; X86-NEXT: andb $7, %al
381 ; X86-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 ; X86-LABEL: test_i8_7_mask_shl_5:
398 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
399 ; X86-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 ; X86-LABEL: test_i8_7_mask_shl_6:
415 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
416 ; X86-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 ; X86-LABEL: test_i8_28_mask_shl_1:
433 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
434 ; X86-NEXT: andb $28, %al
435 ; X86-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 ; X86-LABEL: test_i8_28_mask_shl_2:
452 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
453 ; X86-NEXT: andb $28, %al
454 ; X86-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 ; X86-LABEL: test_i8_28_mask_shl_3:
471 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
472 ; X86-NEXT: andb $28, %al
473 ; X86-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 ; X86-LABEL: test_i8_28_mask_shl_4:
490 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
491 ; X86-NEXT: andb $12, %al
492 ; X86-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 ; X86-LABEL: test_i8_224_mask_shl_1:
510 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
511 ; X86-NEXT: andb $96, %al
512 ; X86-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 ; X86-LABEL: test_i16_127_mask_lshr_1:
536 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
537 ; X86-NEXT: andl $126, %eax
538 ; X86-NEXT: shrl %eax
539 ; X86-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 ; X86-LABEL: test_i16_2032_mask_lshr_3:
557 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
558 ; X86-NEXT: andl $2032, %eax # imm = 0x7F0
559 ; X86-NEXT: shrl $3, %eax
560 ; X86-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 ; X86-LABEL: test_i16_2032_mask_lshr_4:
577 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
578 ; X86-NEXT: shrl $4, %eax
579 ; X86-NEXT: andl $127, %eax
580 ; X86-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 ; X86-LABEL: test_i16_2032_mask_lshr_5:
597 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
598 ; X86-NEXT: shrl $5, %eax
599 ; X86-NEXT: andl $63, %eax
600 ; X86-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 ; X86-LABEL: test_i16_2032_mask_lshr_6:
617 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
618 ; X86-NEXT: shrl $6, %eax
619 ; X86-NEXT: andl $31, %eax
620 ; X86-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 ; X86-LABEL: test_i16_65024_mask_lshr_1:
638 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
639 ; X86-NEXT: andl $65024, %eax # imm = 0xFE00
640 ; X86-NEXT: shrl %eax
641 ; X86-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 ; X86-LABEL: test_i16_65024_mask_lshr_8:
658 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
659 ; X86-NEXT: andl $65024, %eax # imm = 0xFE00
660 ; X86-NEXT: shrl $8, %eax
661 ; X86-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 ; X86-LABEL: test_i16_65024_mask_lshr_9:
678 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
679 ; X86-NEXT: shrl $9, %eax
680 ; X86-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 ; X86-LABEL: test_i16_65024_mask_lshr_10:
696 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
697 ; X86-NEXT: shrl $10, %eax
698 ; X86-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 ; X86-LABEL: test_i16_127_mask_ashr_1:
717 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
718 ; X86-NEXT: andl $126, %eax
719 ; X86-NEXT: shrl %eax
720 ; X86-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 ; X86-LABEL: test_i16_2032_mask_ashr_3:
738 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
739 ; X86-NEXT: andl $2032, %eax # imm = 0x7F0
740 ; X86-NEXT: shrl $3, %eax
741 ; X86-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 ; X86-LABEL: test_i16_2032_mask_ashr_4:
758 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
759 ; X86-NEXT: shrl $4, %eax
760 ; X86-NEXT: andl $127, %eax
761 ; X86-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 ; X86-LABEL: test_i16_2032_mask_ashr_5:
778 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
779 ; X86-NEXT: shrl $5, %eax
780 ; X86-NEXT: andl $63, %eax
781 ; X86-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 ; X86-LABEL: test_i16_2032_mask_ashr_6:
798 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
799 ; X86-NEXT: shrl $6, %eax
800 ; X86-NEXT: andl $31, %eax
801 ; X86-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 ; X86-LABEL: test_i16_65024_mask_ashr_1:
819 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
820 ; X86-NEXT: andl $65024, %eax # imm = 0xFE00
822 ; X86-NEXT: shrl %eax
823 ; X86-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 ; X86-LABEL: test_i16_65024_mask_ashr_8:
840 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
841 ; X86-NEXT: andl $65024, %eax # imm = 0xFE00
843 ; X86-NEXT: shrl $8, %eax
844 ; X86-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 ; X86-LABEL: test_i16_65024_mask_ashr_9:
861 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %eax
862 ; X86-NEXT: shrl $9, %eax
863 ; X86-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 ; X86-LABEL: test_i16_65024_mask_ashr_10:
879 ; X86-NEXT: movswl {{[0-9]+}}(%esp), %eax
880 ; X86-NEXT: shrl $10, %eax
881 ; X86-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 ; X86-LABEL: test_i16_127_mask_shl_1:
900 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
901 ; X86-NEXT: andl $127, %eax
902 ; X86-NEXT: addl %eax, %eax
903 ; X86-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 ; X86-LABEL: test_i16_127_mask_shl_8:
920 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
921 ; X86-NEXT: andl $127, %eax
922 ; X86-NEXT: shll $8, %eax
923 ; X86-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 ; X86-LABEL: test_i16_127_mask_shl_9:
940 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
941 ; X86-NEXT: shll $9, %eax
942 ; X86-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 ; X86-LABEL: test_i16_127_mask_shl_10:
958 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
959 ; X86-NEXT: shll $10, %eax
960 ; X86-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 ; X86-LABEL: test_i16_2032_mask_shl_3:
977 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
978 ; X86-NEXT: andl $2032, %eax # imm = 0x7F0
979 ; X86-NEXT: shll $3, %eax
980 ; X86-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 ; X86-LABEL: test_i16_2032_mask_shl_4:
997 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
998 ; X86-NEXT: andl $2032, %eax # imm = 0x7F0
999 ; X86-NEXT: shll $4, %eax
1000 ; X86-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 ; X86-LABEL: test_i16_2032_mask_shl_5:
1017 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1018 ; X86-NEXT: andl $2032, %eax # imm = 0x7F0
1019 ; X86-NEXT: shll $5, %eax
1020 ; X86-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 ; X86-LABEL: test_i16_2032_mask_shl_6:
1037 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1038 ; X86-NEXT: andl $1008, %eax # imm = 0x3F0
1039 ; X86-NEXT: shll $6, %eax
1040 ; X86-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 ; X86-LABEL: test_i16_65024_mask_shl_1:
1058 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
1059 ; X86-NEXT: andl $32256, %eax # imm = 0x7E00
1060 ; X86-NEXT: addl %eax, %eax
1061 ; X86-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 ; X86-LABEL: test_i32_32767_mask_lshr_1:
1085 ; X86-NEXT: movl $32766, %eax # imm = 0x7FFE
1086 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1087 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_lshr_7:
1104 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1105 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1106 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_lshr_8:
1122 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1123 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1124 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_lshr_9:
1140 ; X86-NEXT: movl $8388096, %eax # imm = 0x7FFE00
1141 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1142 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_lshr_10:
1158 ; X86-NEXT: movl $8387584, %eax # imm = 0x7FFC00
1159 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1160 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_lshr_1:
1177 ; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1178 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1179 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_lshr_16:
1195 ; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1196 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1197 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_lshr_17:
1213 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1214 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_lshr_18:
1229 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1230 ; X86-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 ; X86-LABEL: test_i32_32767_mask_ashr_1:
1248 ; X86-NEXT: movl $32766, %eax # imm = 0x7FFE
1249 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1250 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_ashr_7:
1267 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1268 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1269 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_ashr_8:
1285 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1286 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1287 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_ashr_9:
1303 ; X86-NEXT: movl $8388096, %eax # imm = 0x7FFE00
1304 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1305 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_ashr_10:
1321 ; X86-NEXT: movl $8387584, %eax # imm = 0x7FFC00
1322 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1323 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_ashr_1:
1340 ; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1341 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1342 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_ashr_16:
1358 ; X86-NEXT: movl $-131072, %eax # imm = 0xFFFE0000
1359 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1360 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_ashr_17:
1376 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1377 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_ashr_18:
1392 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1393 ; X86-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 ; X86-LABEL: test_i32_32767_mask_shl_1:
1411 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1412 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1413 ; X86-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 ; X86-LABEL: test_i32_32767_mask_shl_16:
1429 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1430 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1431 ; X86-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 ; X86-LABEL: test_i32_32767_mask_shl_17:
1447 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1448 ; X86-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 ; X86-LABEL: test_i32_32767_mask_shl_18:
1463 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1464 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_shl_7:
1480 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1481 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1482 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_shl_8:
1498 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1499 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1500 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_shl_9:
1516 ; X86-NEXT: movl $8388352, %eax # imm = 0x7FFF00
1517 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1518 ; X86-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 ; X86-LABEL: test_i32_8388352_mask_shl_10:
1534 ; X86-NEXT: movl $4194048, %eax # imm = 0x3FFF00
1535 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1536 ; X86-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 ; X86-LABEL: test_i32_4294836224_mask_shl_1:
1553 ; X86-NEXT: movl $2147352576, %eax # imm = 0x7FFE0000
1554 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1555 ; X86-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 ; X86-LABEL: test_i64_2147483647_mask_lshr_1:
1578 ; X86-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE
1579 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1580 ; X86-NEXT: shrl %eax
1581 ; X86-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: shrl %eax
1590 %t0 = and i64 %a0, 2147483647
1591 %t1 = lshr i64 %t0, 1
1595 define i64 @test_i64_140737488289792_mask_lshr_15(i64 %a0) {
1596 ; X86-LABEL: test_i64_140737488289792_mask_lshr_15:
1598 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1599 ; X86-NEXT: shll $16, %ecx
1600 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1601 ; X86-NEXT: shldl $17, %ecx, %eax
1602 ; X86-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 ; X86-LABEL: test_i64_140737488289792_mask_lshr_16:
1618 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1619 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1620 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1621 ; X86-NEXT: shldl $16, %ecx, %eax
1622 ; X86-NEXT: xorl %edx, %edx
1625 ; X64-LABEL: test_i64_140737488289792_mask_lshr_16:
1627 ; X64-NEXT: movq %rdi, %rax
1628 ; X64-NEXT: shrq $16, %rax
1629 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1631 %t0 = and i64 %a0, 140737488289792
1632 %t1 = lshr i64 %t0, 16
1635 define i64 @test_i64_140737488289792_mask_lshr_17(i64 %a0) {
1636 ; X86-LABEL: test_i64_140737488289792_mask_lshr_17:
1638 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1639 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1640 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1641 ; X86-NEXT: shldl $15, %ecx, %eax
1642 ; X86-NEXT: xorl %edx, %edx
1645 ; X64-LABEL: test_i64_140737488289792_mask_lshr_17:
1647 ; X64-NEXT: movq %rdi, %rax
1648 ; X64-NEXT: shrq $17, %rax
1649 ; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF
1651 %t0 = and i64 %a0, 140737488289792
1652 %t1 = lshr i64 %t0, 17
1655 define i64 @test_i64_140737488289792_mask_lshr_18(i64 %a0) {
1656 ; X86-LABEL: test_i64_140737488289792_mask_lshr_18:
1658 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1659 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1660 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1661 ; X86-NEXT: shldl $14, %ecx, %eax
1662 ; X86-NEXT: xorl %edx, %edx
1665 ; X64-LABEL: test_i64_140737488289792_mask_lshr_18:
1667 ; X64-NEXT: movq %rdi, %rax
1668 ; X64-NEXT: shrq $18, %rax
1669 ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF
1671 %t0 = and i64 %a0, 140737488289792
1672 %t1 = lshr i64 %t0, 18
1676 define i64 @test_i64_18446744065119617024_mask_lshr_1(i64 %a0) {
1677 ; X86-LABEL: test_i64_18446744065119617024_mask_lshr_1:
1679 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1680 ; X86-NEXT: shrl %edx
1681 ; X86-NEXT: xorl %eax, %eax
1684 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_1:
1686 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1687 ; X64-NEXT: andq %rdi, %rax
1688 ; X64-NEXT: shrq %rax
1690 %t0 = and i64 %a0, 18446744065119617024
1691 %t1 = lshr i64 %t0, 1
1694 define i64 @test_i64_18446744065119617024_mask_lshr_32(i64 %a0) {
1695 ; X86-LABEL: test_i64_18446744065119617024_mask_lshr_32:
1697 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1698 ; X86-NEXT: andl $-2, %eax
1699 ; X86-NEXT: xorl %edx, %edx
1702 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_32:
1704 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1705 ; X64-NEXT: andq %rdi, %rax
1706 ; X64-NEXT: shrq $32, %rax
1708 %t0 = and i64 %a0, 18446744065119617024
1709 %t1 = lshr i64 %t0, 32
1712 define i64 @test_i64_18446744065119617024_mask_lshr_33(i64 %a0) {
1713 ; X86-LABEL: test_i64_18446744065119617024_mask_lshr_33:
1715 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1716 ; X86-NEXT: shrl %eax
1717 ; X86-NEXT: xorl %edx, %edx
1720 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_33:
1722 ; X64-NEXT: movq %rdi, %rax
1723 ; X64-NEXT: shrq $33, %rax
1725 %t0 = and i64 %a0, 18446744065119617024
1726 %t1 = lshr i64 %t0, 33
1729 define i64 @test_i64_18446744065119617024_mask_lshr_34(i64 %a0) {
1730 ; X86-LABEL: test_i64_18446744065119617024_mask_lshr_34:
1732 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1733 ; X86-NEXT: shrl $2, %eax
1734 ; X86-NEXT: xorl %edx, %edx
1737 ; X64-LABEL: test_i64_18446744065119617024_mask_lshr_34:
1739 ; X64-NEXT: movq %rdi, %rax
1740 ; X64-NEXT: shrq $34, %rax
1742 %t0 = and i64 %a0, 18446744065119617024
1743 %t1 = lshr i64 %t0, 34
1749 define i64 @test_i64_2147483647_mask_ashr_1(i64 %a0) {
1750 ; X86-LABEL: test_i64_2147483647_mask_ashr_1:
1752 ; X86-NEXT: movl $2147483646, %eax # imm = 0x7FFFFFFE
1753 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1754 ; X86-NEXT: shrl %eax
1755 ; X86-NEXT: xorl %edx, %edx
1758 ; X64-LABEL: test_i64_2147483647_mask_ashr_1:
1760 ; X64-NEXT: movq %rdi, %rax
1761 ; X64-NEXT: andl $2147483646, %eax # imm = 0x7FFFFFFE
1762 ; X64-NEXT: shrl %eax
1764 %t0 = and i64 %a0, 2147483647
1765 %t1 = ashr i64 %t0, 1
1769 define i64 @test_i64_140737488289792_mask_ashr_15(i64 %a0) {
1770 ; X86-LABEL: test_i64_140737488289792_mask_ashr_15:
1772 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %ecx
1773 ; X86-NEXT: shll $16, %ecx
1774 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1775 ; X86-NEXT: shldl $17, %ecx, %eax
1776 ; X86-NEXT: xorl %edx, %edx
1779 ; X64-LABEL: test_i64_140737488289792_mask_ashr_15:
1781 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
1782 ; X64-NEXT: andq %rdi, %rax
1783 ; X64-NEXT: shrq $15, %rax
1785 %t0 = and i64 %a0, 140737488289792
1786 %t1 = ashr i64 %t0, 15
1789 define i64 @test_i64_140737488289792_mask_ashr_16(i64 %a0) {
1790 ; X86-LABEL: test_i64_140737488289792_mask_ashr_16:
1792 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1793 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1794 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1795 ; X86-NEXT: shldl $16, %ecx, %eax
1796 ; X86-NEXT: xorl %edx, %edx
1799 ; X64-LABEL: test_i64_140737488289792_mask_ashr_16:
1801 ; X64-NEXT: movq %rdi, %rax
1802 ; X64-NEXT: shrq $16, %rax
1803 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1805 %t0 = and i64 %a0, 140737488289792
1806 %t1 = ashr i64 %t0, 16
1809 define i64 @test_i64_140737488289792_mask_ashr_17(i64 %a0) {
1810 ; X86-LABEL: test_i64_140737488289792_mask_ashr_17:
1812 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1813 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1814 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1815 ; X86-NEXT: shldl $15, %ecx, %eax
1816 ; X86-NEXT: xorl %edx, %edx
1819 ; X64-LABEL: test_i64_140737488289792_mask_ashr_17:
1821 ; X64-NEXT: movq %rdi, %rax
1822 ; X64-NEXT: shrq $17, %rax
1823 ; X64-NEXT: andl $1073741823, %eax # imm = 0x3FFFFFFF
1825 %t0 = and i64 %a0, 140737488289792
1826 %t1 = ashr i64 %t0, 17
1829 define i64 @test_i64_140737488289792_mask_ashr_18(i64 %a0) {
1830 ; X86-LABEL: test_i64_140737488289792_mask_ashr_18:
1832 ; X86-NEXT: movl {{[0-9]+}}(%esp), %ecx
1833 ; X86-NEXT: movl $32767, %eax # imm = 0x7FFF
1834 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
1835 ; X86-NEXT: shldl $14, %ecx, %eax
1836 ; X86-NEXT: xorl %edx, %edx
1839 ; X64-LABEL: test_i64_140737488289792_mask_ashr_18:
1841 ; X64-NEXT: movq %rdi, %rax
1842 ; X64-NEXT: shrq $18, %rax
1843 ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF
1845 %t0 = and i64 %a0, 140737488289792
1846 %t1 = ashr i64 %t0, 18
1850 define i64 @test_i64_18446744065119617024_mask_ashr_1(i64 %a0) {
1851 ; X86-LABEL: test_i64_18446744065119617024_mask_ashr_1:
1853 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1854 ; X86-NEXT: sarl %edx
1855 ; X86-NEXT: xorl %eax, %eax
1858 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_1:
1860 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1861 ; X64-NEXT: andq %rdi, %rax
1862 ; X64-NEXT: sarq %rax
1864 %t0 = and i64 %a0, 18446744065119617024
1865 %t1 = ashr i64 %t0, 1
1868 define i64 @test_i64_18446744065119617024_mask_ashr_32(i64 %a0) {
1869 ; X86-LABEL: test_i64_18446744065119617024_mask_ashr_32:
1871 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1872 ; X86-NEXT: movl %edx, %eax
1873 ; X86-NEXT: andl $-2, %eax
1874 ; X86-NEXT: sarl $31, %edx
1877 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_32:
1879 ; X64-NEXT: movabsq $-8589934592, %rax # imm = 0xFFFFFFFE00000000
1880 ; X64-NEXT: andq %rdi, %rax
1881 ; X64-NEXT: sarq $32, %rax
1883 %t0 = and i64 %a0, 18446744065119617024
1884 %t1 = ashr i64 %t0, 32
1887 define i64 @test_i64_18446744065119617024_mask_ashr_33(i64 %a0) {
1888 ; X86-LABEL: test_i64_18446744065119617024_mask_ashr_33:
1890 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1891 ; X86-NEXT: movl %edx, %eax
1892 ; X86-NEXT: sarl %eax
1893 ; X86-NEXT: sarl $31, %edx
1896 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_33:
1898 ; X64-NEXT: movq %rdi, %rax
1899 ; X64-NEXT: sarq $33, %rax
1901 %t0 = and i64 %a0, 18446744065119617024
1902 %t1 = ashr i64 %t0, 33
1905 define i64 @test_i64_18446744065119617024_mask_ashr_34(i64 %a0) {
1906 ; X86-LABEL: test_i64_18446744065119617024_mask_ashr_34:
1908 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1909 ; X86-NEXT: movl %edx, %eax
1910 ; X86-NEXT: sarl $2, %eax
1911 ; X86-NEXT: sarl $31, %edx
1914 ; X64-LABEL: test_i64_18446744065119617024_mask_ashr_34:
1916 ; X64-NEXT: movq %rdi, %rax
1917 ; X64-NEXT: sarq $34, %rax
1919 %t0 = and i64 %a0, 18446744065119617024
1920 %t1 = ashr i64 %t0, 34
1926 define i64 @test_i64_2147483647_mask_shl_1(i64 %a0) {
1927 ; X86-LABEL: test_i64_2147483647_mask_shl_1:
1929 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1930 ; X86-NEXT: addl %eax, %eax
1931 ; X86-NEXT: xorl %edx, %edx
1934 ; X64-LABEL: test_i64_2147483647_mask_shl_1:
1936 ; X64-NEXT: leal (%rdi,%rdi), %eax
1938 %t0 = and i64 %a0, 2147483647
1939 %t1 = shl i64 %t0, 1
1942 define i64 @test_i64_2147483647_mask_shl_32(i64 %a0) {
1943 ; X86-LABEL: test_i64_2147483647_mask_shl_32:
1945 ; X86-NEXT: movl $2147483647, %edx # imm = 0x7FFFFFFF
1946 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
1947 ; X86-NEXT: xorl %eax, %eax
1950 ; X64-LABEL: test_i64_2147483647_mask_shl_32:
1952 ; X64-NEXT: movq %rdi, %rax
1953 ; X64-NEXT: andl $2147483647, %eax # imm = 0x7FFFFFFF
1954 ; X64-NEXT: shlq $32, %rax
1956 %t0 = and i64 %a0, 2147483647
1957 %t1 = shl i64 %t0, 32
1960 define i64 @test_i64_2147483647_mask_shl_33(i64 %a0) {
1961 ; X86-LABEL: test_i64_2147483647_mask_shl_33:
1963 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1964 ; X86-NEXT: addl %edx, %edx
1965 ; X86-NEXT: xorl %eax, %eax
1968 ; X64-LABEL: test_i64_2147483647_mask_shl_33:
1970 ; X64-NEXT: movq %rdi, %rax
1971 ; X64-NEXT: shlq $33, %rax
1973 %t0 = and i64 %a0, 2147483647
1974 %t1 = shl i64 %t0, 33
1977 define i64 @test_i64_2147483647_mask_shl_34(i64 %a0) {
1978 ; X86-LABEL: test_i64_2147483647_mask_shl_34:
1980 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
1981 ; X86-NEXT: shll $2, %edx
1982 ; X86-NEXT: xorl %eax, %eax
1985 ; X64-LABEL: test_i64_2147483647_mask_shl_34:
1987 ; X64-NEXT: movq %rdi, %rax
1988 ; X64-NEXT: shlq $34, %rax
1990 %t0 = and i64 %a0, 2147483647
1991 %t1 = shl i64 %t0, 34
1995 define i64 @test_i64_140737488289792_mask_shl_15(i64 %a0) {
1996 ; X86-LABEL: test_i64_140737488289792_mask_shl_15:
1998 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
1999 ; X86-NEXT: movl $32767, %edx # imm = 0x7FFF
2000 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
2001 ; X86-NEXT: shldl $15, %eax, %edx
2002 ; X86-NEXT: andl $65536, %eax # imm = 0x10000
2003 ; X86-NEXT: shll $15, %eax
2006 ; X64-LABEL: test_i64_140737488289792_mask_shl_15:
2008 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2009 ; X64-NEXT: andq %rdi, %rax
2010 ; X64-NEXT: shlq $15, %rax
2012 %t0 = and i64 %a0, 140737488289792
2013 %t1 = shl i64 %t0, 15
2016 define i64 @test_i64_140737488289792_mask_shl_16(i64 %a0) {
2017 ; X86-LABEL: test_i64_140737488289792_mask_shl_16:
2019 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
2020 ; X86-NEXT: movl $32767, %edx # imm = 0x7FFF
2021 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
2022 ; X86-NEXT: shldl $16, %eax, %edx
2023 ; X86-NEXT: xorl %eax, %eax
2026 ; X64-LABEL: test_i64_140737488289792_mask_shl_16:
2028 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2029 ; X64-NEXT: andq %rdi, %rax
2030 ; X64-NEXT: shlq $16, %rax
2032 %t0 = and i64 %a0, 140737488289792
2033 %t1 = shl i64 %t0, 16
2036 define i64 @test_i64_140737488289792_mask_shl_17(i64 %a0) {
2037 ; X86-LABEL: test_i64_140737488289792_mask_shl_17:
2039 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2040 ; X86-NEXT: shll $16, %eax
2041 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
2042 ; X86-NEXT: shldl $17, %eax, %edx
2043 ; X86-NEXT: xorl %eax, %eax
2046 ; X64-LABEL: test_i64_140737488289792_mask_shl_17:
2048 ; X64-NEXT: movabsq $140737488289792, %rax # imm = 0x7FFFFFFF0000
2049 ; X64-NEXT: andq %rdi, %rax
2050 ; X64-NEXT: shlq $17, %rax
2052 %t0 = and i64 %a0, 140737488289792
2053 %t1 = shl i64 %t0, 17
2056 define i64 @test_i64_140737488289792_mask_shl_18(i64 %a0) {
2057 ; X86-LABEL: test_i64_140737488289792_mask_shl_18:
2059 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
2060 ; X86-NEXT: shll $16, %eax
2061 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
2062 ; X86-NEXT: shldl $18, %eax, %edx
2063 ; X86-NEXT: xorl %eax, %eax
2066 ; X64-LABEL: test_i64_140737488289792_mask_shl_18:
2068 ; X64-NEXT: movabsq $70368744112128, %rax # imm = 0x3FFFFFFF0000
2069 ; X64-NEXT: andq %rdi, %rax
2070 ; X64-NEXT: shlq $18, %rax
2072 %t0 = and i64 %a0, 140737488289792
2073 %t1 = shl i64 %t0, 18
2077 define i64 @test_i64_18446744065119617024_mask_shl_1(i64 %a0) {
2078 ; X86-LABEL: test_i64_18446744065119617024_mask_shl_1:
2080 ; X86-NEXT: movl $2147483646, %edx # imm = 0x7FFFFFFE
2081 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
2082 ; X86-NEXT: addl %edx, %edx
2083 ; X86-NEXT: xorl %eax, %eax
2086 ; X64-LABEL: test_i64_18446744065119617024_mask_shl_1:
2088 ; X64-NEXT: movabsq $9223372028264841216, %rax # imm = 0x7FFFFFFE00000000
2089 ; X64-NEXT: andq %rdi, %rax
2090 ; X64-NEXT: addq %rax, %rax
2092 %t0 = and i64 %a0, 18446744065119617024
2093 %t1 = shl i64 %t0, 1