[llvm] a7eb6b0 - [X86] Add BZHI test case for PR48768

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 03:38:56 PDT 2021


Author: Simon Pilgrim
Date: 2021-04-07T11:38:47+01:00
New Revision: a7eb6b00e934befae9e8e49803ae6621b27be604

URL: https://github.com/llvm/llvm-project/commit/a7eb6b00e934befae9e8e49803ae6621b27be604
DIFF: https://github.com/llvm/llvm-project/commit/a7eb6b00e934befae9e8e49803ae6621b27be604.diff

LOG: [X86] Add BZHI test case for PR48768

D94856 covered the BMI cases where we had existing tests, this adds a missing BZHI test case

Added: 
    

Modified: 
    llvm/test/CodeGen/X86/bmi2.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/CodeGen/X86/bmi2.ll b/llvm/test/CodeGen/X86/bmi2.ll
index 0990d3265144..0b3a415a18ee 100644
--- a/llvm/test/CodeGen/X86/bmi2.ll
+++ b/llvm/test/CodeGen/X86/bmi2.ll
@@ -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)   {


        


More information about the llvm-commits mailing list