[PATCH] D52348: [X86][BMI1]: X86DAGToDAGISel: select BEXTR from x & ((1 << nbits) + (-1)) pattern

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 22 04:17:01 PDT 2018


lebedev.ri added inline comments.


================
Comment at: test/CodeGen/X86/extract-bits.ll:85
+; X64-BMI1NOTBM-NEXT:    shll $8, %edx
+; X64-BMI1NOTBM-NEXT:    bextrl %edx, %edi, %eax
 ; X64-BMI1NOTBM-NEXT:    retq
----------------
RKSimon wrote:
> Could we not do this?
> ```
> shll $8, %edx
> orl %esi, %edx
> bextrl %edx, %edi, %eax
> ```
> Or are there concerns about overflows etc?
That's the idea, there is a TODO in the code about it.
I want to finish with the other 2 patterns before looking into that.

I *think* it should be safe to do, *if* it was `lshr`, not `ashr`, since
https://www.felixcloutier.com/x86/BEXTR.html
> The destination register is cleared if no bits are extracted.


Repository:
  rL LLVM

https://reviews.llvm.org/D52348





More information about the llvm-commits mailing list