+2020-01-10 Alan Modra <amodra@gmail.com>
+
+ * m10300-dis.c (disassemble): Move extraction of DREG, AREG, RREG,
+ and XRREG value earlier to avoid a shift with negative exponent.
+ * m10200-dis.c (disassemble): Similarly.
+
2020-01-09 Nick Clifton <nickc@redhat.com>
PR 25224
operand = &mn10200_operands[*opindex_ptr];
- if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0)
+ if ((operand->flags & MN10200_OPERAND_DREG) != 0
+ || (operand->flags & MN10200_OPERAND_AREG) != 0)
+ value = ((insn >> (operand->shift + extra_shift))
+ & ((1 << operand->bits) - 1));
+ else if ((operand->flags & MN10200_OPERAND_EXTENDED) != 0)
{
value = (insn & 0xffff) << 8;
value |= extension;
}
else
- {
- value = ((insn >> (operand->shift))
- & ((1L << operand->bits) - 1L));
- }
+ value = ((insn >> (operand->shift))
+ & ((1L << operand->bits) - 1L));
if ((operand->flags & MN10200_OPERAND_SIGNED) != 0)
value = ((long)(value << (32 - operand->bits))
nocomma = 0;
if ((operand->flags & MN10200_OPERAND_DREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "d%ld", value);
- }
+ (*info->fprintf_func) (info->stream, "d%ld", value);
else if ((operand->flags & MN10200_OPERAND_AREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "a%ld", value);
- }
+ (*info->fprintf_func) (info->stream, "a%ld", value);
else if ((operand->flags & MN10200_OPERAND_PSW) != 0)
(*info->fprintf_func) (info->stream, "psw");
if ((operand->flags & MN10300_OPERAND_PLUS) != 0)
nocomma = 1;
- if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
+ if ((operand->flags & MN10300_OPERAND_DREG) != 0
+ || (operand->flags & MN10300_OPERAND_AREG) != 0
+ || (operand->flags & MN10300_OPERAND_RREG) != 0
+ || (operand->flags & MN10300_OPERAND_XRREG) != 0)
+ value = ((insn >> (operand->shift + extra_shift))
+ & ((1 << operand->bits) - 1));
+ else if ((operand->flags & MN10300_OPERAND_SPLIT) != 0)
{
unsigned long temp;
nocomma = 0;
if ((operand->flags & MN10300_OPERAND_DREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "d%d", (int) value);
- }
+ (*info->fprintf_func) (info->stream, "d%d", (int) value);
else if ((operand->flags & MN10300_OPERAND_AREG) != 0)
- {
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
- (*info->fprintf_func) (info->stream, "a%d", (int) value);
- }
+ (*info->fprintf_func) (info->stream, "a%d", (int) value);
else if ((operand->flags & MN10300_OPERAND_SP) != 0)
(*info->fprintf_func) (info->stream, "sp");
else if ((operand->flags & MN10300_OPERAND_RREG) != 0)
{
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
if (value < 8)
(*info->fprintf_func) (info->stream, "r%d", (int) value);
else if (value < 12)
else if ((operand->flags & MN10300_OPERAND_XRREG) != 0)
{
- value = ((insn >> (operand->shift + extra_shift))
- & ((1 << operand->bits) - 1));
if (value == 0)
(*info->fprintf_func) (info->stream, "sp");
else