Skip to content

Commit 871d937

Browse files
[AMDGPU] Fix buffer offset validation per PR feedback 3
1 parent 4911278 commit 871d937

File tree

3 files changed

+90
-90
lines changed

3 files changed

+90
-90
lines changed

llvm/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4782,13 +4782,13 @@ bool AMDGPUAsmParser::validateOffset(const MCInst &Inst,
47824782
return validateSMEMOffset(Inst, Operands);
47834783

47844784
const auto &Op = Inst.getOperand(OpNum);
4785-
// GFX12+ buffer ops: InstOffset is signed 24, but must be positive
4785+
// GFX12+ buffer ops: InstOffset is signed 24, but must not be a negative.
47864786
if (isGFX12Plus() &&
47874787
(TSFlags & (SIInstrFlags::MUBUF | SIInstrFlags::MTBUF))) {
47884788
const unsigned OffsetSize = 24;
47894789
if (!isUIntN(OffsetSize - 1, Op.getImm())) {
47904790
Error(getFlatOffsetLoc(Operands),
4791-
Twine("expected a ") + Twine(OffsetSize - 1) + "-bit non-negative offset for buffer ops");
4791+
Twine("expected a ") + Twine(OffsetSize - 1) + "-bit unsigned offset for buffer ops");
47924792
return false;
47934793
}
47944794
} else {
@@ -4872,7 +4872,7 @@ bool AMDGPUAsmParser::validateSMEMOffset(const MCInst &Inst,
48724872

48734873
Error(getSMEMOffsetLoc(Operands),
48744874
isGFX12Plus() && IsBuffer
4875-
? "expected a 23-bit non-negative offset for S_BUFFER ops"
4875+
? "expected a 23-bit unsigned offset for buffer ops"
48764876
: isGFX12Plus() ? "expected a 24-bit signed offset"
48774877
: (isVI() || IsBuffer) ? "expected a 20-bit unsigned offset"
48784878
: "expected a 21-bit signed offset");

llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ DecodeStatus AMDGPUDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
843843
}
844844
}
845845

846-
// Validate buffer instruction offsets for GFX12+ - must be non-negative
846+
// Validate buffer instruction offsets for GFX12+ - must not be a negative.
847847
if (isGFX12Plus() && isBufferInstruction(MI)) {
848848
int OffsetIdx =
849849
AMDGPU::getNamedOperandIdx(MI.getOpcode(), AMDGPU::OpName::offset);

0 commit comments

Comments
 (0)