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]

Re: matching constraints for differently sized operands (fwd)


>From amylaar@phal.cambridge.redhat.com  Sun Jan 21 02:14:53 2001
Return-Path: <amylaar@phal.cambridge.redhat.com>
Delivered-To: amylaar@cambridge.redhat.com
Received: from phal.cambridge.redhat.com (phal.cambridge.redhat.com [172.16.18.68])
	by executor.cambridge.redhat.com (Postfix) with ESMTP
	id 0469DABAA8; Sun, 21 Jan 2001 02:14:53 +0000 (GMT)
Received: (from amylaar@localhost)
	by phal.cambridge.redhat.com (8.11.0/8.11.0) id f0L2EqY01537;
	Sun, 21 Jan 2001 02:14:52 GMT
From: Joern Rennecke <amylaar@cambridge.redhat.com>
Message-Id: <200101210214.f0L2EqY01537@phal.cambridge.redhat.com>
Subject: Re: matching constraints for differently sized operands
To: law@cygnus.com
Date: Sun, 21 Jan 2001 02:14:52 +0000 (GMT)
In-Reply-To: <24445.968714920@upchuck> from "Jeffrey A Law" at Sep 11, 2000 05:28:40 PM
X-Mailer: ELM [version 2.5 PL3]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

> It seems to me you should change the controlling test from 
> && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD to use the
> HARD_REGNO_NREGS expression instead.  Or is that wrong for
> some reason?

No, it is actually more correct.  And it is also redundant with the
arithmetic that is performed.  So we can just remove that clause.

> It also seems that both changes should indicate why they're using
> HARD_REGNO_NREGS instead of GET_MODE_SIZE.....

It seems somewhat redundant to me, as you would think twice before
changing this back, but if you like the patch better that way, well,
here you go:

Sun Jan 21 02:06:33 2001  J"orn Rennecke <amylaar@redhat.com>

	* reload.c (operands_match_p): Use HARD_REGNO_NREGS for big-endian
	correction.
	(subst_reloads): Likewise.

Index: reload.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gcc/reload.c,v
retrieving revision 1.194
diff -p -r1.194 reload.c
*** reload.c	2001/01/07 02:30:14	1.194
--- reload.c	2001/01/21 02:12:36
*************** operands_match_p (x, y)
*** 2052,2064 ****
  
        /* On a WORDS_BIG_ENDIAN machine, point to the last register of a
  	 multiple hard register group, so that for example (reg:DI 0) and
! 	 (reg:SI 1) will be considered the same register.  */
!       if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (x)) > UNITS_PER_WORD
! 	  && i < FIRST_PSEUDO_REGISTER)
! 	i += (GET_MODE_SIZE (GET_MODE (x)) / UNITS_PER_WORD) - 1;
!       if (WORDS_BIG_ENDIAN && GET_MODE_SIZE (GET_MODE (y)) > UNITS_PER_WORD
! 	  && j < FIRST_PSEUDO_REGISTER)
! 	j += (GET_MODE_SIZE (GET_MODE (y)) / UNITS_PER_WORD) - 1;
  
        return i == j;
      }
--- 2052,2064 ----
  
        /* On a WORDS_BIG_ENDIAN machine, point to the last register of a
  	 multiple hard register group, so that for example (reg:DI 0) and
! 	 (reg:SI 1) will be considered the same register.
! 	 Don't try to guess the number of registers from the mode size -
! 	 that guess could be wrong.  That's what HARD_REGNO_NREGS is for.  */
!       if (WORDS_BIG_ENDIAN && i < FIRST_PSEUDO_REGISTER)
! 	i += HARD_REGNO_NREGS (i, GET_MODE (x)) - 1;
!       if (WORDS_BIG_ENDIAN && j < FIRST_PSEUDO_REGISTER)
! 	j += HARD_REGNO_NREGS (j, GET_MODE (y)) - 1;
  
        return i == j;
      }
*************** subst_reloads (insn)
*** 5688,5696 ****
  	  /* Encapsulate RELOADREG so its machine mode matches what
  	     used to be there.  Note that gen_lowpart_common will
  	     do the wrong thing if RELOADREG is multi-word.  RELOADREG
! 	     will always be a REG here.  */
  	  if (GET_MODE (reloadreg) != r->mode && r->mode != VOIDmode)
! 	    reloadreg = gen_rtx_REG (r->mode, REGNO (reloadreg));
  
  	  /* If we are putting this into a SUBREG and RELOADREG is a
  	     SUBREG, we would be making nested SUBREGs, so we have to fix
--- 5688,5706 ----
  	  /* Encapsulate RELOADREG so its machine mode matches what
  	     used to be there.  Note that gen_lowpart_common will
  	     do the wrong thing if RELOADREG is multi-word.  RELOADREG
! 	     will always be a REG here.
! 	     Don't try to guess the number of registers from the mode
! 	     size - that guess could be wrong.  That's what
! 	     HARD_REGNO_NREGS is for.  */
  	  if (GET_MODE (reloadreg) != r->mode && r->mode != VOIDmode)
! 	    {
! 	      int regno = REGNO (reloadreg);
! 
! 	      if (WORDS_BIG_ENDIAN)
! 		regno += (HARD_REGNO_NREGS (regno, GET_MODE (reloadreg))
! 			  - HARD_REGNO_NREGS (regno, r->mode));
! 	      reloadreg = gen_rtx_REG (r->mode, regno);
! 	    }
  
  	  /* If we are putting this into a SUBREG and RELOADREG is a
  	     SUBREG, we would be making nested SUBREGs, so we have to fix


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