pdp11: fix wrong assembly output

Submitted by Paul Koning on Oct. 29, 2010, 4:12 p.m.

Details

Message ID 526AED0A-A7F1-4229-9FC6-FAEE9684067A@dell.com
State New
Headers show

Commit Message

Paul Koning Oct. 29, 2010, 4:12 p.m.
The pdp11 back-end was generating bad output (in the sense that pdp11-gas would not accept it) for addresses that are simple integers.  This patch fixes that, which cures a number of testsuite failures.

Committed.

ChangeLog:

2010-10-29  Paul Koning  <ni1d@arrl.net>

	* config/pdp11/pdp11.c (print_operand_address): Correct handling
	of integer constant addresses, delete vax-only logic.

Comments

Gerald Pfeifer Oct. 31, 2010, 6:53 p.m.
On Fri, 29 Oct 2010, Paul Koning wrote:
> The pdp11 back-end was generating bad output (in the sense that 
> pdp11-gas would not accept it) for addresses that are simple integers.  
> This patch fixes that, which cures a number of testsuite failures.

Have you considered submitting your test results to the
gcc-testresults@gcc.gnu.org mailing list?  I don't see
any posting in the October archive so far, but perhaps
you've been seeing to many failures for the message to
fit the mailing list size limit?

Gerald
Paul Koning Nov. 1, 2010, 10:41 a.m.
On Oct 31, 2010, at 2:53 PM, Gerald Pfeifer wrote:

> On Fri, 29 Oct 2010, Paul Koning wrote:
>> The pdp11 back-end was generating bad output (in the sense that 
>> pdp11-gas would not accept it) for addresses that are simple integers.  
>> This patch fixes that, which cures a number of testsuite failures.
> 
> Have you considered submitting your test results to the
> gcc-testresults@gcc.gnu.org mailing list?  I don't see
> any posting in the October archive so far, but perhaps
> you've been seeing to many failures for the message to
> fit the mailing list size limit?

I'm planning to submit those results.  I figured I would weed out the obvious dumb mistakes first.

	paul

Patch hide | download patch | download mbox

Index: config/pdp11/pdp11.c
===================================================================
--- config/pdp11/pdp11.c	(revision 166063)
+++ config/pdp11/pdp11.c	(working copy)
@@ -905,14 +905,13 @@ 
 }
 
 
-/* --- stole from out-vax, needs changes */
-
 void
 print_operand_address (FILE *file, register rtx addr)
 {
-  register rtx reg1, reg2, breg, ireg;
+  register rtx breg;
   rtx offset;
-
+  int again = 0;
+  
  retry:
 
   switch (GET_CODE (addr))
@@ -923,6 +922,7 @@ 
       else
 	fprintf (file, "@");
       addr = XEXP (addr, 0);
+      again = 1;
       goto retry;
 
     case REG:
@@ -940,8 +940,7 @@ 
       break;
 
     case PLUS:
-      reg1 = 0;	reg2 = 0;
-      ireg = 0;	breg = 0;
+      breg = 0;
       offset = 0;
       if (CONSTANT_ADDRESS_P (XEXP (addr, 0))
 	  || GET_CODE (XEXP (addr, 0)) == MEM)
@@ -957,32 +956,20 @@ 
 	}
       if (GET_CODE (addr) != PLUS)
 	;
-      else if (GET_CODE (XEXP (addr, 0)) == MULT)
-	{
-	  reg1 = XEXP (addr, 0);
-	  addr = XEXP (addr, 1);
-	}
-      else if (GET_CODE (XEXP (addr, 1)) == MULT)
-	{
-	  reg1 = XEXP (addr, 1);
-	  addr = XEXP (addr, 0);
-	}
       else if (GET_CODE (XEXP (addr, 0)) == REG)
 	{
-	  reg1 = XEXP (addr, 0);
+	  breg = XEXP (addr, 0);
 	  addr = XEXP (addr, 1);
 	}
       else if (GET_CODE (XEXP (addr, 1)) == REG)
 	{
-	  reg1 = XEXP (addr, 1);
+	  breg = XEXP (addr, 1);
 	  addr = XEXP (addr, 0);
 	}
-      if (GET_CODE (addr) == REG || GET_CODE (addr) == MULT)
+      if (GET_CODE (addr) == REG)
 	{
-	  if (reg1 == 0)
-	    reg1 = addr;
-	  else
-	    reg2 = addr;
+	  gcc_assert (breg == 0);
+	  breg = addr;
 	  addr = 0;
 	}
       if (offset != 0)
@@ -990,44 +977,22 @@ 
 	  gcc_assert (addr == 0);
 	  addr = offset;
 	}
-      if (reg1 != 0 && GET_CODE (reg1) == MULT)
-	{
-	  breg = reg2;
-	  ireg = reg1;
-	}
-      else if (reg2 != 0 && GET_CODE (reg2) == MULT)
-	{
-	  breg = reg1;
-	  ireg = reg2;
-	}
-      else if (reg2 != 0 || GET_CODE (addr) == MEM)
-	{
-	  breg = reg2;
-	  ireg = reg1;
-	}
-      else
-	{
-	  breg = reg1;
-	  ireg = reg2;
-	}
       if (addr != 0)
-	output_address (addr);
+	output_addr_const_pdp11 (file, addr);
       if (breg != 0)
 	{
 	  gcc_assert (GET_CODE (breg) == REG);
 	  fprintf (file, "(%s)", reg_names[REGNO (breg)]);
 	}
-      if (ireg != 0)
-	{
-	  if (GET_CODE (ireg) == MULT)
-	    ireg = XEXP (ireg, 0);
-	  gcc_assert (GET_CODE (ireg) == REG);
-	  gcc_unreachable(); /* ??? */
-	  fprintf (file, "[%s]", reg_names[REGNO (ireg)]);
-	}
       break;
 
     default:
+      if (!again && GET_CODE (addr) == CONST_INT)
+	{
+	  /* Absolute (integer number) address.  */
+	  if (!TARGET_UNIX_ASM)
+	    fprintf (file, "@$");
+	}
       output_addr_const_pdp11 (file, addr);
     }
 }