Skip to content

DAG: Fix legalization of vector addrspacecasts #113964

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4364,6 +4364,9 @@ bool SelectionDAGLegalize::ExpandNode(SDNode *Node) {
Results.push_back(DAG.getNode(ISD::FP_TO_SINT, dl, ResVT, RoundNode));
break;
}
case ISD::ADDRSPACECAST:
Results.push_back(DAG.UnrollVectorOp(Node));
break;
case ISD::GLOBAL_OFFSET_TABLE:
case ISD::GlobalAddress:
case ISD::GlobalTLSAddress:
Expand Down
8 changes: 8 additions & 0 deletions llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12583,6 +12583,14 @@ SDValue SelectionDAG::UnrollVectorOp(SDNode *N, unsigned ResNE) {
Scalars.push_back(getNode(N->getOpcode(), dl, EltVT,
Operands[0],
getValueType(ExtVT)));
break;
}
case ISD::ADDRSPACECAST: {
const auto *ASC = cast<AddrSpaceCastSDNode>(N);
Scalars.push_back(getAddrSpaceCast(dl, EltVT, Operands[0],
ASC->getSrcAddressSpace(),
ASC->getDestAddressSpace()));
break;
}
}
}
Expand Down
24 changes: 12 additions & 12 deletions llvm/lib/Target/AMDGPU/AMDGPUISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -512,18 +512,18 @@ AMDGPUTargetLowering::AMDGPUTargetLowering(const TargetMachine &TM,

for (MVT VT : VectorIntTypes) {
// Expand the following operations for the current type by default.
setOperationAction({ISD::ADD, ISD::AND, ISD::FP_TO_SINT,
ISD::FP_TO_UINT, ISD::MUL, ISD::MULHU,
ISD::MULHS, ISD::OR, ISD::SHL,
ISD::SRA, ISD::SRL, ISD::ROTL,
ISD::ROTR, ISD::SUB, ISD::SINT_TO_FP,
ISD::UINT_TO_FP, ISD::SDIV, ISD::UDIV,
ISD::SREM, ISD::UREM, ISD::SMUL_LOHI,
ISD::UMUL_LOHI, ISD::SDIVREM, ISD::UDIVREM,
ISD::SELECT, ISD::VSELECT, ISD::SELECT_CC,
ISD::XOR, ISD::BSWAP, ISD::CTPOP,
ISD::CTTZ, ISD::CTLZ, ISD::VECTOR_SHUFFLE,
ISD::SETCC},
setOperationAction({ISD::ADD, ISD::AND, ISD::FP_TO_SINT,
ISD::FP_TO_UINT, ISD::MUL, ISD::MULHU,
ISD::MULHS, ISD::OR, ISD::SHL,
ISD::SRA, ISD::SRL, ISD::ROTL,
ISD::ROTR, ISD::SUB, ISD::SINT_TO_FP,
ISD::UINT_TO_FP, ISD::SDIV, ISD::UDIV,
ISD::SREM, ISD::UREM, ISD::SMUL_LOHI,
ISD::UMUL_LOHI, ISD::SDIVREM, ISD::UDIVREM,
ISD::SELECT, ISD::VSELECT, ISD::SELECT_CC,
ISD::XOR, ISD::BSWAP, ISD::CTPOP,
ISD::CTTZ, ISD::CTLZ, ISD::VECTOR_SHUFFLE,
ISD::SETCC, ISD::ADDRSPACECAST},
VT, Expand);
}

Expand Down
Loading
Loading