[PATCH] D85504: [Reassociate] [PowerPC] stop common out mul factors if fma is preferred on target
ChenZheng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 7 00:29:48 PDT 2020
shchenz created this revision.
shchenz added reviewers: lebedev.ri, spatel, efriedma, qcolombet, Whitney, jsji, PowerPC.
Herald added subscribers: llvm-commits, steven.zhang, wuzish, kbarton, hiraditya, nemanjai.
Herald added a project: LLVM.
shchenz requested review of this revision.
This patch tries to stop common out mul factors if fma is preferred on target.
For the case A * B + A * C, transform it to A * (B + C) has no benefit at all on PowerPC target. In fact, if target prefers fma, then it now generates worse IR.
On PowerPC target:
A * B + A * C can be generated as fma(fmul(a,b), b, c);
A * (B + C) can be generated as fmul(a, fadd(b, c));
`fma`, `fmul`, `fadd`, `fsub` all have same latency on PowerPC arch.
Bailing out this opt early to expose more fma folding opportunities and save some compile time on PowerPC target.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D85504
Files:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/Analysis/TargetTransformInfoImpl.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/include/llvm/Transforms/Scalar/Reassociate.h
llvm/lib/Analysis/TargetTransformInfo.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.cpp
llvm/lib/Target/PowerPC/PPCISelLowering.h
llvm/lib/Transforms/Scalar/Reassociate.cpp
llvm/test/Transforms/Reassociate/PowerPC/lit.local.cfg
llvm/test/Transforms/Reassociate/PowerPC/prefer-fma.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85504.283826.patch
Type: text/x-patch
Size: 11100 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200807/d5f2769c/attachment.bin>
More information about the llvm-commits
mailing list