aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2002-05-02 09:11:14 +0000
committerNick Clifton <nickc@redhat.com>2002-05-02 09:11:14 +0000
commit358b94bdb1b02dbc21a19719fbaa9fbe9c93c61a (patch)
treed0b02dbcc68889da178e2d6726023ee0b6a0a9f5 /gas
parentd3427997ad759f705f99611018da19512ca2bbb0 (diff)
downloadgdb-358b94bdb1b02dbc21a19719fbaa9fbe9c93c61a.zip
gdb-358b94bdb1b02dbc21a19719fbaa9fbe9c93c61a.tar.gz
gdb-358b94bdb1b02dbc21a19719fbaa9fbe9c93c61a.tar.bz2
Do not convert a subtract of zero into an add of zero.
Diffstat (limited to 'gas')
-rw-r--r--gas/ChangeLog5
-rw-r--r--gas/config/tc-arm.c8
-rw-r--r--gas/testsuite/ChangeLog6
-rw-r--r--gas/testsuite/gas/arm/arm7t.d2
-rw-r--r--gas/testsuite/gas/arm/arm7t.s8
5 files changed, 26 insertions, 3 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 76b97ad..6244a87 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+2002-05-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * config/tc-arm.c (thumb_add_sub): Do not convert a subtract of
+ zero into an add of zero - it is not the same.
+
2002-05-01 Arati Dikey <aratid@kpit.com>
* tc-sh.c (get_specific): Generate warning if the same
diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c
index 162553f..1370f13 100644
--- a/gas/config/tc-arm.c
+++ b/gas/config/tc-arm.c
@@ -7433,11 +7433,11 @@ thumb_add_sub (str, subtract)
int offset = inst.reloc.exp.X_add_number;
if (subtract)
- offset = -offset;
+ offset = - offset;
if (offset < 0)
{
- offset = -offset;
+ offset = - offset;
subtract = 1;
/* Quick check, in case offset is MIN_INT. */
@@ -7447,7 +7447,9 @@ thumb_add_sub (str, subtract)
return;
}
}
- else
+ /* Note - you cannot convert a subtract of 0 into an
+ add of 0 because the carry flag is set differently. */
+ else if (offset > 0)
subtract = 0;
if (Rd == REG_SP)
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 428b6a2..6e552b7 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2002-05-02 Nick Clifton <nickc@cambridge.redhat.com>
+
+ * gas/arm/arm7t.s: Add thumb mode "sub r?, #0" and "add r?, #0".
+ * gas/arm/arm7t.d: Add expected results. (Make sure that the
+ subtract is not converted into an add).
+
2002-04-23 H.J. Lu <hjl@gnu.org>
* gas/mips/elempic.d: Use empic.l.
diff --git a/gas/testsuite/gas/arm/arm7t.d b/gas/testsuite/gas/arm/arm7t.d
index dc4993a..87b388f 100644
--- a/gas/testsuite/gas/arm/arm7t.d
+++ b/gas/testsuite/gas/arm/arm7t.d
@@ -66,3 +66,5 @@ Disassembly of section .text:
[ ]*dc:.*fred
0+e0 <[^>]*> 0000c0de ? .*
0+e4 <[^>]*> 0000dead ? .*
+0+e8 <[^>]*> 3800 sub r0, #0
+0+ea <[^>]*> 3000 add r0, #0
diff --git a/gas/testsuite/gas/arm/arm7t.s b/gas/testsuite/gas/arm/arm7t.s
index d155752..f325111 100644
--- a/gas/testsuite/gas/arm/arm7t.s
+++ b/gas/testsuite/gas/arm/arm7t.s
@@ -72,3 +72,11 @@ misc:
.align
.L2:
.word fred
+
+ .ltorg
+ .thumb
+ .global thumb_tests
+ .thumb_func
+thumb_tests:
+ sub r0, #0
+ add r0, #0