From e869716ca3bfe0627bdf62313a0e47006b3425ce Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 4 Jun 2017 07:30:23 +0000 Subject: [PATCH] [InstSimplify] Add test case demonstrating that we fail to constant fold vector llvm.powi intrinsics due to the second argument not being a vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304678 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstSimplify/call.ll | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/Transforms/InstSimplify/call.ll b/test/Transforms/InstSimplify/call.ll index 994ff6b8c0d..364fd643691 100644 --- a/test/Transforms/InstSimplify/call.ll +++ b/test/Transforms/InstSimplify/call.ll @@ -420,3 +420,27 @@ define <8 x i32> @masked_load_undef_mask(<8 x i32>* %V) { declare noalias i8* @malloc(i64) declare <8 x i32> @llvm.masked.load.v8i32.p0v8i32(<8 x i32>*, i32, <8 x i1>, <8 x i32>) + +declare double @llvm.powi.f64(double, i32) +declare <2 x double> @llvm.powi.v2f64(<2 x double>, i32) + +define double @constant_fold_powi() nounwind uwtable ssp { +; CHECK-LABEL: @constant_fold_powi( +; CHECK-NEXT: entry: +; CHECK-NEXT: ret double 9.000000e+00 +; +entry: + %0 = call double @llvm.powi.f64(double 3.00000e+00, i32 2) + ret double %0 +} + +define <2 x double> @constant_fold_powi_vec() nounwind uwtable ssp { +; CHECK-LABEL: @constant_fold_powi_vec( +; CHECK-NEXT: entry: +; CHECK-NEXT: [[TMP0:%.*]] = call <2 x double> @llvm.powi.v2f64(<2 x double> , i32 2) +; CHECK-NEXT: ret <2 x double> [[TMP0]] +; +entry: + %0 = call <2 x double> @llvm.powi.v2f64(<2 x double> , i32 2) + ret <2 x double> %0 +} -- 2.50.1