1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-pc-linux | FileCheck %s --check-prefix=X86
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux | FileCheck %s --check-prefixes=X64,X64-MASK
4 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=bdver1 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-SHIFT2
5 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=bdver2 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-TBM
6 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=bdver3 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-TBM
7 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=bdver4 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-TBM
8 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=btver1 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-SHIFT2
9 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=btver2 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-BMI,X64-BMI1
10 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=znver1 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-BMI,X64-BMI2
11 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mcpu=znver2 | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-BMI,X64-BMI2
12 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+fast-scalar-shift-masks | FileCheck %s --check-prefixes=X64,X64-SHIFT,X64-SHIFT2
15 ; fold (shl (lshr x, c1), c2) -> (0) (and x, MASK) or
16 ; (1) (and (shl x, (sub c2, c1), MASK) or
17 ; (2) (and (lshr x, (sub c1, c2), MASK)
20 define i8 @test_i8_shl_lshr_0(i8 %a0) {
21 ; X86-LABEL: test_i8_shl_lshr_0:
23 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
24 ; X86-NEXT: andb $-8, %al
27 ; X64-LABEL: test_i8_shl_lshr_0:
29 ; X64-NEXT: movl %edi, %eax
30 ; X64-NEXT: andb $-8, %al
31 ; X64-NEXT: # kill: def $al killed $al killed $eax
38 define i8 @test_i8_shl_lshr_1(i8 %a0) {
39 ; X86-LABEL: test_i8_shl_lshr_1:
41 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
42 ; X86-NEXT: shlb $2, %al
43 ; X86-NEXT: andb $-32, %al
46 ; X64-MASK-LABEL: test_i8_shl_lshr_1:
48 ; X64-MASK-NEXT: # kill: def $edi killed $edi def $rdi
49 ; X64-MASK-NEXT: leal (,%rdi,4), %eax
50 ; X64-MASK-NEXT: andb $-32, %al
51 ; X64-MASK-NEXT: # kill: def $al killed $al killed $eax
54 ; X64-SHIFT-LABEL: test_i8_shl_lshr_1:
56 ; X64-SHIFT-NEXT: movl %edi, %eax
57 ; X64-SHIFT-NEXT: shrb $3, %al
58 ; X64-SHIFT-NEXT: shlb $5, %al
59 ; X64-SHIFT-NEXT: # kill: def $al killed $al killed $eax
60 ; X64-SHIFT-NEXT: retq
66 define i8 @test_i8_shl_lshr_2(i8 %a0) {
67 ; X86-LABEL: test_i8_shl_lshr_2:
69 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
70 ; X86-NEXT: shrb $2, %al
71 ; X86-NEXT: andb $56, %al
74 ; X64-MASK-LABEL: test_i8_shl_lshr_2:
76 ; X64-MASK-NEXT: movl %edi, %eax
77 ; X64-MASK-NEXT: shrb $2, %al
78 ; X64-MASK-NEXT: andb $56, %al
79 ; X64-MASK-NEXT: # kill: def $al killed $al killed $eax
82 ; X64-SHIFT-LABEL: test_i8_shl_lshr_2:
84 ; X64-SHIFT-NEXT: # kill: def $edi killed $edi def $rdi
85 ; X64-SHIFT-NEXT: shrb $5, %dil
86 ; X64-SHIFT-NEXT: leal (,%rdi,8), %eax
87 ; X64-SHIFT-NEXT: # kill: def $al killed $al killed $eax
88 ; X64-SHIFT-NEXT: retq
94 define i16 @test_i16_shl_lshr_0(i16 %a0) {
95 ; X86-LABEL: test_i16_shl_lshr_0:
97 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
98 ; X86-NEXT: andl $-8, %eax
99 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
102 ; X64-LABEL: test_i16_shl_lshr_0:
104 ; X64-NEXT: movl %edi, %eax
105 ; X64-NEXT: andl $65528, %eax # imm = 0xFFF8
106 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
113 define i16 @test_i16_shl_lshr_1(i16 %a0) {
114 ; X86-LABEL: test_i16_shl_lshr_1:
116 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
117 ; X86-NEXT: shll $2, %eax
118 ; X86-NEXT: andl $65504, %eax # imm = 0xFFE0
119 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
122 ; X64-MASK-LABEL: test_i16_shl_lshr_1:
124 ; X64-MASK-NEXT: # kill: def $edi killed $edi def $rdi
125 ; X64-MASK-NEXT: leal (,%rdi,4), %eax
126 ; X64-MASK-NEXT: andl $65504, %eax # imm = 0xFFE0
127 ; X64-MASK-NEXT: # kill: def $ax killed $ax killed $eax
128 ; X64-MASK-NEXT: retq
130 ; X64-SHIFT-LABEL: test_i16_shl_lshr_1:
131 ; X64-SHIFT: # %bb.0:
132 ; X64-SHIFT-NEXT: movzwl %di, %eax
133 ; X64-SHIFT-NEXT: shrl $3, %eax
134 ; X64-SHIFT-NEXT: shll $5, %eax
135 ; X64-SHIFT-NEXT: # kill: def $ax killed $ax killed $eax
136 ; X64-SHIFT-NEXT: retq
142 define i16 @test_i16_shl_lshr_2(i16 %a0) {
143 ; X86-LABEL: test_i16_shl_lshr_2:
145 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
146 ; X86-NEXT: shrl $2, %eax
147 ; X86-NEXT: andl $16376, %eax # imm = 0x3FF8
148 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
151 ; X64-MASK-LABEL: test_i16_shl_lshr_2:
153 ; X64-MASK-NEXT: movl %edi, %eax
154 ; X64-MASK-NEXT: shrl $2, %eax
155 ; X64-MASK-NEXT: andl $16376, %eax # imm = 0x3FF8
156 ; X64-MASK-NEXT: # kill: def $ax killed $ax killed $eax
157 ; X64-MASK-NEXT: retq
159 ; X64-SHIFT-LABEL: test_i16_shl_lshr_2:
160 ; X64-SHIFT: # %bb.0:
161 ; X64-SHIFT-NEXT: movzwl %di, %eax
162 ; X64-SHIFT-NEXT: shrl $5, %eax
163 ; X64-SHIFT-NEXT: shll $3, %eax
164 ; X64-SHIFT-NEXT: # kill: def $ax killed $ax killed $eax
165 ; X64-SHIFT-NEXT: retq
171 define i32 @test_i32_shl_lshr_0(i32 %a0) {
172 ; X86-LABEL: test_i32_shl_lshr_0:
174 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
175 ; X86-NEXT: andl $-8, %eax
178 ; X64-LABEL: test_i32_shl_lshr_0:
180 ; X64-NEXT: movl %edi, %eax
181 ; X64-NEXT: andl $-8, %eax
188 define i32 @test_i32_shl_lshr_1(i32 %a0) {
189 ; X86-LABEL: test_i32_shl_lshr_1:
191 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
192 ; X86-NEXT: shll $2, %eax
193 ; X86-NEXT: andl $-32, %eax
196 ; X64-MASK-LABEL: test_i32_shl_lshr_1:
198 ; X64-MASK-NEXT: # kill: def $edi killed $edi def $rdi
199 ; X64-MASK-NEXT: leal (,%rdi,4), %eax
200 ; X64-MASK-NEXT: andl $-32, %eax
201 ; X64-MASK-NEXT: retq
203 ; X64-SHIFT-LABEL: test_i32_shl_lshr_1:
204 ; X64-SHIFT: # %bb.0:
205 ; X64-SHIFT-NEXT: movl %edi, %eax
206 ; X64-SHIFT-NEXT: shrl $3, %eax
207 ; X64-SHIFT-NEXT: shll $5, %eax
208 ; X64-SHIFT-NEXT: retq
214 define i32 @test_i32_shl_lshr_2(i32 %a0) {
215 ; X86-LABEL: test_i32_shl_lshr_2:
217 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
218 ; X86-NEXT: shrl $2, %eax
219 ; X86-NEXT: andl $-8, %eax
222 ; X64-MASK-LABEL: test_i32_shl_lshr_2:
224 ; X64-MASK-NEXT: movl %edi, %eax
225 ; X64-MASK-NEXT: shrl $2, %eax
226 ; X64-MASK-NEXT: andl $-8, %eax
227 ; X64-MASK-NEXT: retq
229 ; X64-SHIFT-LABEL: test_i32_shl_lshr_2:
230 ; X64-SHIFT: # %bb.0:
231 ; X64-SHIFT-NEXT: # kill: def $edi killed $edi def $rdi
232 ; X64-SHIFT-NEXT: shrl $5, %edi
233 ; X64-SHIFT-NEXT: leal (,%rdi,8), %eax
234 ; X64-SHIFT-NEXT: retq
240 define i64 @test_i64_shl_lshr_0(i64 %a0) {
241 ; X86-LABEL: test_i64_shl_lshr_0:
243 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
244 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
245 ; X86-NEXT: andl $-8, %eax
248 ; X64-LABEL: test_i64_shl_lshr_0:
250 ; X64-NEXT: movq %rdi, %rax
251 ; X64-NEXT: andq $-8, %rax
258 define i64 @test_i64_shl_lshr_1(i64 %a0) {
259 ; X86-LABEL: test_i64_shl_lshr_1:
261 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
262 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
263 ; X86-NEXT: shldl $2, %eax, %edx
264 ; X86-NEXT: shll $2, %eax
265 ; X86-NEXT: andl $-32, %eax
268 ; X64-MASK-LABEL: test_i64_shl_lshr_1:
270 ; X64-MASK-NEXT: leaq (,%rdi,4), %rax
271 ; X64-MASK-NEXT: andq $-32, %rax
272 ; X64-MASK-NEXT: retq
274 ; X64-SHIFT-LABEL: test_i64_shl_lshr_1:
275 ; X64-SHIFT: # %bb.0:
276 ; X64-SHIFT-NEXT: movq %rdi, %rax
277 ; X64-SHIFT-NEXT: shrq $3, %rax
278 ; X64-SHIFT-NEXT: shlq $5, %rax
279 ; X64-SHIFT-NEXT: retq
285 define i64 @test_i64_shl_lshr_2(i64 %a0) {
286 ; X86-LABEL: test_i64_shl_lshr_2:
288 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
289 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
290 ; X86-NEXT: shrdl $2, %edx, %eax
291 ; X86-NEXT: shrl $2, %edx
292 ; X86-NEXT: andl $-8, %eax
295 ; X64-MASK-LABEL: test_i64_shl_lshr_2:
297 ; X64-MASK-NEXT: movq %rdi, %rax
298 ; X64-MASK-NEXT: shrq $2, %rax
299 ; X64-MASK-NEXT: andq $-8, %rax
300 ; X64-MASK-NEXT: retq
302 ; X64-SHIFT-LABEL: test_i64_shl_lshr_2:
303 ; X64-SHIFT: # %bb.0:
304 ; X64-SHIFT-NEXT: shrq $5, %rdi
305 ; X64-SHIFT-NEXT: leaq (,%rdi,8), %rax
306 ; X64-SHIFT-NEXT: retq
313 ; fold (lshr (shl x, c1), c2) -> (0) (and x, MASK) or
314 ; (1) (and (shl x, (sub c1, c2), MASK) or
315 ; (2) (and (lshr x, (sub c2, c1), MASK)
318 define i8 @test_i8_lshr_lshr_0(i8 %a0) {
319 ; X86-LABEL: test_i8_lshr_lshr_0:
321 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
322 ; X86-NEXT: andb $31, %al
325 ; X64-LABEL: test_i8_lshr_lshr_0:
327 ; X64-NEXT: movl %edi, %eax
328 ; X64-NEXT: andb $31, %al
329 ; X64-NEXT: # kill: def $al killed $al killed $eax
336 define i8 @test_i8_lshr_lshr_1(i8 %a0) {
337 ; X86-LABEL: test_i8_lshr_lshr_1:
339 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
340 ; X86-NEXT: shrb $2, %al
341 ; X86-NEXT: andb $7, %al
344 ; X64-MASK-LABEL: test_i8_lshr_lshr_1:
346 ; X64-MASK-NEXT: movl %edi, %eax
347 ; X64-MASK-NEXT: shrb $2, %al
348 ; X64-MASK-NEXT: andb $7, %al
349 ; X64-MASK-NEXT: # kill: def $al killed $al killed $eax
350 ; X64-MASK-NEXT: retq
352 ; X64-SHIFT-LABEL: test_i8_lshr_lshr_1:
353 ; X64-SHIFT: # %bb.0:
354 ; X64-SHIFT-NEXT: # kill: def $edi killed $edi def $rdi
355 ; X64-SHIFT-NEXT: leal (,%rdi,8), %eax
356 ; X64-SHIFT-NEXT: shrb $5, %al
357 ; X64-SHIFT-NEXT: # kill: def $al killed $al killed $eax
358 ; X64-SHIFT-NEXT: retq
364 define i8 @test_i8_lshr_lshr_2(i8 %a0) {
365 ; X86-LABEL: test_i8_lshr_lshr_2:
367 ; X86-NEXT: movzbl {{[0-9]+}}(%esp), %eax
368 ; X86-NEXT: shlb $2, %al
369 ; X86-NEXT: andb $28, %al
372 ; X64-MASK-LABEL: test_i8_lshr_lshr_2:
374 ; X64-MASK-NEXT: # kill: def $edi killed $edi def $rdi
375 ; X64-MASK-NEXT: leal (,%rdi,4), %eax
376 ; X64-MASK-NEXT: andb $28, %al
377 ; X64-MASK-NEXT: # kill: def $al killed $al killed $eax
378 ; X64-MASK-NEXT: retq
380 ; X64-SHIFT-LABEL: test_i8_lshr_lshr_2:
381 ; X64-SHIFT: # %bb.0:
382 ; X64-SHIFT-NEXT: movl %edi, %eax
383 ; X64-SHIFT-NEXT: shlb $5, %al
384 ; X64-SHIFT-NEXT: shrb $3, %al
385 ; X64-SHIFT-NEXT: # kill: def $al killed $al killed $eax
386 ; X64-SHIFT-NEXT: retq
392 define i16 @test_i16_lshr_lshr_0(i16 %a0) {
393 ; X86-LABEL: test_i16_lshr_lshr_0:
395 ; X86-NEXT: movzwl {{[0-9]+}}(%esp), %eax
396 ; X86-NEXT: andl $8191, %eax # imm = 0x1FFF
397 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
400 ; X64-LABEL: test_i16_lshr_lshr_0:
402 ; X64-NEXT: movl %edi, %eax
403 ; X64-NEXT: andl $8191, %eax # imm = 0x1FFF
404 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
411 define i16 @test_i16_lshr_lshr_1(i16 %a0) {
412 ; X86-LABEL: test_i16_lshr_lshr_1:
414 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
415 ; X86-NEXT: shrl $2, %eax
416 ; X86-NEXT: andl $2047, %eax # imm = 0x7FF
417 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
420 ; X64-MASK-LABEL: test_i16_lshr_lshr_1:
422 ; X64-MASK-NEXT: movl %edi, %eax
423 ; X64-MASK-NEXT: shrl $2, %eax
424 ; X64-MASK-NEXT: andl $2047, %eax # imm = 0x7FF
425 ; X64-MASK-NEXT: # kill: def $ax killed $ax killed $eax
426 ; X64-MASK-NEXT: retq
428 ; X64-SHIFT2-LABEL: test_i16_lshr_lshr_1:
429 ; X64-SHIFT2: # %bb.0:
430 ; X64-SHIFT2-NEXT: movl %edi, %eax
431 ; X64-SHIFT2-NEXT: shrl $2, %eax
432 ; X64-SHIFT2-NEXT: andl $2047, %eax # imm = 0x7FF
433 ; X64-SHIFT2-NEXT: # kill: def $ax killed $ax killed $eax
434 ; X64-SHIFT2-NEXT: retq
436 ; X64-TBM-LABEL: test_i16_lshr_lshr_1:
438 ; X64-TBM-NEXT: bextrl $2818, %edi, %eax # imm = 0xB02
439 ; X64-TBM-NEXT: # kill: def $ax killed $ax killed $eax
442 ; X64-BMI-LABEL: test_i16_lshr_lshr_1:
444 ; X64-BMI-NEXT: movl $2818, %eax # imm = 0xB02
445 ; X64-BMI-NEXT: bextrl %eax, %edi, %eax
446 ; X64-BMI-NEXT: # kill: def $ax killed $ax killed $eax
453 define i16 @test_i16_lshr_lshr_2(i16 %a0) {
454 ; X86-LABEL: test_i16_lshr_lshr_2:
456 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
457 ; X86-NEXT: shll $2, %eax
458 ; X86-NEXT: andl $8188, %eax # imm = 0x1FFC
459 ; X86-NEXT: # kill: def $ax killed $ax killed $eax
462 ; X64-LABEL: test_i16_lshr_lshr_2:
464 ; X64-NEXT: # kill: def $edi killed $edi def $rdi
465 ; X64-NEXT: leal (,%rdi,4), %eax
466 ; X64-NEXT: andl $8188, %eax # imm = 0x1FFC
467 ; X64-NEXT: # kill: def $ax killed $ax killed $eax
474 define i32 @test_i32_lshr_lshr_0(i32 %a0) {
475 ; X86-LABEL: test_i32_lshr_lshr_0:
477 ; X86-NEXT: movl $536870911, %eax # imm = 0x1FFFFFFF
478 ; X86-NEXT: andl {{[0-9]+}}(%esp), %eax
481 ; X64-LABEL: test_i32_lshr_lshr_0:
483 ; X64-NEXT: movl %edi, %eax
484 ; X64-NEXT: andl $536870911, %eax # imm = 0x1FFFFFFF
491 define i32 @test_i32_lshr_lshr_1(i32 %a0) {
492 ; X86-LABEL: test_i32_lshr_lshr_1:
494 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
495 ; X86-NEXT: shrl $2, %eax
496 ; X86-NEXT: andl $134217727, %eax # imm = 0x7FFFFFF
499 ; X64-MASK-LABEL: test_i32_lshr_lshr_1:
501 ; X64-MASK-NEXT: movl %edi, %eax
502 ; X64-MASK-NEXT: shrl $2, %eax
503 ; X64-MASK-NEXT: andl $134217727, %eax # imm = 0x7FFFFFF
504 ; X64-MASK-NEXT: retq
506 ; X64-SHIFT-LABEL: test_i32_lshr_lshr_1:
507 ; X64-SHIFT: # %bb.0:
508 ; X64-SHIFT-NEXT: # kill: def $edi killed $edi def $rdi
509 ; X64-SHIFT-NEXT: leal (,%rdi,8), %eax
510 ; X64-SHIFT-NEXT: shrl $5, %eax
511 ; X64-SHIFT-NEXT: retq
517 define i32 @test_i32_lshr_lshr_2(i32 %a0) {
518 ; X86-LABEL: test_i32_lshr_lshr_2:
520 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
521 ; X86-NEXT: shll $2, %eax
522 ; X86-NEXT: andl $536870908, %eax # imm = 0x1FFFFFFC
525 ; X64-MASK-LABEL: test_i32_lshr_lshr_2:
527 ; X64-MASK-NEXT: # kill: def $edi killed $edi def $rdi
528 ; X64-MASK-NEXT: leal (,%rdi,4), %eax
529 ; X64-MASK-NEXT: andl $536870908, %eax # imm = 0x1FFFFFFC
530 ; X64-MASK-NEXT: retq
532 ; X64-SHIFT-LABEL: test_i32_lshr_lshr_2:
533 ; X64-SHIFT: # %bb.0:
534 ; X64-SHIFT-NEXT: movl %edi, %eax
535 ; X64-SHIFT-NEXT: shll $5, %eax
536 ; X64-SHIFT-NEXT: shrl $3, %eax
537 ; X64-SHIFT-NEXT: retq
543 define i64 @test_i64_lshr_lshr_0(i64 %a0) {
544 ; X86-LABEL: test_i64_lshr_lshr_0:
546 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
547 ; X86-NEXT: movl $536870911, %edx # imm = 0x1FFFFFFF
548 ; X86-NEXT: andl {{[0-9]+}}(%esp), %edx
551 ; X64-MASK-LABEL: test_i64_lshr_lshr_0:
553 ; X64-MASK-NEXT: movabsq $2305843009213693951, %rax # imm = 0x1FFFFFFFFFFFFFFF
554 ; X64-MASK-NEXT: andq %rdi, %rax
555 ; X64-MASK-NEXT: retq
557 ; X64-SHIFT2-LABEL: test_i64_lshr_lshr_0:
558 ; X64-SHIFT2: # %bb.0:
559 ; X64-SHIFT2-NEXT: movabsq $2305843009213693951, %rax # imm = 0x1FFFFFFFFFFFFFFF
560 ; X64-SHIFT2-NEXT: andq %rdi, %rax
561 ; X64-SHIFT2-NEXT: retq
563 ; X64-TBM-LABEL: test_i64_lshr_lshr_0:
565 ; X64-TBM-NEXT: bextrq $15616, %rdi, %rax # imm = 0x3D00
568 ; X64-BMI1-LABEL: test_i64_lshr_lshr_0:
570 ; X64-BMI1-NEXT: movl $15616, %eax # imm = 0x3D00
571 ; X64-BMI1-NEXT: bextrq %rax, %rdi, %rax
572 ; X64-BMI1-NEXT: retq
574 ; X64-BMI2-LABEL: test_i64_lshr_lshr_0:
576 ; X64-BMI2-NEXT: movb $61, %al
577 ; X64-BMI2-NEXT: bzhiq %rax, %rdi, %rax
578 ; X64-BMI2-NEXT: retq
584 define i64 @test_i64_lshr_lshr_1(i64 %a0) {
585 ; X86-LABEL: test_i64_lshr_lshr_1:
587 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
588 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
589 ; X86-NEXT: shrdl $2, %edx, %eax
590 ; X86-NEXT: shrl $2, %edx
591 ; X86-NEXT: andl $134217727, %edx # imm = 0x7FFFFFF
594 ; X64-MASK-LABEL: test_i64_lshr_lshr_1:
596 ; X64-MASK-NEXT: shrq $2, %rdi
597 ; X64-MASK-NEXT: movabsq $576460752303423487, %rax # imm = 0x7FFFFFFFFFFFFFF
598 ; X64-MASK-NEXT: andq %rdi, %rax
599 ; X64-MASK-NEXT: retq
601 ; X64-SHIFT-LABEL: test_i64_lshr_lshr_1:
602 ; X64-SHIFT: # %bb.0:
603 ; X64-SHIFT-NEXT: leaq (,%rdi,8), %rax
604 ; X64-SHIFT-NEXT: shrq $5, %rax
605 ; X64-SHIFT-NEXT: retq
611 define i64 @test_i64_lshr_lshr_2(i64 %a0) {
612 ; X86-LABEL: test_i64_lshr_lshr_2:
614 ; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
615 ; X86-NEXT: movl {{[0-9]+}}(%esp), %edx
616 ; X86-NEXT: shldl $2, %eax, %edx
617 ; X86-NEXT: shll $2, %eax
618 ; X86-NEXT: andl $536870911, %edx # imm = 0x1FFFFFFF
621 ; X64-MASK-LABEL: test_i64_lshr_lshr_2:
623 ; X64-MASK-NEXT: leaq (,%rdi,4), %rcx
624 ; X64-MASK-NEXT: movabsq $2305843009213693948, %rax # imm = 0x1FFFFFFFFFFFFFFC
625 ; X64-MASK-NEXT: andq %rcx, %rax
626 ; X64-MASK-NEXT: retq
628 ; X64-SHIFT-LABEL: test_i64_lshr_lshr_2:
629 ; X64-SHIFT: # %bb.0:
630 ; X64-SHIFT-NEXT: movq %rdi, %rax
631 ; X64-SHIFT-NEXT: shlq $5, %rax
632 ; X64-SHIFT-NEXT: shrq $3, %rax
633 ; X64-SHIFT-NEXT: retq