[PATCH] D88201: [PowerPC] Add patterns for Mul-by-Imm in DAGCombiner.
EsmeYi via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 00:54:33 PDT 2020
Esme created this revision.
Esme added reviewers: jsji, nemanjai, steven.zhang, PowerPC.
Herald added subscribers: llvm-commits, ecnelises, shchenz, kbarton, hiraditya.
Herald added a project: LLVM.
Esme requested review of this revision.
This patch is derived from D87384 <https://reviews.llvm.org/D87384>.
In this patch we expand the existing decomposition of mul-by-constant to be more general by implementing 2 patterns:
mul x, (2^N + 2^M) --> (add (shl x, N), (shl x, M))
mul x, (2^N - 2^M) --> (sub (shl x, N), (shl x, M))
The conversion will be trigged if the multiplier is a big constant that the target can't use a single multiplication instruction to handle. This is controlled by the hook `decomposeMulByConstant`.
More over, the conversion benefits from an ILP improvement since the instructions are independent. A case with the sequence like following also gets benefit since a shift instruction is saved.
*res1 = a * 0x8800;
*res2 = a * 0x8080;
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88201
Files:
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/test/CodeGen/PowerPC/mulli.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88201.293952.patch
Type: text/x-patch
Size: 7582 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200924/1ff4245c/attachment.bin>
More information about the llvm-commits
mailing list