Skip to content

Commit ce79fba

Browse files
committed
RISC-V: Use static xlen on ADDIW sequence
Because XLEN for the disassembler is computed and stored in the xlen variable, this commit replaces uses of info->mach with xlen (when testing for ADDIW / C.ADDIW address sequence). Not just we used two ways to determine current XLEN, info->mach and xlen, xlen is going to be more important in the future commits. opcodes/ChangeLog: * riscv-dis.c (print_insn_args): Use xlen variable to determine whether XLEN is larger than 32.
1 parent 6f81076 commit ce79fba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

opcodes/riscv-dis.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
261261
case 'j':
262262
if (((l & MASK_C_ADDI) == MATCH_C_ADDI) && rd != 0)
263263
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 0);
264-
if (info->mach == bfd_mach_riscv64
264+
if (xlen > 32
265265
&& ((l & MASK_C_ADDIW) == MATCH_C_ADDIW) && rd != 0)
266266
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 1);
267267
print (info->stream, dis_style_immediate, "%d",
@@ -461,7 +461,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
461461
if (((l & MASK_ADDI) == MATCH_ADDI && rs1 != 0)
462462
|| (l & MASK_JALR) == MATCH_JALR)
463463
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
464-
if (info->mach == bfd_mach_riscv64
464+
if (xlen > 32
465465
&& ((l & MASK_ADDIW) == MATCH_ADDIW) && rs1 != 0)
466466
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 1);
467467
print (info->stream, dis_style_immediate, "%d",

0 commit comments

Comments
 (0)