Skip to content

Commit 23c7f24

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 76554fe commit 23c7f24

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
@@ -264,7 +264,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
264264
case 'j':
265265
if (((l & MASK_C_ADDI) == MATCH_C_ADDI) && rd != 0)
266266
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 0);
267-
if (info->mach == bfd_mach_riscv64
267+
if (xlen > 32
268268
&& ((l & MASK_C_ADDIW) == MATCH_C_ADDIW) && rd != 0)
269269
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 1);
270270
print (info->stream, dis_style_immediate, "%d",
@@ -468,7 +468,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
468468
if (((l & MASK_ADDI) == MATCH_ADDI && rs1 != 0)
469469
|| (l & MASK_JALR) == MATCH_JALR)
470470
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
471-
if (info->mach == bfd_mach_riscv64
471+
if (xlen > 32
472472
&& ((l & MASK_ADDIW) == MATCH_ADDIW) && rs1 != 0)
473473
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 1);
474474
print (info->stream, dis_style_immediate, "%d",

0 commit comments

Comments
 (0)