[PATCH] D128769: [DAGCombiner] Fold sra (sub AddC, (shl X, N1C)), N1C --> sext (sub AddC1',(trunc X to (width - N1C)))
Craig Topper via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 28 16:22:34 PDT 2022
craig.topper created this revision.
craig.topper added reviewers: RKSimon, spatel.
Herald added subscribers: jsji, StephenFan, ecnelises, pengfei, hiraditya.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added a project: LLVM.
We already handled this case for add with a constant RHS. A
similar pattern can occur for sub with a constant left hand side.
Test cases use add and a mul representing (neg (shl X, C)) because
that's what I saw in the wild. The mul will be decomposed and then
the new transform can kick in.
Tests have not been committed, but this patch shows the changes.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D128769
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/test/CodeGen/X86/shift-combine.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128769.440805.patch
Type: text/x-patch
Size: 7294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220628/15460144/attachment.bin>
More information about the llvm-commits
mailing list