llvm.org GIT mirror llvm / 4b896dd
copyFastMathFlags utility and test case git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168943 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Ilseman 6 years ago
3 changed file(s) with 18 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
226226 /// these flats.
227227 FastMathFlags getFastMathFlags() const;
228228
229 /// Copy I's fast-math flags
230 void copyFastMathFlags(const Instruction *I);
231
229232 private:
230233 /// hasMetadataHashEntry - Return true if we have an entry in the on-the-side
231234 /// metadata hash.
175175 assert(isa(this) && "setting fast-math flag on invalid op");
176176 return cast(this)->getFastMathFlags();
177177 }
178
179 /// Copy I's fast-math flags
180 void Instruction::copyFastMathFlags(const Instruction *I) {
181 setFastMathFlags(I->getFastMathFlags());
182 }
183
178184
179185 const char *Instruction::getOpcodeName(unsigned OpCode) {
180186 switch (OpCode) {
163163 FDiv = cast(F);
164164 EXPECT_TRUE(FDiv->hasAllowReciprocal());
165165
166 Builder.clearFastMathFlags();
167
168 F = Builder.CreateFDiv(F, F);
169 ASSERT_TRUE(isa(F));
170 FDiv = cast(F);
171 EXPECT_FALSE(FDiv->getFastMathFlags().any());
172 FDiv->copyFastMathFlags(FAdd);
173 EXPECT_TRUE(FDiv->hasNoNaNs());
174
166175 }
167176
168177 }