From: Chris Lattner Date: Wed, 29 Mar 2006 00:11:43 +0000 (+0000) Subject: Bug fixes: handle constantexpr insert/extract element operations X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=2bbd81064a6998496a71ff7ae8160b3caada64fa;p=oota-llvm.git Bug fixes: handle constantexpr insert/extract element operations Handle constantpacked vectors with constantexpr elements. This fixes CodeGen/Generic/vector-constantexpr.ll git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27241 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 3c633266bf9..0a694cce1fb 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -507,8 +507,8 @@ public: void visitSetLT(User &I) { visitSetCC(I, ISD::SETLT, ISD::SETULT); } void visitSetGT(User &I) { visitSetCC(I, ISD::SETGT, ISD::SETUGT); } - void visitExtractElement(ExtractElementInst &I); - void visitInsertElement(InsertElementInst &I); + void visitExtractElement(User &I); + void visitInsertElement(User &I); void visitGetElementPtr(User &I); void visitCast(User &I); @@ -586,18 +586,8 @@ SDOperand SelectionDAGLowering::getValue(const Value *V) { // the packed constant. std::vector Ops; if (ConstantPacked *CP = dyn_cast(C)) { - if (MVT::isFloatingPoint(PVT)) { - for (unsigned i = 0; i != NumElements; ++i) { - const ConstantFP *El = cast(CP->getOperand(i)); - Ops.push_back(DAG.getConstantFP(El->getValue(), PVT)); - } - } else { - for (unsigned i = 0; i != NumElements; ++i) { - const ConstantIntegral *El = - cast(CP->getOperand(i)); - Ops.push_back(DAG.getConstant(El->getRawValue(), PVT)); - } - } + for (unsigned i = 0; i != NumElements; ++i) + Ops.push_back(getValue(CP->getOperand(i))); } else { assert(isa(C) && "Unknown packed constant!"); SDOperand Op; @@ -1020,7 +1010,7 @@ void SelectionDAGLowering::visitCast(User &I) { } } -void SelectionDAGLowering::visitInsertElement(InsertElementInst &I) { +void SelectionDAGLowering::visitInsertElement(User &I) { SDOperand InVec = getValue(I.getOperand(0)); SDOperand InVal = getValue(I.getOperand(1)); SDOperand InIdx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), @@ -1032,7 +1022,7 @@ void SelectionDAGLowering::visitInsertElement(InsertElementInst &I) { InVec, InVal, InIdx, Num, Typ)); } -void SelectionDAGLowering::visitExtractElement(ExtractElementInst &I) { +void SelectionDAGLowering::visitExtractElement(User &I) { SDOperand InVec = getValue(I.getOperand(0)); SDOperand InIdx = DAG.getNode(ISD::ZERO_EXTEND, TLI.getPointerTy(), getValue(I.getOperand(1)));