Do not convert a subtract of zero into an add of zero.
authorNick Clifton <nickc@redhat.com>
Thu, 2 May 2002 09:11:14 +0000 (09:11 +0000)
committerNick Clifton <nickc@redhat.com>
Thu, 2 May 2002 09:11:14 +0000 (09:11 +0000)
gas/ChangeLog
gas/config/tc-arm.c
gas/testsuite/ChangeLog
gas/testsuite/gas/arm/arm7t.d
gas/testsuite/gas/arm/arm7t.s

index 76b97adf60d0f48cd768b36ddeee2016b867167d..6244a8751757f7a6463d3c703f17e90ed84bba45 100644 (file)
@@ -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
index 162553f6436b8581185bd6bd4f6898bfac87084a..1370f13e5ae8f0bf8b9b2a038f1bc0be8dad7bde 100644 (file)
@@ -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)
index 428b6a20457cff6b6863f9b2377cedadb803bfa8..6e552b7e11f39720d67ac53f7bc8f03622a816fe 100644 (file)
@@ -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.
index dc4993a0b52d632bf684c56c6ffb287a6ab2afa5..87b388f5e63620d2b256be88714e383de5088b3c 100644 (file)
@@ -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
index d155752eedd7c8d79cc5eae22f274e1abba2e477..f3251117d1877c3bf490e31ab8b7bc60f7fa21ed 100644 (file)
@@ -72,3 +72,11 @@ misc:
        .align
 .L2:
        .word   fred
+       
+       .ltorg
+       .thumb
+       .global thumb_tests
+       .thumb_func
+thumb_tests:   
+       sub     r0, #0
+       add     r0, #0
This page took 0.03989 seconds and 4 git commands to generate.