[llvm-branch-commits] [AMDGPU] Set AS8 address width to 48 bits (PR #139419)
Alexander Richardson via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sat May 10 17:02:58 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));
+ Mask = DAG.getNode(ISD::OR, sdl, PtrVT,
+ DAG.getZExtOrTrunc(Mask, sdl, PtrVT), HighOnes);
----------------
arichardson wrote:
Not sure if there is an easier way to one-pad the mask argument but this _should_ do the right thing.
https://github.com/llvm/llvm-project/pull/139419
More information about the llvm-branch-commits
mailing list