aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineCombiner.cpp
diff options
context:
space:
mode:
authorAnton Sidorenko <anton.sidorenko@syntacore.com>2022-10-11 11:36:53 +0300
committerAnton Sidorenko <anton.sidorenko@syntacore.com>2022-11-17 13:24:04 +0300
commitb6c790736e77f79e819fa761fb13f2311296714a (patch)
tree7ea2e5041f26e04e284b4c9bd5bbaa890a75c8d2 /llvm/lib/CodeGen/MachineCombiner.cpp
parent50f8eb05af50904e740088385ec54aae017467e8 (diff)
downloadllvm-b6c790736e77f79e819fa761fb13f2311296714a.zip
llvm-b6c790736e77f79e819fa761fb13f2311296714a.tar.gz
llvm-b6c790736e77f79e819fa761fb13f2311296714a.tar.bz2
[MachineCombiner][RISCV] Add fmadd/fmsub/fnmsub instructions patterns
This patch adds tranformation of fmul+fadd/fsub chains to fused multiply instructions: * fmul+fadd->fmadd * fmul+fsub->fmsub/fnmsub We also will try to combine these instructions if the fmul has more than one use and cannot be deleted. However, removing the dependence between fmul and fadd can still be profitable, and we rely on machine combiner approximations of scheduling. Differential Revision: https://reviews.llvm.org/D136764
Diffstat (limited to 'llvm/lib/CodeGen/MachineCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineCombiner.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/MachineCombiner.cpp b/llvm/lib/CodeGen/MachineCombiner.cpp
index ed0fe7d..bced97f7 100644
--- a/llvm/lib/CodeGen/MachineCombiner.cpp
+++ b/llvm/lib/CodeGen/MachineCombiner.cpp
@@ -319,6 +319,10 @@ static CombinerObjective getCombinerObjective(MachineCombinerPattern P) {
case MachineCombinerPattern::REASSOC_XMM_AMM_BMM:
case MachineCombinerPattern::SUBADD_OP1:
case MachineCombinerPattern::SUBADD_OP2:
+ case MachineCombinerPattern::FMADD_AX:
+ case MachineCombinerPattern::FMADD_XA:
+ case MachineCombinerPattern::FMSUB:
+ case MachineCombinerPattern::FNMSUB:
return CombinerObjective::MustReduceDepth;
case MachineCombinerPattern::REASSOC_XY_BCA:
case MachineCombinerPattern::REASSOC_XY_BAC: