[PATCH] D48491: [X86] Select BEXTR when there is only BMI1.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 25 05:22:56 PDT 2018


lebedev.ri added a comment.

In https://reviews.llvm.org/D48491#1141822, @craig.topper wrote:

> Matching multiple nodes in isel patterns without one use checks and then emitting multiple instructions for the pattern seems like dangerous territory.
>  Is there more canonicalizing we should be doing in DAG combines to get these sequences into a form we can handle in isel?


The `BEXTR` <https://www.felixcloutier.com/x86/BEXTR.html> is older, 'more powerful' version of `BZHI` <https://www.felixcloutier.com/x86/BZHI.html>.
It takes destination reg, source reg/mem, but unlike `BZHI` <https://www.felixcloutier.com/x86/BZHI.html>,
it does not take just the starting bit from which to zero out.
It actually *extracts* the bits. Meaning, it also requires
the knowledge about the bit starting from which to extract.
But unfortunately, it still takes only one parameter - control.
And the control is basically a packed structure with 2 8-bit fields:

- `0..7` (starting with low bits) - starting position for extraction
- `8..15` - specifies the number of bits to extract.

So we need to pass the len in `8..15` bits. It has to get there somehow.
So no, i'm not seeing how we can avoid that via canonicalization :/


Repository:
  rL LLVM

https://reviews.llvm.org/D48491





More information about the llvm-commits mailing list