[PATCH] D66073: Added unit tests to check supported rounding modes
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 12 22:21:51 PDT 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rL368650: Added unit tests to check supported rounding modes (authored by sepavloff, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D66073?vs=214584&id=214760#toc
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66073/new/
https://reviews.llvm.org/D66073
Files:
llvm/trunk/lib/IR/IntrinsicInst.cpp
llvm/trunk/unittests/IR/IRBuilderTest.cpp
Index: llvm/trunk/lib/IR/IntrinsicInst.cpp
===================================================================
--- llvm/trunk/lib/IR/IntrinsicInst.cpp
+++ llvm/trunk/lib/IR/IntrinsicInst.cpp
@@ -143,7 +143,7 @@
RoundingStr = "round.upward";
break;
case ConstrainedFPIntrinsic::rmTowardZero:
- RoundingStr = "round.tozero";
+ RoundingStr = "round.towardzero";
break;
}
return RoundingStr;
Index: llvm/trunk/unittests/IR/IRBuilderTest.cpp
===================================================================
--- llvm/trunk/unittests/IR/IRBuilderTest.cpp
+++ llvm/trunk/unittests/IR/IRBuilderTest.cpp
@@ -187,6 +187,34 @@
ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmUpward);
+ Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
+ Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmToNearest);
+ V = Builder.CreateFAdd(V, V);
+ CII = cast<ConstrainedFPIntrinsic>(V);
+ ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
+ ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmToNearest);
+
+ Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebMayTrap);
+ Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDownward);
+ V = Builder.CreateFAdd(V, V);
+ CII = cast<ConstrainedFPIntrinsic>(V);
+ ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebMayTrap);
+ ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDownward);
+
+ Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebStrict);
+ Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmTowardZero);
+ V = Builder.CreateFAdd(V, V);
+ CII = cast<ConstrainedFPIntrinsic>(V);
+ ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebStrict);
+ ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmTowardZero);
+
+ Builder.setDefaultConstrainedExcept(ConstrainedFPIntrinsic::ebIgnore);
+ Builder.setDefaultConstrainedRounding(ConstrainedFPIntrinsic::rmDynamic);
+ V = Builder.CreateFAdd(V, V);
+ CII = cast<ConstrainedFPIntrinsic>(V);
+ ASSERT_TRUE(CII->getExceptionBehavior() == ConstrainedFPIntrinsic::ebIgnore);
+ ASSERT_TRUE(CII->getRoundingMode() == ConstrainedFPIntrinsic::rmDynamic);
+
// Now override the defaults.
Call = Builder.CreateConstrainedFPBinOp(
Intrinsic::experimental_constrained_fadd, V, V, nullptr, "", nullptr,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66073.214760.patch
Type: text/x-patch
Size: 2521 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190813/b2eba49c/attachment.bin>
More information about the llvm-commits
mailing list