Skip to content

Commit 12dae80

Browse files
committed
Support 96b dst for gfx12. Also added disassembler tests.
1 parent dcb07e0 commit 12dae80

File tree

7 files changed

+56
-3
lines changed

7 files changed

+56
-3
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9764,6 +9764,7 @@ unsigned AMDGPUAsmParser::validateTargetOperandClass(MCParsedAsmOperand &Op,
97649764
// The following code enables it for SReg_64 and larger operands
97659765
// used as source and destination. Remaining source
97669766
// operands are handled in isInlinableImm.
9767+
case MCK_SReg_96:
97679768
case MCK_SReg_128:
97689769
case MCK_SReg_256:
97699770
case MCK_SReg_512:

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,10 +1695,11 @@ AMDGPUDisassembler::decodeNonVGPRSrcOp(const OpWidthTy Width, unsigned Val,
16951695
case OPW64:
16961696
case OPWV232:
16971697
return decodeSpecialReg64(Val);
1698+
case OPW96:
16981699
case OPW128:
16991700
case OPW256:
17001701
case OPW512:
1701-
return decodeSpecialReg128(Val);
1702+
return decodeSpecialReg96Plus(Val);
17021703
default:
17031704
llvm_unreachable("unexpected immediate type");
17041705
}
@@ -1785,7 +1786,7 @@ MCOperand AMDGPUDisassembler::decodeSpecialReg64(unsigned Val) const {
17851786
return errOperand(Val, "unknown operand encoding " + Twine(Val));
17861787
}
17871788

1788-
MCOperand AMDGPUDisassembler::decodeSpecialReg128(unsigned Val) const {
1789+
MCOperand AMDGPUDisassembler::decodeSpecialReg96Plus(unsigned Val) const {
17891790
using namespace AMDGPU;
17901791

17911792
switch (Val) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ class AMDGPUDisassembler : public MCDisassembler {
259259
MCOperand decodeVOPDDstYOp(MCInst &Inst, unsigned Val) const;
260260
MCOperand decodeSpecialReg32(unsigned Val) const;
261261
MCOperand decodeSpecialReg64(unsigned Val) const;
262-
MCOperand decodeSpecialReg128(unsigned Val) const;
262+
MCOperand decodeSpecialReg96Plus(unsigned Val) const;
263263

264264
MCOperand decodeSDWASrc(const OpWidthTy Width, unsigned Val,
265265
unsigned ImmWidth,

llvm/test/MC/AMDGPU/gfx12_asm_smem.s

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,9 @@ s_load_b32 null, s[2:3], s0 offset:0x0
548548
s_load_b64 null, s[2:3], s0 offset:0x0
549549
// GFX12: encoding: [0x01,0x3f,0x00,0xf4,0x00,0x00,0x00,0x00]
550550

551+
s_load_b96 null, s[2:3], s0 offset:0x0
552+
// GFX12: encoding: [0x01,0xbf,0x00,0xf4,0x00,0x00,0x00,0x00]
553+
551554
s_load_b128 null, s[2:3], s0 offset:0x0
552555
// GFX12: encoding: [0x01,0x5f,0x00,0xf4,0x00,0x00,0x00,0x00]
553556

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,3 +1261,18 @@
12611261

12621262
# GFX10: s_store_dwordx4 s[96:99], s[4:5], s0 ; encoding: [0x02,0x18,0x48,0xf4,0x00,0x00,0x00,0x00]
12631263
0x02,0x18,0x48,0xf4,0x00,0x00,0x00,0x00
1264+
1265+
# GFX10: s_load_dword null, s[2:3], s0 ; encoding: [0x41,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00]
1266+
0x41,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00
1267+
1268+
# GFX10: s_load_dwordx2 null, s[2:3], s0 ; encoding: [0x41,0x1f,0x04,0xf4,0x00,0x00,0x00,0x00]
1269+
0x41,0x1f,0x04,0xf4,0x00,0x00,0x00,0x00
1270+
1271+
# GFX10: s_load_dwordx4 null, s[2:3], s0 ; encoding: [0x41,0x1f,0x08,0xf4,0x00,0x00,0x00,0x00]
1272+
0x41,0x1f,0x08,0xf4,0x00,0x00,0x00,0x00
1273+
1274+
# GFX10: s_load_dwordx8 null, s[2:3], s0 ; encoding: [0x41,0x1f,0x0c,0xf4,0x00,0x00,0x00,0x00]
1275+
0x41,0x1f,0x0c,0xf4,0x00,0x00,0x00,0x00
1276+
1277+
# GFX10: s_load_dwordx16 null, s[2:3], s0 ; encoding: [0x41,0x1f,0x10,0xf4,0x00,0x00,0x00,0x00]
1278+
0x41,0x1f,0x10,0xf4,0x00,0x00,0x00,0x00

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,3 +471,18 @@
471471

472472
# GFX11: s_gl1_inv ; encoding: [0x00,0x00,0x80,0xf4,0x00,0x00,0x00,0x00]
473473
0x00,0x00,0x80,0xf4,0x00,0x00,0x00,0x00
474+
475+
# GFX11: s_load_b32 null, s[2:3], s0 ; encoding: [0x01,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00]
476+
0x01,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00
477+
478+
# GFX11: s_load_b64 null, s[2:3], s0 ; encoding: [0x01,0x1f,0x04,0xf4,0x00,0x00,0x00,0x00]
479+
0x01,0x1f,0x04,0xf4,0x00,0x00,0x00,0x00
480+
481+
# GFX11: s_load_b128 null, s[2:3], s0 ; encoding: [0x01,0x1f,0x08,0xf4,0x00,0x00,0x00,0x00]
482+
0x01,0x1f,0x08,0xf4,0x00,0x00,0x00,0x00
483+
484+
# GFX11: s_load_b256 null, s[2:3], s0 ; encoding: [0x01,0x1f,0x0c,0xf4,0x00,0x00,0x00,0x00]
485+
0x01,0x1f,0x0c,0xf4,0x00,0x00,0x00,0x00
486+
487+
# GFX11: s_load_b512 null, s[2:3], s0 ; encoding: [0x01,0x1f,0x10,0xf4,0x00,0x00,0x00,0x00]
488+
0x01,0x1f,0x10,0xf4,0x00,0x00,0x00,0x00

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,3 +1277,21 @@
12771277

12781278
# GFX12: s_buffer_load_u16 s5, s[96:99], s0 offset:0x0 th:TH_LOAD_HT scope:SCOPE_SYS ; encoding: [0x70,0x61,0x63,0xf5,0x00,0x00,0x00,0x00]
12791279
0x70,0x61,0x63,0xf5,0x00,0x00,0x00,0x00
1280+
1281+
# GFX12: s_load_b32 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00]
1282+
0x01,0x1f,0x00,0xf4,0x00,0x00,0x00,0x00
1283+
1284+
# GFX12: s_load_b64 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0x3f,0x00,0xf4,0x00,0x00,0x00,0x00]
1285+
0x01,0x3f,0x00,0xf4,0x00,0x00,0x00,0x00
1286+
1287+
# GFX12: s_load_b96 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0xbf,0x00,0xf4,0x00,0x00,0x00,0x00]
1288+
0x01,0xbf,0x00,0xf4,0x00,0x00,0x00,0x00
1289+
1290+
# GFX12: s_load_b128 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0x5f,0x00,0xf4,0x00,0x00,0x00,0x00]
1291+
0x01,0x5f,0x00,0xf4,0x00,0x00,0x00,0x00
1292+
1293+
# GFX12: s_load_b256 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0x7f,0x00,0xf4,0x00,0x00,0x00,0x00]
1294+
0x01,0x7f,0x00,0xf4,0x00,0x00,0x00,0x00
1295+
1296+
# GFX12: s_load_b512 null, s[2:3], s0 offset:0x0 ; encoding: [0x01,0x9f,0x00,0xf4,0x00,0x00,0x00,0x00]
1297+
0x01,0x9f,0x00,0xf4,0x00,0x00,0x00,0x00

0 commit comments

Comments
 (0)