Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 19 additions & 15 deletions llvm/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,12 @@ static DecodeStatus decodeSrcOp(MCInst &Inst, unsigned EncSize,

// Decoder for registers. Imm(7-bit) is number of register, uses decodeSrcOp to
// get register class. Used by SGPR only operands.
#define DECODE_OPERAND_REG_7(RegClass, OpWidth) \
#define DECODE_OPERAND_SREG_7(RegClass, OpWidth) \
DECODE_SrcOp(Decode##RegClass##RegisterClass, 7, OpWidth, Imm, false, 0)

#define DECODE_OPERAND_SREG_8(RegClass, OpWidth) \
DECODE_SrcOp(Decode##RegClass##RegisterClass, 8, OpWidth, Imm, false, 0)

// Decoder for registers. Imm(10-bit): Imm{7-0} is number of register,
// Imm{9} is acc(agpr or vgpr) Imm{8} should be 0 (see VOP3Pe_SMFMAC).
// Set Imm{8} to 1 (IS_VGPR) to decode using 'enum10' from decodeSrcOp.
Expand Down Expand Up @@ -270,20 +273,21 @@ DECODE_OPERAND_REG_8(VReg_384)
DECODE_OPERAND_REG_8(VReg_512)
DECODE_OPERAND_REG_8(VReg_1024)

DECODE_OPERAND_REG_7(SReg_32, OPW32)
DECODE_OPERAND_REG_7(SReg_32_XM0, OPW32)
DECODE_OPERAND_REG_7(SReg_32_XEXEC, OPW32)
DECODE_OPERAND_REG_7(SReg_32_XM0_XEXEC, OPW32)
DECODE_OPERAND_REG_7(SReg_32_XEXEC_HI, OPW32)
DECODE_OPERAND_REG_7(SReg_64, OPW64)
DECODE_OPERAND_REG_7(SReg_64_XEXEC, OPW64)
DECODE_OPERAND_REG_7(SReg_64_XEXEC_XNULL, OPW64)
DECODE_OPERAND_REG_7(SReg_96, OPW96)
DECODE_OPERAND_REG_7(SReg_128, OPW128)
DECODE_OPERAND_REG_7(SReg_128_XNULL, OPW128)
DECODE_OPERAND_REG_7(SReg_256, OPW256)
DECODE_OPERAND_REG_7(SReg_256_XNULL, OPW256)
DECODE_OPERAND_REG_7(SReg_512, OPW512)
DECODE_OPERAND_SREG_7(SReg_32, OPW32)
DECODE_OPERAND_SREG_7(SReg_32_XM0, OPW32)
DECODE_OPERAND_SREG_7(SReg_32_XEXEC, OPW32)
DECODE_OPERAND_SREG_7(SReg_32_XM0_XEXEC, OPW32)
DECODE_OPERAND_SREG_7(SReg_32_XEXEC_HI, OPW32)
DECODE_OPERAND_SREG_7(SReg_64_XEXEC, OPW64)
DECODE_OPERAND_SREG_7(SReg_64_XEXEC_XNULL, OPW64)
DECODE_OPERAND_SREG_7(SReg_96, OPW96)
DECODE_OPERAND_SREG_7(SReg_128, OPW128)
DECODE_OPERAND_SREG_7(SReg_128_XNULL, OPW128)
DECODE_OPERAND_SREG_7(SReg_256, OPW256)
DECODE_OPERAND_SREG_7(SReg_256_XNULL, OPW256)
DECODE_OPERAND_SREG_7(SReg_512, OPW512)

DECODE_OPERAND_SREG_8(SReg_64, OPW64)

DECODE_OPERAND_REG_8(AGPR_32)
DECODE_OPERAND_REG_8(AReg_64)
Expand Down
3 changes: 3 additions & 0 deletions llvm/test/MC/Disassembler/AMDGPU/gfx11_dasm_sop1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,9 @@
# GFX11: s_setpc_b64 vcc ; encoding: [0x6a,0x48,0x80,0xbe]
0x6a,0x48,0x80,0xbe

# GFX11: s_setpc_b64 -11/*Invalid immediate*/ ; encoding: [0xf5,0x48,0x80,0xbe]
0xcb,0x48,0xf5,0xbe
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe test with more operand bit widths? Or I guess only SReg_64 changed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's just SReg_64. I hope to have to time to check other cases more thoroughly, but we need this s_setpc fix as a matter of urgency.


# GFX11: s_sext_i32_i16 exec_hi, s1 ; encoding: [0x01,0x0f,0xff,0xbe]
0x01,0x0f,0xff,0xbe

Expand Down
3 changes: 3 additions & 0 deletions llvm/test/MC/Disassembler/AMDGPU/gfx12_dasm_sop1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3267,6 +3267,9 @@
# GFX12: s_setpc_b64 vcc ; encoding: [0x6a,0x48,0x80,0xbe]
0x6a,0x48,0x80,0xbe

# GFX12: s_setpc_b64 -11/*Invalid immediate*/ ; encoding: [0xf5,0x48,0x80,0xbe]
0xcb,0x48,0xf5,0xbe

# GFX12: s_sext_i32_i16 exec_hi, s1 ; encoding: [0x01,0x0f,0xff,0xbe]
0x01,0x0f,0xff,0xbe

Expand Down
Loading