OSDN Git Service

[ConstantFolding] Properly support constant folding of vector powi intrinsic. The...
authorCraig Topper <craig.topper@gmail.com>
Sun, 4 Jun 2017 07:30:28 +0000 (07:30 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 4 Jun 2017 07:30:28 +0000 (07:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304679 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ConstantFolding.cpp
test/Transforms/InstSimplify/call.ll

index d33fe4a..b8e80ea 100644 (file)
@@ -2036,7 +2036,8 @@ Constant *ConstantFoldVectorCall(StringRef Name, unsigned IntrinsicID,
     for (unsigned J = 0, JE = Operands.size(); J != JE; ++J) {
       // These intrinsics use a scalar type for their second argument.
       if (J == 1 &&
-          (IntrinsicID == Intrinsic::cttz || IntrinsicID == Intrinsic::ctlz)) {
+          (IntrinsicID == Intrinsic::cttz || IntrinsicID == Intrinsic::ctlz ||
+           IntrinsicID == Intrinsic::powi)) {
         Lane[J] = Operands[J];
         continue;
       }
index 364fd64..c7d10e2 100644 (file)
@@ -437,8 +437,7 @@ entry:
 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> <double 3.000000e+00, double 5.000000e+00>, i32 2)
-; CHECK-NEXT:    ret <2 x double> [[TMP0]]
+; CHECK-NEXT:    ret <2 x double> <double 9.000000e+00, double 2.500000e+01>
 ;
 entry:
   %0 = call <2 x double> @llvm.powi.v2f64(<2 x double> <double 3.00000e+00, double 5.00000e+00>, i32 2)