Optionally enable more-aggressive FMA formation in DAGCombine
authorHal Finkel <hfinkel@anl.gov>
Fri, 19 Sep 2014 11:42:56 +0000 (11:42 +0000)
committerHal Finkel <hfinkel@anl.gov>
Fri, 19 Sep 2014 11:42:56 +0000 (11:42 +0000)
commitc404e8208cf90eb12ec9f7c11ab94f8e63a9bea3
treed87bb1eac2f4b242f898b0fb58300410639d2085
parent89436b4160f6a7d203fceec94db8cdca9b4290d3
Optionally enable more-aggressive FMA formation in DAGCombine

The heuristic used by DAGCombine to form FMAs checks that the FMUL has only one
use, but this is overly-conservative on some systems. Specifically, if the FMA
and the FADD have the same latency (and the FMA does not compete for resources
with the FMUL any more than the FADD does), there is no need for the
restriction, and furthermore, forming the FMA leaving the FMUL can still allow
for higher overall throughput and decreased critical-path length.

Here we add a new TLI callback, enableAggressiveFMAFusion, false by default, to
elide the hasOneUse check. This is enabled for PowerPC by default, as most
PowerPC systems will benefit.

Patch by Olivier Sallenave, thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218120 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/PowerPC/PPCISelLowering.cpp
lib/Target/PowerPC/PPCISelLowering.h
test/CodeGen/PowerPC/fma.ll