llvm.org GIT mirror llvm / 9888e17
Added unit tests to check supported rounding modes Also added fixed misspelled metadata name. Differential Revision: https://reviews.llvm.org/D66073 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@368650 91177308-0d34-0410-b5e6-96231b3b80d8 Serge Pavlov a month ago
2 changed file(s) with 29 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
142142 RoundingStr = "round.upward";
143143 break;
144144 case ConstrainedFPIntrinsic::rmTowardZero:
145 RoundingStr = "round.tozero";
145 RoundingStr = "round.towardzero";
146146 break;
147147 }
148148 return RoundingStr;
185185 CII = cast(V);
186186 ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
187187 ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmUpward);
188
189 Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
190 Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmToNearest);
191 V = Builder.CreateFAdd(V, V);
192 CII = cast(V);
193 ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
194 ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmToNearest);
195
196 Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebMayTrap);
197 Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDownward);
198 V = Builder.CreateFAdd(V, V);
199 CII = cast(V);
200 ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebMayTrap);
201 ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDownward);
202
203 Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebStrict);
204 Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmTowardZero);
205 V = Builder.CreateFAdd(V, V);
206 CII = cast(V);
207 ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebStrict);
208 ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmTowardZero);
209
210 Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
211 Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDynamic);
212 V = Builder.CreateFAdd(V, V);
213 CII = cast(V);
214 ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
215 ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDynamic);
188216
189217 // Now override the defaults.
190218 Call = Builder.CreateConstrainedFPBinOp(