diff --git a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp index d60f511302613..6b0ce7b21bdd1 100644 --- a/llvm/lib/Target/AMDGPU/SIISelLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIISelLowering.cpp @@ -1534,13 +1534,14 @@ bool SITargetLowering::isLegalAddressingMode(const DataLayout &DL, if (AM.BaseOffs % 4 != 0) return isLegalMUBUFAddressingMode(AM); - // There are no SMRD extloads, so if we have to do a small type access we - // will use a MUBUF load. - // FIXME?: We also need to do this if unaligned, but we don't know the - // alignment here. - // TODO: Update this for GFX12 which does have scalar sub-dword loads. - if (Ty->isSized() && DL.getTypeStoreSize(Ty) < 4) - return isLegalGlobalAddressingMode(AM); + if (!Subtarget->hasScalarSubwordLoads()) { + // There are no SMRD extloads, so if we have to do a small type access we + // will use a MUBUF load. + // FIXME?: We also need to do this if unaligned, but we don't know the + // alignment here. + if (Ty->isSized() && DL.getTypeStoreSize(Ty) < 4) + return isLegalGlobalAddressingMode(AM); + } if (Subtarget->getGeneration() == AMDGPUSubtarget::SOUTHERN_ISLANDS) { // SMRD instructions have an 8-bit, dword offset on SI.