[llvm-dev] AArch64 fmul/fadd fusion

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Sun Sep 20 19:37:31 PDT 2015


>> We support them via various flags (-ffast-math is the obvious one,
>> though an argument could be made for supporting -mfused-madd and
>> -mnofused-madd as well). But in the backend we definitely have to
>> check *somthing* before doing the substitution.
>
> Support in what way?  I don't see any patterns or machine combiners
> to do the above replacement.  Did I miss something?

(Having just checked lib/CodeGen/SelectionDAG) I believe it's mostly
covered before target-specific code gets involved, in the generic DAG
logic at the moment. ISD::FMA nodes should only be formed from paired
mul/add based on "AllowFPOpFusion" checks (and other similar explicit
permissions).

So I think the status quo is that generic code does any permissible
fusion, and AArch64 code really doesn't have any freedom to fuse more
operations on top of that.

> If I didn't miss something, is there interest in adding this to the AArch64
> machine combiners assuming it was guarded by the right flag?

If you can find a missing-but-allowed case, adding it to the generic
handling would probably be better than making it AArch64 only.

Cheers.

Tim.


More information about the llvm-dev mailing list