[LLVMdev] Documentation of fmuladd intrinsic

dag at cray.com dag at cray.com
Fri Jan 11 12:12:01 PST 2013


Hal Finkel <hfinkel at anl.gov> writes:

> There are a few conditions that contribute to the decision of whether
> or not to make the fmuladd -> fma translation. The relevant code is in
> CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:
>
>   case Intrinsic::fmuladd: {
>     EVT VT = TLI.getValueType(I.getType());
>     if (TM.Options.AllowFPOpFusion != FPOpFusion::Strict &&
>         TLI.isOperationLegal(ISD::FMA, VT) &&
>         TLI.isFMAFasterThanMulAndAdd(VT)){
>
>        [ use FMA ]
>     } else {
>        [ use MUL + ADD ]
>     }

We've written a few TableGen patterns here locally to match FMA and
added a predicate to say in effect TM.Options.AllowFPOpFusion !=
FPOpFusion::Strict.  So that's another way to proceed.

In general, I prefer TableGen patterns over manual lowering.

                               -David



More information about the llvm-dev mailing list