diff options
author | Jessica Paquette <jpaquette@apple.com> | 2021-03-11 15:36:01 -0800 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2021-03-19 14:37:19 -0700 |
commit | 4773dd5ba9993e127586a5e5b1993d431a47372c (patch) | |
tree | 9d27b8eeed9b30089592705880f39ac83577f5e2 /llvm/lib/Transforms/Scalar/LoopPassManager.cpp | |
parent | cde203e0f9438a4bba3b9b50bd437444852b9909 (diff) | |
download | llvm-4773dd5ba9993e127586a5e5b1993d431a47372c.zip llvm-4773dd5ba9993e127586a5e5b1993d431a47372c.tar.gz llvm-4773dd5ba9993e127586a5e5b1993d431a47372c.tar.bz2 |
[GlobalISel] Add G_SBFX + G_UBFX (bitfield extraction opcodes)
There is a bunch of similar bitfield extraction code throughout *ISelDAGToDAG.
E.g, ARMISelDAGToDAG, AArch64ISelDAGToDAG, and AMDGPUISelDAGToDAG all contain
code that matches a bitfield extract from an and + right shift.
Rather than duplicating code in the same way, this adds two opcodes:
- G_UBFX (unsigned bitfield extract)
- G_SBFX (signed bitfield extract)
They work like this
```
%x = G_UBFX %y, %lsb, %width
```
Where `lsb` and `width` are
- The least-significant bit of the extraction
- The width of the extraction
This will extract `width` bits from `%y`, starting at `lsb`. G_UBFX zero-extends
the result, while G_SBFX sign-extends the result.
This should allow us to use the combiner to match the bitfield extraction
patterns rather than duplicating pattern-matching code in each target.
Differential Revision: https://reviews.llvm.org/D98464
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPassManager.cpp')
0 files changed, 0 insertions, 0 deletions