summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/IR/IRBuilderTest.cpp
diff options
context:
space:
mode:
authorKevin P. Neal <kevin.neal@sas.com>2019-09-06 18:04:34 +0000
committerKevin P. Neal <kevin.neal@sas.com>2019-09-06 18:04:34 +0000
commitfab40fce3ffecc3f93068a15e370c0a1abfdb8d0 (patch)
treebc4464570db4f4fbc3193c58b566973fab02d8cc /llvm/unittests/IR/IRBuilderTest.cpp
parentb1dcbf1b164762018e82cb834bfaf9e0230155b7 (diff)
downloadbcm5719-llvm-fab40fce3ffecc3f93068a15e370c0a1abfdb8d0.tar.gz
bcm5719-llvm-fab40fce3ffecc3f93068a15e370c0a1abfdb8d0.zip
[FPEnv] Teach the IRBuilder about constrained FPToSI and FPToUI.
The IRBuilder doesn't know that the two floating point to integer instructions have constrained equivalents. This patch adds the support by building on the strict FP mode now present in the IRBuilder. Reviewed by: John McCall Approved by: John McCall Differential Revision: https://reviews.llvm.org/D67291 llvm-svn: 371235
Diffstat (limited to 'llvm/unittests/IR/IRBuilderTest.cpp')
-rw-r--r--llvm/unittests/IR/IRBuilderTest.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index 538c2a0dd93..8fb5337a291 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -171,6 +171,7 @@ TEST_F(IRBuilderTest, ConstrainedFP) {
IRBuilder<> Builder(BB);
Value *V;
Value *VDouble;
+ Value *VInt;
CallInst *Call;
IntrinsicInst *II;
GlobalVariable *GVDouble = new GlobalVariable(*M, Type::getDoubleTy(Ctx),
@@ -208,6 +209,16 @@ TEST_F(IRBuilderTest, ConstrainedFP) {
II = cast<IntrinsicInst>(V);
EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_frem);
+ VInt = Builder.CreateFPToUI(VDouble, Builder.getInt32Ty());
+ ASSERT_TRUE(isa<IntrinsicInst>(VInt));
+ II = cast<IntrinsicInst>(VInt);
+ EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_fptoui);
+
+ VInt = Builder.CreateFPToSI(VDouble, Builder.getInt32Ty());
+ ASSERT_TRUE(isa<IntrinsicInst>(VInt));
+ II = cast<IntrinsicInst>(VInt);
+ EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_fptosi);
+
V = Builder.CreateFPTrunc(VDouble, Type::getFloatTy(Ctx));
ASSERT_TRUE(isa<IntrinsicInst>(V));
II = cast<IntrinsicInst>(V);
OpenPOWER on IntegriCloud