[cfe-commits] [PATCH] Add llvm.fmuladd intrinsic.

Stephen Canon scanon at apple.com
Tue May 29 17:15:56 PDT 2012


+<p>The '<tt>llvm.fmuladd.*</tt>' intrinsic functions represent multiply-add
+expressions that can be fused if the code generator determines that the fused
+expression would be legal and efficient.</p>

the llvm.fmuladd.* intrinsic is itself a guarantee that the fused expression would be legal.  This should simply say "... that the fused expression would be efficient."

- Steve

On May 29, 2012, at 8:11 PM, Lang Hames <lhames at gmail.com> wrote:

> Hi All,
> I guess it's better to CC both lists, rather than have parallel feedback on these patches - so for the Clang people who haven't seen this yet:
> I want to improve Clang/LLVM's support for the fp_contract pragma. (Background: when the fp_contract pragma is ON, multiplications and additions within expressions can be fused to FMAs. This is a performance win on targets that have a fast fma instruction.)
> As a step towards implementing this functionality, these patches add a new family of intrinsics, llvm.fmuladd.*, that represent mul+add expressions that can be fused. Clang will emit calls to these intrinsics when it sees a mul+add in a single source expression and fp_contract is ON. During LLVM isel, the legalizer will check the Subtarget::isFMACheap() method to decide whether to lower these intrinsics to llvm.fma.* intrinsic calls, or a regular unfused mul and add expression.
> The attached clang patch adds a per-function flag to FunctionDecl that records the state of the fp_contract pragma when each function is defined, and passes this information down to codegen. Clang codegen can then emit calls to the new llvm.fmuladd intrinsic, instead of plain mul + add instructions.
> Does anybody have any objections to the proposed scheme? If not I'll go ahead and commit these.
> Cheers,
> Lang.
> <llvm_fmuladd_intrinsic.patch><clang-fp-contract-fmuladd-codgen.patch>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

More information about the cfe-commits mailing list