summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorMichael Ilseman <milseman@apple.com>2012-11-29 21:25:12 +0000
committerMichael Ilseman <milseman@apple.com>2012-11-29 21:25:12 +0000
commit4b896dd613b1d85ee1b261ee470cb72fab24c282 (patch)
treeb82cd633db6da677fc430fe61787c0085bbe0937 /unittests
parente8832680f8b7a052bd77751d616d41a20d8bacb1 (diff)
downloadexternal_llvm-4b896dd613b1d85ee1b261ee470cb72fab24c282.zip
external_llvm-4b896dd613b1d85ee1b261ee470cb72fab24c282.tar.gz
external_llvm-4b896dd613b1d85ee1b261ee470cb72fab24c282.tar.bz2
copyFastMathFlags utility and test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168943 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/VMCore/IRBuilderTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/unittests/VMCore/IRBuilderTest.cpp b/unittests/VMCore/IRBuilderTest.cpp
index 8a22b10..665cfb3 100644
--- a/unittests/VMCore/IRBuilderTest.cpp
+++ b/unittests/VMCore/IRBuilderTest.cpp
@@ -164,6 +164,15 @@ TEST_F(IRBuilderTest, FastMathFlags) {
FDiv = cast<Instruction>(F);
EXPECT_TRUE(FDiv->hasAllowReciprocal());
+ Builder.clearFastMathFlags();
+
+ F = Builder.CreateFDiv(F, F);
+ ASSERT_TRUE(isa<Instruction>(F));
+ FDiv = cast<Instruction>(F);
+ EXPECT_FALSE(FDiv->getFastMathFlags().any());
+ FDiv->copyFastMathFlags(FAdd);
+ EXPECT_TRUE(FDiv->hasNoNaNs());
+
}
}