[PATCH] D141204: [GlobalISel] Extending G_SBFX/G_UBFX combine to consider G_SEXT_INREG as well
David Ferenc Szabo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Jan 7 11:46:55 PST 2023
DavidFerencSzabo created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
DavidFerencSzabo requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently simple C code like
typedef struct { int a:1; int b:4; int c:3; } s_t;
int f(s_t s) { return s.b; }
will produce the following assembly with O3 <https://reviews.llvm.org/owners/package/3/>
lsl w8, w0, #3
sxtb w8, w8
sbfx w0, w8, #4, #8
ret
while GCC produce this
sbfx x0, x0, 1, 4
ret
Extended the implementation of matchBitfieldExtractFromShr to consider cases where the shifts fed to a G_SEXT_INREG.
Extended the implementation of matchRedundantSExtInReg to ignore G_SEXT_INREG instruction if the source is a G_SBFX.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D141204
Files:
llvm/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
llvm/test/CodeGen/AArch64/GlobalISel/combine-sext-inreg-sbfx.mir
llvm/test/CodeGen/AArch64/GlobalISel/form-bitfield-extract-from-shr.mir
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141204.487114.patch
Type: text/x-patch
Size: 6373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/c7d59403/attachment.bin>
More information about the llvm-commits
mailing list