Skip to content

Commit 997af95

Browse files
authored
[AMDGPU] Remove validation of s_set_vgpr_msb range (#164888)
We will need the full 16-bit range of the operand to record previous mode.
1 parent ef923f1 commit 997af95

File tree

4 files changed

+7
-30
lines changed

4 files changed

+7
-30
lines changed

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

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,7 +1860,6 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
18601860
bool validateTHAndScopeBits(const MCInst &Inst, const OperandVector &Operands,
18611861
const unsigned CPol);
18621862
bool validateTFE(const MCInst &Inst, const OperandVector &Operands);
1863-
bool validateSetVgprMSB(const MCInst &Inst, const OperandVector &Operands);
18641863
bool validateLdsDirect(const MCInst &Inst, const OperandVector &Operands);
18651864
bool validateWMMA(const MCInst &Inst, const OperandVector &Operands);
18661865
unsigned getConstantBusLimit(unsigned Opcode) const;
@@ -5506,22 +5505,6 @@ bool AMDGPUAsmParser::validateTFE(const MCInst &Inst,
55065505
return true;
55075506
}
55085507

5509-
bool AMDGPUAsmParser::validateSetVgprMSB(const MCInst &Inst,
5510-
const OperandVector &Operands) {
5511-
if (Inst.getOpcode() != AMDGPU::S_SET_VGPR_MSB_gfx12)
5512-
return true;
5513-
5514-
int Simm16Pos =
5515-
AMDGPU::getNamedOperandIdx(Inst.getOpcode(), AMDGPU::OpName::simm16);
5516-
if ((unsigned)Inst.getOperand(Simm16Pos).getImm() > 255) {
5517-
SMLoc Loc = Operands[1]->getStartLoc();
5518-
Error(Loc, "s_set_vgpr_msb accepts values in range [0..255]");
5519-
return false;
5520-
}
5521-
5522-
return true;
5523-
}
5524-
55255508
bool AMDGPUAsmParser::validateWMMA(const MCInst &Inst,
55265509
const OperandVector &Operands) {
55275510
unsigned Opc = Inst.getOpcode();
@@ -5681,9 +5664,6 @@ bool AMDGPUAsmParser::validateInstruction(const MCInst &Inst, SMLoc IDLoc,
56815664
if (!validateTFE(Inst, Operands)) {
56825665
return false;
56835666
}
5684-
if (!validateSetVgprMSB(Inst, Operands)) {
5685-
return false;
5686-
}
56875667
if (!validateWMMA(Inst, Operands)) {
56885668
return false;
56895669
}

llvm/test/MC/AMDGPU/gfx1250_asm_sopp.s

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ s_set_vgpr_msb 255
4545
// GFX1250: [0xff,0x00,0x86,0xbf]
4646
// GFX12-ERR: :[[@LINE-2]]:{{[0-9]+}}: error: instruction not supported on this GPU
4747

48+
s_set_vgpr_msb 0xffff
49+
// GFX1250: [0xff,0xff,0x86,0xbf]
50+
// GFX12-ERR: :[[@LINE-2]]:{{[0-9]+}}: error: instruction not supported on this GPU
51+
4852
s_monitor_sleep 1
4953
// GFX1250: s_monitor_sleep 1 ; encoding: [0x01,0x00,0x84,0xbf]
5054
// GFX12-ERR: :[[@LINE-2]]:{{[0-9]+}}: error: instruction not supported on this GPU

llvm/test/MC/AMDGPU/gfx1250_err.s

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
// RUN: not llvm-mc -triple=amdgcn -mcpu=gfx1250 -show-encoding %s 2>&1 | FileCheck --check-prefixes=GFX1250-ERR --implicit-check-not=error: -strict-whitespace %s
22

3-
s_set_vgpr_msb -1
4-
// GFX1250-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: s_set_vgpr_msb accepts values in range [0..255]
5-
// GFX1250-ERR: s_set_vgpr_msb -1
6-
// GFX1250-ERR: ^
7-
8-
s_set_vgpr_msb 256
9-
// GFX1250-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: s_set_vgpr_msb accepts values in range [0..255]
10-
// GFX1250-ERR: s_set_vgpr_msb 256
11-
// GFX1250-ERR: ^
12-
133
s_load_b32 s4, s[2:3], 10 th:TH_LOAD_NT th:TH_LOAD_NT
144
// GFX1250-ERR: :[[@LINE-1]]:{{[0-9]+}}: error: invalid operand for instruction
155
// GFX1250-ERR: s_load_b32 s4, s[2:3], 10 th:TH_LOAD_NT th:TH_LOAD_NT

llvm/test/MC/Disassembler/AMDGPU/gfx1250_dasm_sopp.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
# GFX1250: s_set_vgpr_msb 0xff ; encoding: [0xff,0x00,0x86,0xbf]
3434
0xff,0x00,0x86,0xbf
3535

36+
# GFX1250: s_set_vgpr_msb 0xffff ; encoding: [0xff,0xff,0x86,0xbf]
37+
0xff,0xff,0x86,0xbf
38+
3639
# GFX1250: s_monitor_sleep 0 ; encoding: [0x00,0x00,0x84,0xbf]
3740
0x00,0x00,0x84,0xbf
3841

0 commit comments

Comments
 (0)