mirror of
https://github.com/RPCSX/llvm.git
synced 2025-02-03 02:53:06 +00:00
Whoops, fixed bad merge
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168816 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9eec659952
commit
3d15a91777
@ -111,61 +111,6 @@ TEST_F(IRBuilderTest, GetIntTy) {
|
||||
EXPECT_EQ(IntPtrTy, IntegerType::get(getGlobalContext(), IntPtrBitSize));
|
||||
}
|
||||
|
||||
TEST_F(IRBuilderTest, FastMathFlags) {
|
||||
IRBuilder<> Builder(BB);
|
||||
Value *F;
|
||||
Instruction *FDiv, *FAdd;
|
||||
|
||||
F = Builder.CreateLoad(GV);
|
||||
F = Builder.CreateFAdd(F, F);
|
||||
|
||||
EXPECT_FALSE(Builder.GetFastMathFlags().any());
|
||||
ASSERT_TRUE(isa<Instruction>(F));
|
||||
FAdd = cast<Instruction>(F);
|
||||
EXPECT_FALSE(FAdd->hasNoNaNs());
|
||||
|
||||
FastMathFlags FMF;
|
||||
Builder.SetFastMathFlags(FMF);
|
||||
|
||||
F = Builder.CreateFAdd(F, F);
|
||||
EXPECT_FALSE(Builder.GetFastMathFlags().any());
|
||||
|
||||
FMF.UnsafeAlgebra = true;
|
||||
Builder.SetFastMathFlags(FMF);
|
||||
|
||||
F = Builder.CreateFAdd(F, F);
|
||||
EXPECT_TRUE(Builder.GetFastMathFlags().any());
|
||||
ASSERT_TRUE(isa<Instruction>(F));
|
||||
FAdd = cast<Instruction>(F);
|
||||
EXPECT_TRUE(FAdd->hasNoNaNs());
|
||||
|
||||
F = Builder.CreateFDiv(F, F);
|
||||
EXPECT_TRUE(Builder.GetFastMathFlags().any());
|
||||
EXPECT_TRUE(Builder.GetFastMathFlags().UnsafeAlgebra);
|
||||
ASSERT_TRUE(isa<Instruction>(F));
|
||||
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->hasAllowReciprocal());
|
||||
|
||||
FMF.clear();
|
||||
FMF.AllowReciprocal = true;
|
||||
Builder.SetFastMathFlags(FMF);
|
||||
|
||||
F = Builder.CreateFDiv(F, F);
|
||||
EXPECT_TRUE(Builder.GetFastMathFlags().any());
|
||||
EXPECT_TRUE(Builder.GetFastMathFlags().AllowReciprocal);
|
||||
ASSERT_TRUE(isa<Instruction>(F));
|
||||
FDiv = cast<Instruction>(F);
|
||||
EXPECT_TRUE(FDiv->hasAllowReciprocal());
|
||||
|
||||
}
|
||||
|
||||
TEST_F(IRBuilderTest, FastMathFlags) {
|
||||
IRBuilder<> Builder(BB);
|
||||
Value *F;
|
||||
|
Loading…
x
Reference in New Issue
Block a user