This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] pdp11: Output negative values as signed rather than unsigned
- From: Paul Koning <paul_koning at dell dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 7 Dec 2010 14:58:40 -0500
- Subject: [PATCH] pdp11: Output negative values as signed rather than unsigned
This patch fixes some cases where offsets were concatenated with symbol names. It also helps readability of the .s file.
Tested by build and make check. Committed.
paul
ChangeLog:
2010-12-07 Paul Koning <ni1d@arrl.net>
* config/pdp11/pdp11.c (output_addr_const_pdp11): Output negative
values with sign rather than as unsigned.
Index: config/pdp11/pdp11.c
===================================================================
--- config/pdp11/pdp11.c (revision 167553)
+++ config/pdp11/pdp11.c (working copy)
@@ -1881,7 +1881,8 @@
output_addr_const_pdp11 (FILE *file, rtx x)
{
char buf[256];
-
+ int i;
+
restart:
switch (GET_CODE (x))
{
@@ -1905,7 +1906,13 @@
break;
case CONST_INT:
- fprintf (file, "%#o", (int) INTVAL (x) & 0xffff);
+ i = INTVAL (x);
+ if (i < 0)
+ {
+ i = -i;
+ fprintf (file, "-");
+ }
+ fprintf (file, "%#o", i & 0xffff);
break;
case CONST:
@@ -1953,16 +1960,10 @@
goto restart;
output_addr_const_pdp11 (file, XEXP (x, 0));
- fprintf (file, "-");
- if (GET_CODE (XEXP (x, 1)) == CONST_INT
- && INTVAL (XEXP (x, 1)) < 0)
- {
- fprintf (file, targetm.asm_out.open_paren);
- output_addr_const_pdp11 (file, XEXP (x, 1));
- fprintf (file, targetm.asm_out.close_paren);
- }
- else
- output_addr_const_pdp11 (file, XEXP (x, 1));
+ if (GET_CODE (XEXP (x, 1)) != CONST_INT
+ || INTVAL (XEXP (x, 1)) >= 0)
+ fprintf (file, "-");
+ output_addr_const_pdp11 (file, XEXP (x, 1));
break;
case ZERO_EXTEND: