[llvm-commits] [llvm] r42457 - in /llvm/trunk: lib/CodeGen/SelectionDAG/LegalizeDAG.cpp test/CodeGen/X86/illegal-insert.ll

Dan Gohman djg at cray.com
Fri Sep 28 16:53:41 PDT 2007


Author: djg
Date: Fri Sep 28 18:53:40 2007
New Revision: 42457

URL: http://llvm.org/viewvc/llvm-project?rev=42457&view=rev
Log:
Teach SplitVectorOp how to split INSERT_VECTOR_ELT.

Added:
    llvm/trunk/test/CodeGen/X86/illegal-insert.ll
Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp?rev=42457&r1=42456&r2=42457&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp Fri Sep 28 18:53:40 2007
@@ -5837,6 +5837,18 @@
     Lo = Node->getOperand(0);
     Hi = Node->getOperand(1);
     break;
+  case ISD::INSERT_VECTOR_ELT: {
+    SplitVectorOp(Node->getOperand(0), Lo, Hi);
+    unsigned Index = cast<ConstantSDNode>(Node->getOperand(2))->getValue();
+    SDOperand ScalarOp = Node->getOperand(1);
+    if (Index < NewNumElts)
+      Lo = DAG.getNode(ISD::INSERT_VECTOR_ELT, NewVT, Lo, ScalarOp,
+                       DAG.getConstant(Index, TLI.getPointerTy()));
+    else
+      Hi = DAG.getNode(ISD::INSERT_VECTOR_ELT, NewVT, Hi, ScalarOp,
+                       DAG.getConstant(Index - NewNumElts, TLI.getPointerTy()));
+    break;
+  }
   case ISD::BUILD_VECTOR: {
     SmallVector<SDOperand, 8> LoOps(Node->op_begin(), 
                                     Node->op_begin()+NewNumElts);

Added: llvm/trunk/test/CodeGen/X86/illegal-insert.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/illegal-insert.ll?rev=42457&view=auto

==============================================================================
--- llvm/trunk/test/CodeGen/X86/illegal-insert.ll (added)
+++ llvm/trunk/test/CodeGen/X86/illegal-insert.ll Fri Sep 28 18:53:40 2007
@@ -0,0 +1,18 @@
+; RUN: llvm-as %s -o - | llc -march=x86-64
+
+define <4 x double> @foo0(<4 x double> %t) {
+  %r = insertelement <4 x double> %t, double 2.3, i32 0
+  ret <4 x double> %r
+}
+define <4 x double> @foo1(<4 x double> %t) {
+  %r = insertelement <4 x double> %t, double 2.3, i32 1
+  ret <4 x double> %r
+}
+define <4 x double> @foo2(<4 x double> %t) {
+  %r = insertelement <4 x double> %t, double 2.3, i32 2
+  ret <4 x double> %r
+}
+define <4 x double> @foo3(<4 x double> %t) {
+  %r = insertelement <4 x double> %t, double 2.3, i32 3
+  ret <4 x double> %r
+}





More information about the llvm-commits mailing list