[X86] Add BZHI test case for PR48768

D94856 covered the BMI cases where we had existing tests, this adds a missing BZHI test case
This commit is contained in:
Simon Pilgrim 2021-04-07 11:20:55 +01:00
parent 43637c0dfe
commit a7eb6b00e9
1 changed files with 21 additions and 0 deletions

View File

@ -38,6 +38,27 @@ define i32 @bzhi32_load(i32* %x, i32 %y) {
ret i32 %tmp
}
; FIXME: PR48768 - 'bzhi' clears the overflow flag, so we don't need a separate 'test'.
define i1 @bzhi32_overflow(i32 %x, i32 %y) {
; X86-LABEL: bzhi32_overflow:
; X86: # %bb.0:
; X86-NEXT: movl {{[0-9]+}}(%esp), %eax
; X86-NEXT: bzhil %eax, {{[0-9]+}}(%esp), %eax
; X86-NEXT: testl %eax, %eax
; X86-NEXT: setle %al
; X86-NEXT: retl
;
; X64-LABEL: bzhi32_overflow:
; X64: # %bb.0:
; X64-NEXT: bzhil %esi, %edi, %eax
; X64-NEXT: testl %eax, %eax
; X64-NEXT: setle %al
; X64-NEXT: retq
%tmp = tail call i32 @llvm.x86.bmi.bzhi.32(i32 %x, i32 %y)
%cmp = icmp slt i32 %tmp, 1
ret i1 %cmp
}
declare i32 @llvm.x86.bmi.bzhi.32(i32, i32)
define i32 @pdep32(i32 %x, i32 %y) {