From 30d8fb4deba57488725547f2a3ca5f517943bcc4 Mon Sep 17 00:00:00 2001
From: Lang Hames
Date: Tue, 5 Jun 2012 19:07:46 +0000
Subject: [PATCH] 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.
llvm-svn: 158014
---
docs/LangRef.html | 51 +++++++++++++++++++
include/llvm/Intrinsics.td | 4 ++
include/llvm/Target/TargetLowering.h | 8 +++
.../SelectionDAG/SelectionDAGBuilder.cpp | 21 ++++++++
4 files changed, 84 insertions(+)
diff --git a/docs/LangRef.html b/docs/LangRef.html
index 1f43ab67f24..f13f13909bc 100644
--- a/docs/LangRef.html
+++ b/docs/LangRef.html
@@ -277,6 +277,11 @@
'llvm.umul.with.overflow.* Intrinsics
+ Specialised Arithmetic Intrinsics
+
+ - 'llvm.fmuladd Intrinsic
+
+
Half Precision Floating Point Intrinsics
- 'llvm.convert.to.fp16' Intrinsic
@@ -7945,6 +7950,52 @@ LLVM.
+
+
+
+
Syntax:
+
+ declare float @llvm.fmuladd.f32(float %a, float %b, float %c)
+ declare double @llvm.fmuladd.f64(double %a, double %b, double %c)
+
+
+
Overview:
+
The 'llvm.fmuladd.*' intrinsic functions represent multiply-add
+expressions that can be fused if the code generator determines that the fused
+expression would be legal and efficient.
+
+
Arguments:
+
The 'llvm.fmuladd.*' intrinsics each take three arguments: two
+multiplicands, a and b, and an addend c.
+
+
Semantics:
+
The expression:
+
+ %0 = call float @llvm.fmuladd.f32(%a, %b, %c)
+
+
is equivalent to the expression a * b + c, except that rounding will not be
+performed between the multiplication and addition steps if the code generator
+fuses the operations. Fusion is not guaranteed, even if the target platform
+supports it. If a fused multiply-add is required the corresponding llvm.fma.*
+intrinsic function should be used instead.
+
+
Examples:
+
+ %r2 = call float @llvm.fmuladd.f32(float %a, float %b, float %c) ; yields {float}:r2 = (a * b) + c
+
+
+
+