[llvm-commits] [PATCH] Aggressive FMA formation mode.

Lang Hames lhames at gmail.com
Mon Jun 18 20:41:56 PDT 2012


Hi All,

Attached is a patch to aggressively form FMAs from pairs of mul+add and
mul+sub instructions during DAG combine. It forms these instructions when:
(a) AllowExcessFPPrecision is true*.
(b) FMA is legal for the target.
(c) FMA is cheaper than a separate mul and add.

* I've hijacked and renamed "DisableExcessFPPrecision" for this patch (new
llc command line option: -enable-excess-fp-precision). The comments for
that DisableExcessFPPrecision suggest that this was its intended purpose.
Under my patch the option still defaults to false, so aggressive FMA
formation is now OFF by default. Previously the ARM and PPC targets had
been forming FMAs aggressively where the instructions were available (at
least on non-Darwin platforms).

Does anybody have any comments or suggestions? Otherwise I'll commit
shortly.

Hal - I've updated the guards on FMA formation for PPC, but by default FMAs
will no longer be formed. If this is a problem, would it be possible to
have your FMA-formation guard rely on a PPC specific "disable-FMA" option?
I'd like to keep AllowExcessFPPrecision as the guard for target independent
FMA formation, and that should be off by default.

- Lang.

p.s Will be adding a clang command line option for this just as soon as I
work out what to call it. Taking suggestions...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120618/6704e85d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: aggressive_fma_formation.patch
Type: application/octet-stream
Size: 8254 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120618/6704e85d/attachment.obj>


More information about the llvm-commits mailing list