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

Lang Hames lhames at gmail.com
Tue May 29 17:03:05 PDT 2012


Hi All,

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, this patch adds a new
family of intrinsics, llvm.fmuladd.*, that represent mul+add expressions
that can be fused. The frontend will emit calls to these intrinsics when it
sees a mul+add in a single source expression and fp_contract is ON (I'll
mail a patch for this functionality to cfe-commits in a minute). During
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.

I haven't taught the optimizers to reason about these expressions yet -
that's coming next. For now I just wanted to see if anyone had any
objections to the proposed scheme. If not I'll go ahead and commit.

Cheers,
Lang.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120529/19ca8e54/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm_fmuladd_intrinsic.patch
Type: application/octet-stream
Size: 6807 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120529/19ca8e54/attachment.obj>


More information about the llvm-commits mailing list