Skip to content

Commit 2415959

Browse files
committedSep 22, 2019
[NFC][X86] Add BEXTR test with load and 33-bit mask (PR43381 / D67875)
llvm-svn: 372524
1 parent a1d8685 commit 2415959

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
 

‎llvm/test/CodeGen/X86/bmi-x86_64.ll

+29
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,35 @@ entry:
102102
ret i64 %and
103103
}
104104

105+
define i64 @bextr64d_load(i64* %aptr) {
106+
; BMI1-SLOW-LABEL: bextr64d_load:
107+
; BMI1-SLOW: # %bb.0: # %entry
108+
; BMI1-SLOW-NEXT: movq (%rdi), %rax
109+
; BMI1-SLOW-NEXT: shrq $2, %rax
110+
; BMI1-SLOW-NEXT: movl $8448, %ecx # imm = 0x2100
111+
; BMI1-SLOW-NEXT: bextrq %rcx, %rax, %rax
112+
; BMI1-SLOW-NEXT: retq
113+
;
114+
; BMI2-SLOW-LABEL: bextr64d_load:
115+
; BMI2-SLOW: # %bb.0: # %entry
116+
; BMI2-SLOW-NEXT: movq (%rdi), %rax
117+
; BMI2-SLOW-NEXT: shrq $2, %rax
118+
; BMI2-SLOW-NEXT: movb $33, %cl
119+
; BMI2-SLOW-NEXT: bzhiq %rcx, %rax, %rax
120+
; BMI2-SLOW-NEXT: retq
121+
;
122+
; BEXTR-FAST-LABEL: bextr64d_load:
123+
; BEXTR-FAST: # %bb.0: # %entry
124+
; BEXTR-FAST-NEXT: movl $8450, %eax # imm = 0x2102
125+
; BEXTR-FAST-NEXT: bextrq %rax, (%rdi), %rax
126+
; BEXTR-FAST-NEXT: retq
127+
entry:
128+
%a = load i64, i64* %aptr, align 8
129+
%shr = lshr i64 %a, 2
130+
%and = and i64 %shr, 8589934591
131+
ret i64 %and
132+
}
133+
105134
define i64 @non_bextr64(i64 %x) {
106135
; CHECK-LABEL: non_bextr64:
107136
; CHECK: # %bb.0: # %entry

0 commit comments

Comments
 (0)