aboutsummaryrefslogtreecommitdiff
path: root/lib/VMCore/Instructions.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-05-03 16:50:55 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-05-03 16:50:55 +0000
commitb61ab53cb789e568acbb2952fbead20ab853a696 (patch)
tree8575c732129e272992ac5d7b4c2519238fff4735 /lib/VMCore/Instructions.cpp
parent63faed5b8e4f2755f127fcb8aa440480c0649327 (diff)
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r--lib/VMCore/Instructions.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp
index 8db6ac9a33f4..6c5db3287641 100644
--- a/lib/VMCore/Instructions.cpp
+++ b/lib/VMCore/Instructions.cpp
@@ -2003,6 +2003,23 @@ bool BinaryOperator::isExact() const {
}
//===----------------------------------------------------------------------===//
+// FPMathOperator Class
+//===----------------------------------------------------------------------===//
+
+/// getFPAccuracy - Get the maximum error permitted by this operation in ULPs.
+/// An accuracy of 0.0 means that the operation should be performed with the
+/// default precision.
+float FPMathOperator::getFPAccuracy() const {
+ const MDNode *MD =
+ cast<Instruction>(this)->getMetadata(LLVMContext::MD_fpmath);
+ if (!MD)
+ return 0.0;
+ ConstantFP *Accuracy = cast<ConstantFP>(MD->getOperand(0));
+ return Accuracy->getValueAPF().convertToFloat();
+}
+
+
+//===----------------------------------------------------------------------===//
// CastInst Class
//===----------------------------------------------------------------------===//