aboutsummaryrefslogtreecommitdiff
path: root/opcodes/arm-dis.c
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes/arm-dis.c')
-rw-r--r--opcodes/arm-dis.c83
1 files changed, 46 insertions, 37 deletions
diff --git a/opcodes/arm-dis.c b/opcodes/arm-dis.c
index ab6570a..a4919ca 100644
--- a/opcodes/arm-dis.c
+++ b/opcodes/arm-dis.c
@@ -1893,6 +1893,8 @@ print_insn_coprocessor (bfd_vma pc,
func (stream, ", #%d]%s",
offset,
WRITEBACK_BIT_SET ? "!" : "");
+ else if (NEGATIVE_BIT_SET)
+ func (stream, ", #-0]");
else
func (stream, "]");
}
@@ -1904,10 +1906,14 @@ print_insn_coprocessor (bfd_vma pc,
{
if (offset)
func (stream, ", #%d", offset);
+ else if (NEGATIVE_BIT_SET)
+ func (stream, ", #-0");
}
else
{
- func (stream, ", {%d}", offset);
+ func (stream, ", {%s%d}",
+ (NEGATIVE_BIT_SET && !offset) ? "-" : "",
+ offset);
value_in_comment = offset;
}
}
@@ -2338,13 +2344,15 @@ print_arm_address (bfd_vma pc, struct disassemble_info *info, long given)
func (stream, "[pc");
- if (NEGATIVE_BIT_SET)
- offset = - offset;
-
if (PRE_BIT_SET)
{
- /* Pre-indexed. */
- func (stream, ", #%d]", offset);
+ /* Pre-indexed. Elide offset of positive zero when
+ non-writeback. */
+ if (WRITEBACK_BIT_SET || NEGATIVE_BIT_SET || offset)
+ func (stream, ", #%s%d", NEGATIVE_BIT_SET ? "-" : "", offset);
+
+ if (NEGATIVE_BIT_SET)
+ offset = -offset;
offset += pc + 8;
@@ -2352,12 +2360,11 @@ print_arm_address (bfd_vma pc, struct disassemble_info *info, long given)
being used. Probably a very dangerous thing
for the programmer to do, but who are we to
argue ? */
- if (WRITEBACK_BIT_SET)
- func (stream, "!");
+ func (stream, "]%s", WRITEBACK_BIT_SET ? "!" : "");
}
else /* Post indexed. */
{
- func (stream, "], #%d", offset);
+ func (stream, "], #%s%d", NEGATIVE_BIT_SET ? "-" : "", offset);
/* Ie ignore the offset. */
offset = pc + 8;
@@ -2376,15 +2383,14 @@ print_arm_address (bfd_vma pc, struct disassemble_info *info, long given)
{
if ((given & 0x02000000) == 0)
{
+ /* Elide offset of positive zero when non-writeback. */
offset = given & 0xfff;
- if (offset)
- func (stream, ", #%s%d",
- NEGATIVE_BIT_SET ? "-" : "", offset);
+ if (WRITEBACK_BIT_SET || NEGATIVE_BIT_SET || offset)
+ func (stream, ", #%s%d", NEGATIVE_BIT_SET ? "-" : "", offset);
}
else
{
- func (stream, ", %s",
- NEGATIVE_BIT_SET ? "-" : "");
+ func (stream, ", %s", NEGATIVE_BIT_SET ? "-" : "");
arm_decode_shift (given, func, stream, TRUE);
}
@@ -2395,12 +2401,10 @@ print_arm_address (bfd_vma pc, struct disassemble_info *info, long given)
{
if ((given & 0x02000000) == 0)
{
+ /* Always show offset. */
offset = given & 0xfff;
- if (offset)
- func (stream, "], #%s%d",
- NEGATIVE_BIT_SET ? "-" : "", offset);
- else
- func (stream, "]");
+ func (stream, "], #%s%d",
+ NEGATIVE_BIT_SET ? "-" : "", offset);
}
else
{
@@ -2993,20 +2997,23 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
/* PC relative with immediate offset. */
int offset = ((given & 0xf00) >> 4) | (given & 0xf);
- if (NEGATIVE_BIT_SET)
- offset = - offset;
-
if (PRE_BIT_SET)
{
- if (offset)
- func (stream, "[pc, #%d]\t; ", offset);
+ /* Elide positive zero offset. */
+ if (offset || NEGATIVE_BIT_SET)
+ func (stream, "[pc, #%s%d]\t; ",
+ NEGATIVE_BIT_SET ? "-" : "", offset);
else
- func (stream, "[pc]\t; ");
+ func (stream, "[pc]\t; ");
+ if (NEGATIVE_BIT_SET)
+ offset = -offset;
info->print_address_func (offset + pc + 8, info);
}
else
{
- func (stream, "[pc], #%d", offset);
+ /* Always show the offset. */
+ func (stream, "[pc], #%s%d",
+ NEGATIVE_BIT_SET ? "-" : "", offset);
if (! allow_unpredictable)
is_unpredictable = TRUE;
}
@@ -3015,9 +3022,6 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
{
int offset = ((given & 0xf00) >> 4) | (given & 0xf);
- if (NEGATIVE_BIT_SET)
- offset = - offset;
-
func (stream, "[%s",
arm_regnames[(given >> 16) & 0xf]);
@@ -3025,13 +3029,15 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
{
if (IMMEDIATE_BIT_SET)
{
- if (WRITEBACK_BIT_SET)
- /* Immediate Pre-indexed. */
- /* PR 10924: Offset must be printed, even if it is zero. */
- func (stream, ", #%d", offset);
- else if (offset)
- /* Immediate Offset: printing zero offset is optional. */
- func (stream, ", #%d", offset);
+ /* Elide offset for non-writeback
+ positive zero. */
+ if (WRITEBACK_BIT_SET || NEGATIVE_BIT_SET
+ || offset)
+ func (stream, ", #%s%d",
+ NEGATIVE_BIT_SET ? "-" : "", offset);
+
+ if (NEGATIVE_BIT_SET)
+ offset = -offset;
value_in_comment = offset;
}
@@ -3059,7 +3065,10 @@ print_insn_arm (bfd_vma pc, struct disassemble_info *info, long given)
{
/* Immediate Post-indexed. */
/* PR 10924: Offset must be printed, even if it is zero. */
- func (stream, "], #%d", offset);
+ func (stream, "], #%s%d",
+ NEGATIVE_BIT_SET ? "-" : "", offset);
+ if (NEGATIVE_BIT_SET)
+ offset = -offset;
value_in_comment = offset;
}
else