[llvm] [AMDGPU] Fix negative immediate offset for unbuffered smem loads (PR #89165)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu May 9 12:17:26 PDT 2024
================
@@ -2072,13 +2084,22 @@ SDValue AMDGPUDAGToDAGISel::Expand32BitAddress(SDValue Addr) const {
// true, match only 32-bit immediate offsets available on CI.
bool AMDGPUDAGToDAGISel::SelectSMRDBaseOffset(SDValue Addr, SDValue &SBase,
SDValue *SOffset, SDValue *Offset,
- bool Imm32Only,
- bool IsBuffer) const {
+ bool Imm32Only, bool IsBuffer,
+ bool HasSOffset,
+ int64_t ImmOffset) const {
if (SOffset && Offset) {
assert(!Imm32Only && !IsBuffer);
SDValue B;
- return SelectSMRDBaseOffset(Addr, B, nullptr, Offset) &&
- SelectSMRDBaseOffset(B, SBase, SOffset, nullptr);
+
+ if (!SelectSMRDBaseOffset(Addr, B, nullptr, Offset, false, false, true))
+ return false;
+
+ int64_t ImmOff = 0;
+ if (ConstantSDNode *C = dyn_cast<ConstantSDNode>(*Offset))
+ ImmOff = C->getSExtValue();
----------------
arsenm wrote:
Parsing out the constant offset here is harder to follow, SelectSMRDBaseOffset can do this just as well
https://github.com/llvm/llvm-project/pull/89165
More information about the llvm-commits
mailing list