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1
[^:]+:[ ]+01fc4537[ ]+lui[ ]+a0,0x1fc4
-[^:]+:[ ]+c915051b[ ]+addiw[ ]+a0,a0,-879
+[^:]+:[ ]+c915051b[ ]+addiw[ ]+a0,a0,-879 # .*
[^:]+:[ ]+0536[ ]+slli[ ]+a0,a0,0xd
[^:]+:[ ]+1565[ ]+addi[ ]+a0,a0,-7
[^:]+:[ ]+0536[ ]+slli[ ]+a0,a0,0xd
-[^:]+:[ ]+34550513[ ]+addi[ ]+a0,a0,837 # .*
+[^:]+:[ ]+34550513[ ]+addi[ ]+a0,a0,837
[^:]+:[ ]+0532[ ]+slli[ ]+a0,a0,0xc
[^:]+:[ ]+0505[ ]+addi[ ]+a0,a0,1
0: 0010051b addiw a0,zero,1
4: 00001537 lui a0,0x1
8: 00001537 lui a0,0x1
- c: 0015051b addiw a0,a0,1
+ c: 0015051b addiw a0,a0,1 # .*
10: 00001537 lui a0,0x1
- 14: fff5051b addiw a0,a0,-1
+ 14: fff5051b addiw a0,a0,-1 # .*
18: 80000537 lui a0,0x80000
- 1c: fff5051b addiw a0,a0,-1
+ 1c: fff5051b addiw a0,a0,-1 # .*
20: 0000051b sext.w a0,zero
24: fff0051b addiw a0,zero,-1
28: 80000537 lui a0,0x80000
}
static void
-maybe_print_address (struct riscv_private_data *pd, int base_reg, int offset)
+maybe_print_address (struct riscv_private_data *pd, int base_reg, int offset,
+ int wide)
{
if (pd->hi_addr[base_reg] != (bfd_vma)-1)
{
pd->print_addr = pd->gp + offset;
else if (base_reg == X_TP || base_reg == 0)
pd->print_addr = offset;
+
+ /* Sign-extend a 32-bit value to a 64-bit value. */
+ if (wide)
+ pd->print_addr = (bfd_vma)(int32_t) pd->print_addr;
}
/* Print insn arguments for 32/64-bit code. */
break;
case 'o':
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
+ && ((l & MASK_C_ADDIW) == MATCH_C_ADDIW) && rd != 0)
+ maybe_print_address (pd, rd, EXTRACT_CITYPE_IMM (l), 1);
print (info->stream, "%d", (int)EXTRACT_CITYPE_IMM (l));
break;
case 'k':
case 'b':
case 's':
if ((l & MASK_JALR) == MATCH_JALR)
- maybe_print_address (pd, rs1, 0);
+ maybe_print_address (pd, rs1, 0, 0);
print (info->stream, "%s", riscv_gpr_names[rs1]);
break;
break;
case 'o':
- maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l));
+ maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
/* Fall through. */
case 'j':
if (((l & MASK_ADDI) == MATCH_ADDI && rs1 != 0)
|| (l & MASK_JALR) == MATCH_JALR)
- maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l));
+ maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 0);
+ if (info->mach == bfd_mach_riscv64
+ && ((l & MASK_ADDIW) == MATCH_ADDIW) && rs1 != 0)
+ maybe_print_address (pd, rs1, EXTRACT_ITYPE_IMM (l), 1);
print (info->stream, "%d", (int)EXTRACT_ITYPE_IMM (l));
break;
case 'q':
- maybe_print_address (pd, rs1, EXTRACT_STYPE_IMM (l));
+ maybe_print_address (pd, rs1, EXTRACT_STYPE_IMM (l), 0);
print (info->stream, "%d", (int)EXTRACT_STYPE_IMM (l));
break;