diff mbox

Fix PowerPC64 non-delegitimized UNSPEC

Message ID 20110304134532.GD6275@bubble.grove.modra.org
State New
Headers show

Commit Message

Alan Modra March 4, 2011, 1:45 p.m. UTC
gcc.c-torture/execute/20040709-1.c has been failing for a while when
regression testing cmodel medium powerpc64 gcc.  Details of the
failure in the PR.  This cures the problem by teaching
rs6000_delegitimize_address a few more tricks.  Bootstrap and
regression test in progress.  OK to apply assuming no regressions?

	PR target/47986
	* config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
	full cmodel medium/large lo_sum + high addresses.

Comments

David Edelsohn March 4, 2011, 5:02 p.m. UTC | #1
On Fri, Mar 4, 2011 at 8:45 AM, Alan Modra <amodra@gmail.com> wrote:
> gcc.c-torture/execute/20040709-1.c has been failing for a while when
> regression testing cmodel medium powerpc64 gcc.  Details of the
> failure in the PR.  This cures the problem by teaching
> rs6000_delegitimize_address a few more tricks.  Bootstrap and
> regression test in progress.  OK to apply assuming no regressions?
>
>        PR target/47986
>        * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle
>        full cmodel medium/large lo_sum + high addresses.

Okay.

Thanks, David
diff mbox

Patch

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c	(revision 170673)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -6248,17 +6239,23 @@  rs6000_delegitimize_address (rtx orig_x)
   if (MEM_P (x))
     x = XEXP (x, 0);
 
-  if ((GET_CODE (x) == PLUS
-       || GET_CODE (x) == LO_SUM)
-      && GET_CODE (XEXP (x, 0)) == REG
-      && (REGNO (XEXP (x, 0)) == TOC_REGISTER
-	  || TARGET_MINIMAL_TOC
-	  || TARGET_CMODEL != CMODEL_SMALL)
+  if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS)
       && GET_CODE (XEXP (x, 1)) == CONST)
     {
       y = XEXP (XEXP (x, 1), 0);
       if (GET_CODE (y) == UNSPEC
-          && XINT (y, 1) == UNSPEC_TOCREL)
+          && XINT (y, 1) == UNSPEC_TOCREL
+	  && ((GET_CODE (XEXP (x, 0)) == REG
+	       && (REGNO (XEXP (x, 0)) == TOC_REGISTER
+		   || TARGET_MINIMAL_TOC
+		   || TARGET_CMODEL != CMODEL_SMALL))
+	      || (TARGET_CMODEL != CMODEL_SMALL
+		  && GET_CODE (XEXP (x, 0)) == PLUS
+		  && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
+		  && REGNO (XEXP (XEXP (x, 0), 0)) == TOC_REGISTER
+		  && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH
+		  && rtx_equal_p (XEXP (x, 1),
+				  XEXP (XEXP (XEXP (x, 0), 1), 0)))))
 	{
 	  y = XVECEXP (y, 0, 0);
 	  if (!MEM_P (orig_x))