From 5afba6f00c3e2eef83aebbcff5fcfca2fa3c978e Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Tue, 5 Jun 2012 19:07:46 +0000 Subject: Add a new intrinsic: llvm.fmuladd. This intrinsic represents a multiply-add expression (a * b + c) that can be implemented as a fused multiply-add (fma) if the target determines that this will be more efficient. This intrinsic will be used to implement FP_CONTRACT support and an aggressive FMA formation mode. If your target has a fast FMA instruction you should override the isFMAFasterThanMulAndAdd method in TargetLowering to return true. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158014 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Intrinsics.td | 4 ++++ include/llvm/Target/TargetLowering.h | 8 ++++++++ 2 files changed, 12 insertions(+) (limited to 'include/llvm') diff --git a/include/llvm/Intrinsics.td b/include/llvm/Intrinsics.td index 01d2cca..e2be4c4 100644 --- a/include/llvm/Intrinsics.td +++ b/include/llvm/Intrinsics.td @@ -266,6 +266,10 @@ let Properties = [IntrNoMem] in { def int_fma : Intrinsic<[llvm_anyfloat_ty], [LLVMMatchType<0>, LLVMMatchType<0>, LLVMMatchType<0>]>; + + def int_fmuladd : Intrinsic<[llvm_anyfloat_ty], + [LLVMMatchType<0>, LLVMMatchType<0>, + LLVMMatchType<0>]>; } // NOTE: these are internal interfaces. diff --git a/include/llvm/Target/TargetLowering.h b/include/llvm/Target/TargetLowering.h index 27447b5..915dd9d 100644 --- a/include/llvm/Target/TargetLowering.h +++ b/include/llvm/Target/TargetLowering.h @@ -1657,6 +1657,14 @@ public: return false; } + /// isFMAFasterThanMulAndAdd - Return true if an FMA operation is faster than + /// a pair of mul and add instructions. fmuladd intrinsics will be expanded to + /// FMAs when this method returns true (and FMAs are legal), otherwise fmuladd + /// is expanded to mul + add. + virtual bool isFMAFasterThanMulAndAdd(EVT) const { + return false; + } + /// isNarrowingProfitable - Return true if it's profitable to narrow /// operations of type VT1 to VT2. e.g. on x86, it's profitable to narrow /// from i32 to i8 but not from i32 to i16. -- cgit v1.1