[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)
Matt Arsenault via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon May 12 13:22:05 PDT 2025
================
@@ -7970,17 +7970,26 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
// On arm64_32, pointers are 32 bits when stored in memory, but
// zero-extended to 64 bits when in registers. Thus the mask is 32 bits to
- // match the index type, but the pointer is 64 bits, so the the mask must be
+ // match the index type, but the pointer is 64 bits, so the mask must be
// zero-extended up to 64 bits to match the pointer.
EVT PtrVT =
TLI.getValueType(DAG.getDataLayout(), I.getOperand(0)->getType());
EVT MemVT =
TLI.getMemValueType(DAG.getDataLayout(), I.getOperand(0)->getType());
assert(PtrVT == Ptr.getValueType());
- assert(MemVT == Mask.getValueType());
- if (MemVT != PtrVT)
+ if (Mask.getValueType().getFixedSizeInBits() < MemVT.getFixedSizeInBits()) {
+ // For AMDGPU buffer descriptors the mask is 48 bits, but the pointer is
+ // 128-bit, so we have to pad the mask with ones for unused bits.
+ auto HighOnes =
+ DAG.getNode(ISD::SHL, sdl, PtrVT, DAG.getAllOnesConstant(sdl, PtrVT),
+ DAG.getConstant(Mask.getValueType().getFixedSizeInBits(),
+ sdl, PtrVT));
----------------
arsenm wrote:
This should use getShiftAmountConstant / getShiftAmountTy, not the pointer type
https://github.com/llvm/llvm-project/pull/139419
More information about the llvm-branch-commits
mailing list