From 2f40f5681d0d896e592d1b6738d1df17228c68a8 Mon Sep 17 00:00:00 2001 From: "Kevin P. Neal" Date: Tue, 17 Dec 2019 12:30:41 -0500 Subject: [FPEnv] IRBuilder support for constrained sitofp/uitofp. --- llvm/unittests/IR/IRBuilderTest.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/unittests/IR') diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index 1ea92940b88..4ceff2d69b8 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -222,6 +222,16 @@ TEST_F(IRBuilderTest, ConstrainedFP) { II = cast(VInt); EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_fptosi); + VDouble = Builder.CreateUIToFP(VInt, Builder.getDoubleTy()); + ASSERT_TRUE(isa(VDouble)); + II = cast(VDouble); + EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_uitofp); + + VDouble = Builder.CreateSIToFP(VInt, Builder.getDoubleTy()); + ASSERT_TRUE(isa(VDouble)); + II = cast(VDouble); + EXPECT_EQ(II->getIntrinsicID(), Intrinsic::experimental_constrained_sitofp); + V = Builder.CreateFPTrunc(VDouble, Type::getFloatTy(Ctx)); ASSERT_TRUE(isa(V)); II = cast(V); -- cgit v1.2.3