Learn how to make odd splatted constants in range [17,29]. This implements
authorChris Lattner <sabre@nondot.org>
Mon, 17 Apr 2006 06:07:44 +0000 (06:07 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 17 Apr 2006 06:07:44 +0000 (06:07 +0000)
PowerPC/vec_constants.ll:test_29.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27752 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCISelLowering.cpp

index be30d7663b3655caeb91ec8817e35ef3478b2da2..53365b1724349b2eb9aa152b010ddc971c1f0a12 100644 (file)
@@ -1105,6 +1105,13 @@ static SDOperand LowerBUILD_VECTOR(SDOperand Op, SelectionDAG &DAG) {
       Op = BuildSplatI(SextVal >> 1, SplatSize, Op.getValueType(), DAG);
       return DAG.getNode(ISD::ADD, Op.getValueType(), Op, Op);
     }
+    // Otherwise, in range [17,29]:  (vsplti 15) + (vsplti C).
+    if (SextVal >= 0 && SextVal <= 29) {
+      SDOperand LHS = BuildSplatI(15, SplatSize, Op.getValueType(), DAG);
+      SDOperand RHS = BuildSplatI(SextVal-15, SplatSize, Op.getValueType(),DAG);
+      return DAG.getNode(ISD::ADD, Op.getValueType(), LHS, RHS);
+      
+    }
 
     
     // If this is 0x8000_0000 x 4, turn into vspltisw + vslw.  If it is