Skip to content

Commit a7eb6b0

Browse files
committed
[X86] Add BZHI test case for PR48768
D94856 covered the BMI cases where we had existing tests, this adds a missing BZHI test case
1 parent 43637c0 commit a7eb6b0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

llvm/test/CodeGen/X86/bmi2.ll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,27 @@ define i32 @bzhi32_load(i32* %x, i32 %y) {
3838
ret i32 %tmp
3939
}
4040

41+
; FIXME: PR48768 - 'bzhi' clears the overflow flag, so we don't need a separate 'test'.
42+
define i1 @bzhi32_overflow(i32 %x, i32 %y) {
43+
; X86-LABEL: bzhi32_overflow:
44+
; X86: # %bb.0:
45+
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
46+
; X86-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax
47+
; X86-NEXT: testl %eax, %eax
48+
; X86-NEXT: setle %al
49+
; X86-NEXT: retl
50+
;
51+
; X64-LABEL: bzhi32_overflow:
52+
; X64: # %bb.0:
53+
; X64-NEXT: bzhil %esi, %edi, %eax
54+
; X64-NEXT: testl %eax, %eax
55+
; X64-NEXT: setle %al
56+
; X64-NEXT: retq
57+
%tmp = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %x, i32 %y)
58+
%cmp = icmp slt i32 %tmp, 1
59+
ret i1 %cmp
60+
}
61+
4162
declare i32 @llvm.x86.bmi.bzhi.32(i32, i32)
4263

4364
define i32 @pdep32(i32 %x, i32 %y) {

0 commit comments

Comments
 (0)