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: [cft] subreg validation patch


I wrote:

>Richard Henderson <rth@redhat.com> wrote on 11/15/2004 11:02:32 PM:
>
>> Hmm.  How about lowpart_subreg?  At least then we won't wind up
>> with nested subregs.
>
>src is guaranteed to satisfy REG_P at this point, so this shouldn't
>be an issue.  (Also, regmove.c already uses gen_lowpart_SUBREG at
>another similar location.)

On second thought, you're probably right: gen_lowpart_SUBREG may
abort (with your change), and we certainly don't want that here.
So I've changed the patch to use lowpart_subreg, and just ignore
that move if the subreg cannot be generated.

Bootstraped/regtested on s390-ibm-linux and s390x-ibm-linux
(with your patch applied as well).

OK for mainline?

Bye,
Ulrich


ChangeLog:

	* regmove.c (regmove_optimize): Use lowpart_subreg instead of
	gen_rtx_SUBREG with incorrect offset to compute SRC_SUBREG.

Index: gcc/regmove.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regmove.c,v
retrieving revision 1.164
diff -c -p -r1.164 regmove.c
*** gcc/regmove.c	9 Oct 2004 19:19:24 -0000	1.164
--- gcc/regmove.c	16 Nov 2004 11:44:46 -0000
*************** regmove_optimize (rtx f, int nregs, FILE
*** 1150,1159 ****
  		  && GET_MODE_SIZE (GET_MODE (dst))
  		     >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (dst))))
  		{
- 		  src_subreg
- 		    = gen_rtx_SUBREG (GET_MODE (SUBREG_REG (dst)),
- 				      src, SUBREG_BYTE (dst));
  		  dst = SUBREG_REG (dst);
  		}
  	      if (!REG_P (dst)
  		  || REGNO (dst) < FIRST_PSEUDO_REGISTER)
--- 1150,1160 ----
  		  && GET_MODE_SIZE (GET_MODE (dst))
  		     >= GET_MODE_SIZE (GET_MODE (SUBREG_REG (dst))))
  		{
  		  dst = SUBREG_REG (dst);
+ 		  src_subreg = lowpart_subreg (GET_MODE (dst),
+ 					       src, GET_MODE (src));
+ 		  if (!src_subreg)
+ 		    continue;
  		}
  	      if (!REG_P (dst)
  		  || REGNO (dst) < FIRST_PSEUDO_REGISTER)

-- 
  Dr. Ulrich Weigand
  Linux on zSeries Development
  Ulrich.Weigand@de.ibm.com


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