This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Committed] Fix bootstrap failure on sparc64


The following patch fixes the sparc64 bootstrap failure reported by Eric
Botcazou that was caused by a latent bug exposed by the recent changes
to the default rtx_cost for a SUBREG.  The analysis of the problem was
posted here http://gcc.gnu.org/ml/gcc-patches/2005-01/msg01601.html

The following patch has been tested on i686-pc-linux-gnu with a full
"make bootstrap", all default languages, and regression tested with a
top-level "make -k check" with no new failures.  Many thanks again to
Eric for confirming this patch also bootstraps and regression tests
on sparc, sparc64 and amd64.

Committed to mainline CVS.



2005-01-23  Roger Sayle  <roger@eyesopen.com>
	    Eric Botcazou  <ebotcazou@libertysurf.fr>

	* combine.c (simplify_logical): Only simplify logical expressions
	of the form ior(and(x,y),z) by the inverse distributive law if the
	result is cheaper than the original.


Index: combine.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/combine.c,v
retrieving revision 1.470
diff -c -3 -p -r1.470 combine.c
*** combine.c	21 Jan 2005 02:14:25 -0000	1.470
--- combine.c	22 Jan 2005 20:53:48 -0000
*************** simplify_logical (rtx x)
*** 5574,5599 ****

        if (GET_CODE (op0) == AND)
  	{
! 	  x = apply_distributive_law
  	    (gen_binary (AND, mode,
  			 gen_binary (IOR, mode, XEXP (op0, 0), op1),
  			 gen_binary (IOR, mode, XEXP (op0, 1),
  				     copy_rtx (op1))));

! 	  if (GET_CODE (x) != IOR)
! 	    return x;
  	}

        if (GET_CODE (op1) == AND)
  	{
! 	  x = apply_distributive_law
  	    (gen_binary (AND, mode,
  			 gen_binary (IOR, mode, XEXP (op1, 0), op0),
  			 gen_binary (IOR, mode, XEXP (op1, 1),
  				     copy_rtx (op0))));

! 	  if (GET_CODE (x) != IOR)
! 	    return x;
  	}

        /* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the
--- 5574,5601 ----

        if (GET_CODE (op0) == AND)
  	{
! 	  rtx tmp = apply_distributive_law
  	    (gen_binary (AND, mode,
  			 gen_binary (IOR, mode, XEXP (op0, 0), op1),
  			 gen_binary (IOR, mode, XEXP (op0, 1),
  				     copy_rtx (op1))));

! 	  if (GET_CODE (tmp) != IOR
! 	      && rtx_cost (tmp, SET) < rtx_cost (x, SET))
! 	    return tmp;
  	}

        if (GET_CODE (op1) == AND)
  	{
! 	  rtx tmp = apply_distributive_law
  	    (gen_binary (AND, mode,
  			 gen_binary (IOR, mode, XEXP (op1, 0), op0),
  			 gen_binary (IOR, mode, XEXP (op1, 1),
  				     copy_rtx (op0))));

! 	  if (GET_CODE (tmp) != IOR
! 	      && rtx_cost (tmp, SET) < rtx_cost (x, SET))
! 	    return tmp;
  	}

        /* Convert (ior (ashift A CX) (lshiftrt A CY)) where CX+CY equals the

Roger
--


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]