diff options
author | dim <dim@FreeBSD.org> | 2012-05-03 16:50:55 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-05-03 16:50:55 +0000 |
commit | 2c5e9d71aba3b1a85f07c08d2c09d40b8547264b (patch) | |
tree | 8575c732129e272992ac5d7b4c2519238fff4735 /lib/VMCore/Instructions.cpp | |
parent | 1fc08f5e9ef733ef1ce6f363fecedc2260e78974 (diff) | |
download | FreeBSD-src-2c5e9d71aba3b1a85f07c08d2c09d40b8547264b.zip FreeBSD-src-2c5e9d71aba3b1a85f07c08d2c09d40b8547264b.tar.gz |
Vendor import of llvm release_31 branch r155985:
http://llvm.org/svn/llvm-project/llvm/branches/release_31@155985
Diffstat (limited to 'lib/VMCore/Instructions.cpp')
-rw-r--r-- | lib/VMCore/Instructions.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/VMCore/Instructions.cpp b/lib/VMCore/Instructions.cpp index 8db6ac9..6c5db32 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 //===----------------------------------------------------------------------===// |