Skip to content

Commit

Permalink
Fix Pn was printed as register, not predicate.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rot127 committed Sep 7, 2024
1 parent 93c554f commit be9c3b5
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arch/AArch64/AArch64Mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -1875,7 +1875,7 @@ static void add_cs_detail_template_1(MCInst *MI, aarch64_op_group op_group,
unsigned EltSize = temp_arg_0;
AArch64_get_detail_op(MI, 0)->vas = EltSize;
AArch64_set_detail_op_reg(
MI, OpNum, MCInst_getOpVal(MI, OpNum) - AArch64_PN0);
MI, OpNum, MCInst_getOpVal(MI, OpNum));
break;
}
case AArch64_OP_GROUP_PrefetchOp_0:
Expand Down Expand Up @@ -2483,7 +2483,8 @@ void AArch64_set_detail_op_reg(MCInst *MI, unsigned OpNum, aarch64_reg Reg)
AArch64_set_detail_op_sme(MI, OpNum, AARCH64_SME_MATRIX_TILE,
sme_reg_to_vas(Reg));
return;
} else if ((Reg >= AARCH64_REG_P0) && (Reg <= AARCH64_REG_P15)) {
} else if (((Reg >= AARCH64_REG_P0) && (Reg <= AARCH64_REG_P15)) ||
((Reg >= AARCH64_REG_PN0) && (Reg <= AARCH64_REG_PN15))) {
// SME/SVE predicate register.
AArch64_set_detail_op_pred(MI, OpNum);
return;
Expand Down
50 changes: 50 additions & 0 deletions tests/issues/issues.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4888,3 +4888,53 @@ test_cases:
vas: AARCH64LAYOUT_VL_D
regs_read: [ za0.d, za1.d, za2.d, za3.d, za4.d, za5.d, za6.d, za7.d ]
groups: [ HasSME ]
-
input:
name: "issue 2471 -- PNx was register"
bytes: [ 0x10, 0x80, 0x40, 0xa1 ]
arch: "CS_ARCH_AARCH64"
options: [ CS_OPT_DETAIL, CS_OPT_DETAIL_REAL ]
address: 0x0
expected:
insns:
-
asm_text: "ld1b { z16.b, z20.b, z24.b, z28.b }, pn8/z, [x0]"
is_alias: 1
details:
aarch64:
operands:
-
type: AARCH64_OP_REG
reg: z16
is_list_member: 1
access: CS_AC_WRITE
vas: AARCH64LAYOUT_VL_B
-
type: AARCH64_OP_REG
reg: z20
is_list_member: 1
access: CS_AC_WRITE
vas: AARCH64LAYOUT_VL_B
-
type: AARCH64_OP_REG
reg: z24
is_list_member: 1
access: CS_AC_WRITE
vas: AARCH64LAYOUT_VL_B
-
type: AARCH64_OP_REG
reg: z28
is_list_member: 1
access: CS_AC_WRITE
vas: AARCH64LAYOUT_VL_B
-
type: AARCH64_OP_PRED
pred_reg: pn8
access: CS_AC_READ
-
type: AARCH64_OP_MEM
mem_base: x0
access: CS_AC_READ
regs_read: [pn8, x0]
regs_write: [z16, z20, z24, z28]
groups: [ HasSME2 ]

0 comments on commit be9c3b5

Please sign in to comment.