diff mbox

pdp11: Output negative values as signed rather than unsigned

Message ID 4096220D-33C7-4B94-8487-F17763A3EF4C@dell.com
State New
Headers show

Commit Message

Paul Koning Dec. 7, 2010, 7:58 p.m. UTC
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.
diff mbox

Patch

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: