[llvm] Port `NVPTXTargetLowering::LowerCONCAT_VECTORS` to SelectionDAG (PR #120030)
Ethan Kaji via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 16 20:10:42 PST 2024
================
@@ -1517,10 +1518,27 @@ SDValue SelectionDAGLegalize::ExpandInsertToVectorThroughStack(SDValue Op) {
BaseVecAlignment);
}
+SDValue SelectionDAGLegalize::ExpandConcatVectors(SDNode *Node) {
+ assert(Node->getOpcode() == ISD::CONCAT_VECTORS && "Unexpected opcode!");
+ SDLoc Dl(Node);
+ SmallVector<SDValue, 0> Ops;
+ unsigned NumOperands = Node->getNumOperands();
+ for (unsigned I = 0; I < NumOperands; ++I) {
+ SDValue SubOp = Node->getOperand(I);
+ EVT VectorValueType =
+ SubOp->getValueType(0);
+ EVT ElementValueType = VectorValueType.getVectorElementType();
+ unsigned NumSubElem = VectorValueType.getVectorNumElements();
+ for (unsigned J = 0; J < NumSubElem; ++J) {
+ Ops.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, Dl, ElementValueType,
+ SubOp, DAG.getIntPtrConstant(J, Dl)));
----------------
Esan5 wrote:
I think I've addressed this, it seems most existing code uses `getVectorIdxConstant(Idx, Dl)`, which internally calls `getVectorIdxTy`. I instead replaced the `getIntPtrConstant` with `getConstant(Idx, Dl, VectorIdxTy)` which is what would've been called in `getVectorIdxConstant`. Let me know if this isn't what you wanted.
https://github.com/llvm/llvm-project/pull/120030
More information about the llvm-commits
mailing list