[llvm] r372524 - [NFC][X86] Add BEXTR test with load and 33-bit mask (PR43381 / D67875)

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 22 12:36:38 PDT 2019


Author: lebedevri
Date: Sun Sep 22 12:36:38 2019
New Revision: 372524

URL: http://llvm.org/viewvc/llvm-project?rev=372524&view=rev
Log:
[NFC][X86] Add BEXTR test with load and 33-bit mask (PR43381 / D67875)

Modified:
    llvm/trunk/test/CodeGen/X86/bmi-x86_64.ll

Modified: llvm/trunk/test/CodeGen/X86/bmi-x86_64.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/bmi-x86_64.ll?rev=372524&r1=372523&r2=372524&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/bmi-x86_64.ll (original)
+++ llvm/trunk/test/CodeGen/X86/bmi-x86_64.ll Sun Sep 22 12:36:38 2019
@@ -102,6 +102,35 @@ entry:
   ret i64 %and
 }
 
+define i64 @bextr64d_load(i64* %aptr) {
+; BMI1-SLOW-LABEL: bextr64d_load:
+; BMI1-SLOW:       # %bb.0: # %entry
+; BMI1-SLOW-NEXT:    movq (%rdi), %rax
+; BMI1-SLOW-NEXT:    shrq $2, %rax
+; BMI1-SLOW-NEXT:    movl $8448, %ecx # imm = 0x2100
+; BMI1-SLOW-NEXT:    bextrq %rcx, %rax, %rax
+; BMI1-SLOW-NEXT:    retq
+;
+; BMI2-SLOW-LABEL: bextr64d_load:
+; BMI2-SLOW:       # %bb.0: # %entry
+; BMI2-SLOW-NEXT:    movq (%rdi), %rax
+; BMI2-SLOW-NEXT:    shrq $2, %rax
+; BMI2-SLOW-NEXT:    movb $33, %cl
+; BMI2-SLOW-NEXT:    bzhiq %rcx, %rax, %rax
+; BMI2-SLOW-NEXT:    retq
+;
+; BEXTR-FAST-LABEL: bextr64d_load:
+; BEXTR-FAST:       # %bb.0: # %entry
+; BEXTR-FAST-NEXT:    movl $8450, %eax # imm = 0x2102
+; BEXTR-FAST-NEXT:    bextrq %rax, (%rdi), %rax
+; BEXTR-FAST-NEXT:    retq
+entry:
+  %a = load i64, i64* %aptr, align 8
+  %shr = lshr i64 %a, 2
+  %and = and i64 %shr, 8589934591
+  ret i64 %and
+}
+
 define i64 @non_bextr64(i64 %x) {
 ; CHECK-LABEL: non_bextr64:
 ; CHECK:       # %bb.0: # %entry




More information about the llvm-commits mailing list