Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix xtensa DecodeMR23RegisterClass and add tests for MAC16 instru… #2551

Merged
merged 2 commits into from
Nov 24, 2024
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
4 changes: 2 additions & 2 deletions arch/Xtensa/XtensaDisassembler.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,10 @@ static DecodeStatus DecodeMR23RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
const void *Decoder)
{
if ((RegNo < 2) || (RegNo > 3))
if (RegNo >= ARR_SIZE(MR23DecoderTable))
return MCDisassembler_Fail;

unsigned Reg = MR23DecoderTable[RegNo - 2];
unsigned Reg = MR23DecoderTable[RegNo];
MCOperand_CreateReg0(Inst, (Reg));
return MCDisassembler_Success;
}
Expand Down
97 changes: 97 additions & 0 deletions tests/MC/Xtensa/mac16.s.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
test_cases:
- input:
bytes: [ 0x04,0x01,0x34 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mul.ad.ll a1, m2"
- input:
bytes: [ 0x14,0x02,0x74 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mul.aa.ll a2, a1"
- input:
bytes: [ 0x14,0x00,0x64 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mul.da.ll m0, a1"
- input:
bytes: [ 0x04,0x00,0x24 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mul.dd.ll m0, m2"
- input:
bytes: [ 0x04,0x01,0x38 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.ad.ll a1, m2"
- input:
bytes: [ 0x14,0x02,0x78 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.aa.ll a2, a1"
- input:
bytes: [ 0x14,0x00,0x68 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.da.ll m0, a1"
- input:
bytes: [ 0x04,0x00,0x28 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.dd.ll m0, m2"
- input:
bytes: [ 0x14,0x00,0x58 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.da.ll.lddec m0, a0, m0, a1"
- input:
bytes: [ 0x14,0x00,0x48 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.da.ll.ldinc m0, a0, m0, a1"
- input:
bytes: [ 0x04,0x00,0x18 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.dd.ll.lddec m0, a0, m0, m2"
- input:
bytes: [ 0x04,0x00,0x08 ]
arch: "xtensa"
options: [ ]
address: 0x0
expected:
insns:
- asm_text: "mula.dd.ll.ldinc m0, a0, m0, m2"
Loading