Skip to content

Commit

Permalink
RISC-V: Use `xlen' on ADDIW address sequence
Browse files Browse the repository at this point in the history
Because XLEN for the disassembler is computed and stored in the `xlen'
variable, this commit replaces uses of `info->mach' with `xlen'
(testing for ADDIW / C.ADDIW address sequence).

opcodes/ChangeLog:

	* riscv-dis.c (print_insn_args): Use `xlen' to determine whether
	XLEN is larger than 32.
  • Loading branch information
a4lg committed Jul 13, 2022
1 parent dd4c046 commit 448fe9d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions opcodes/riscv-dis.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
case 'j':
if (((l & MASK_C_ADDI) == MATCH_C_ADDI) && rd != 0)
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 0);
if (info->mach == bfd_mach_riscv64
if (xlen > 32
&& ((l & MASK_C_ADDIW) == MATCH_C_ADDIW) && rd != 0)
maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 1);
print (info->stream, dis_style_immediate, "%d",
Expand Down Expand Up @@ -433,7 +433,7 @@ print_insn_args (const char *oparg, insn_t l, bfd_vma pc, disassemble_info *info
if (((l & MASK_ADDI) == MATCH_ADDI && rs1 != 0)
|| (l & MASK_JALR) == MATCH_JALR)
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
if (info->mach == bfd_mach_riscv64
if (xlen > 32
&& ((l & MASK_ADDIW) == MATCH_ADDIW) && rs1 != 0)
maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 1);
print (info->stream, dis_style_immediate, "%d",
Expand Down

0 comments on commit 448fe9d

Please sign in to comment.