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]

Re: [RFA:] cse.c:cse_insn: Fix gcc.c-torture/compile/simd-1.c for mmix-knuth-mmixware


On Tue, Aug 13, 2002 at 04:50:41AM -0400, Hans-Peter Nilsson wrote:
> Instead, let's not try and enter an equivalence where the mode
> does not match the destination.

In this case, it seems nicer to just use the existing expression
directly, like so.


r~


	* cse.c (cse_insn): Avoid subreg games if the equivalence
	is already in the proper mode.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.231
diff -c -p -d -r1.231 cse.c
*** cse.c	10 Jul 2002 15:08:04 -0000	1.231
--- cse.c	4 Sep 2002 23:01:01 -0000
*************** cse_insn (insn, libcall_insn)
*** 6203,6216 ****
  		    && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
  		  continue;
  
! 		/* Calculate big endian correction for the SUBREG_BYTE
! 		   (or equivalent).  We have already checked that M1
! 		   ( GET_MODE (dest) ) is not narrower than M2 (new_mode).  */
! 		if (BYTES_BIG_ENDIAN)
! 		  byte = (GET_MODE_SIZE (GET_MODE (dest))
! 			  - GET_MODE_SIZE (new_mode));
! 		new_src = simplify_gen_subreg (new_mode, elt->exp,
! 					       GET_MODE (dest), byte);
  		/* The call to simplify_gen_subreg fails if the value
  		   is VOIDmode, yet we can't do any simplification, e.g.
  		   for EXPR_LISTs denoting function call results.
--- 6203,6225 ----
  		    && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
  		  continue;
  
! 		/* We may have already been playing subreg games.  If the
! 		   mode is already correct for the destination, use it.  */
! 		if (GET_MODE (elt->exp) == new_mode)
! 		  new_src = elt->exp;
! 		else
! 		  {
! 		    /* Calculate big endian correction for the SUBREG_BYTE.
! 		       We have already checked that M1 (GET_MODE (dest))
! 		       is not narrower than M2 (new_mode).  */
! 		    if (BYTES_BIG_ENDIAN)
! 		      byte = (GET_MODE_SIZE (GET_MODE (dest))
! 			      - GET_MODE_SIZE (new_mode));
! 
! 		    new_src = simplify_gen_subreg (new_mode, elt->exp,
! 					           GET_MODE (dest), byte);
! 		  }
! 
  		/* The call to simplify_gen_subreg fails if the value
  		   is VOIDmode, yet we can't do any simplification, e.g.
  		   for EXPR_LISTs denoting function call results.


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