[PATCH] D149080: [AMDGPU] Fix negative offset values interpretation in getMemOperandsWithOffset for DS
Janek van Oirschot via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 25 07:08:26 PDT 2023
JanekvO added inline comments.
================
Comment at: llvm/lib/Target/AMDGPU/SIInstrInfo.cpp:332-333
- unsigned Offset0 = Offset0Op->getImm();
- unsigned Offset1 = Offset1Op->getImm();
+ APInt Offset0(8, Offset0Op->getImm());
+ APInt Offset1(8, Offset1Op->getImm());
if (Offset0 + 1 != Offset1)
----------------
arsenm wrote:
> Don't need to involve APInt? Just use int64_t like every imm operand really is
The added tests will fail in that case, `Offset0Op->getImm()` returns a negative value while the operand is supposed to be unsigned so we need to force unsigned type for the correct number of bits. I could change to `uint8_t` since it seems that all cases of this instruction will have 8 bit operands for the offsets.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149080/new/
https://reviews.llvm.org/D149080
More information about the llvm-commits
mailing list