Skip to content

Commit f90e2a8

Browse files
committed
Add jump group for generic jirl
Add jump group when jirl has three operands. Fixes capstone-engine#2690.
1 parent fc525c7 commit f90e2a8

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

arch/LoongArch/LoongArchMapping.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,9 @@ static void LoongArch_add_cs_groups(MCInst *MI)
375375
} else if (loongarch->op_count == 1) {
376376
// jr rj
377377
add_group(MI, LOONGARCH_GRP_JUMP);
378+
} else if (loongarch->op_count == 3) {
379+
// none of the above, generic jirl
380+
add_group(MI, LOONGARCH_GRP_JUMP);
378381
}
379382
break;
380383
case LOONGARCH_INS_B:

tests/details/loongarch.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ test_cases:
3434
imm: -1
3535
-
3636
input:
37-
bytes: [ 0x80, 0x80, 0x00, 0x40, 0x63, 0x80, 0xff, 0x02, 0x78, 0x20, 0xc0, 0x29, 0x00, 0x84, 0x00, 0x01, 0x00, 0xa4, 0x14, 0x01 ]
37+
bytes: [ 0x80, 0x80, 0x00, 0x40, 0x63, 0x80, 0xff, 0x02, 0x78, 0x20, 0xc0, 0x29, 0x00, 0x84, 0x00, 0x01, 0x00, 0xa4, 0x14, 0x01, 0xed, 0x01, 0x00, 0x4c ]
3838
arch: "loongarch"
3939
options: [ CS_OPT_DETAIL, CS_MODE_LOONGARCH64]
4040
address: 0x0
@@ -105,3 +105,18 @@ test_cases:
105105
-
106106
type: LOONGARCH_OP_REG
107107
reg: zero
108+
-
109+
asm_text: "jirl $t1, $t3, 0"
110+
details:
111+
loongarch:
112+
operands:
113+
-
114+
type: LOONGARCH_OP_REG
115+
reg: t1
116+
-
117+
type: LOONGARCH_OP_REG
118+
reg: t3
119+
-
120+
type: LOONGARCH_OP_IMM
121+
imm: 0x0
122+
groups: [ LOONGARCH_GRP_JUMP ]

0 commit comments

Comments
 (0)