mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Fixed bad test case
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168815 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f564e9ff2d
commit
9eec659952
@ -166,4 +166,59 @@ TEST_F(IRBuilderTest, FastMathFlags) {
|
||||
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user