emit-rtl.c (gen_highpart): initialize `word' properly for pseudo.

Greg McGary gkm@eng.ascend.com
Fri Apr 17 02:23:00 GMT 1998


This fixes a bug recently introduced in expmed.c:
----------------------------
revision 1.23
date: 1998/04/02 01:33:22;  author: rth;  state: Exp;  lines: +21 -11
* emit-rtl.c (gen_lowpart_common): Skip count by HARD_REGNO_NREGS.
(gen_highpart): Likewise.
----------------------------

For little-endian targets, `word' remains 0 for psuedo registers,
which is clearly wrong.

Sun Apr 12 05:09:55 1998  Greg McGary  <gkm@gnu.org>

	* emit-rtl.c (gen_highpart): initialize `word' properly for pseudo.

Index: emit-rtl.c
===================================================================
RCS file: /home/cvsroot/tools/egcs/gcc/emit-rtl.c,v
retrieving revision 1.3
diff -u -p -c -r1.3 emit-rtl.c
/usr/local/bin/diff: conflicting specifications of output style
*** emit-rtl.c	1998/04/10 04:37:17	1.3
--- emit-rtl.c	1998/04/12 12:10:49
*************** gen_highpart (mode, x)
*** 1011,1028 ****
      }
    else if (GET_CODE (x) == REG)
      {
!       int word = 0;
  
        /* Let the backend decide how many registers to skip.  This is needed
           in particular for sparc64 where fp regs are smaller than a word.  */
        /* ??? Note that subregs are now ambiguous, in that those against
  	 pseudos are sized by the Word Size, while those against hard
  	 regs are sized by the underlying register size.  Better would be
  	 to always interpret the subreg offset parameter as bytes or bits.  */
! 
!       if (! WORDS_BIG_ENDIAN && REGNO (x) < FIRST_PSEUDO_REGISTER)
  	word = (HARD_REGNO_NREGS (REGNO (x), GET_MODE (x))
  		- HARD_REGNO_NREGS (REGNO (x), mode));
  
        if (REGNO (x) < FIRST_PSEUDO_REGISTER
  	  /* integrate.c can't handle parts of a return value register.  */
--- 1011,1034 ----
      }
    else if (GET_CODE (x) == REG)
      {
!       int word;
  
        /* Let the backend decide how many registers to skip.  This is needed
           in particular for sparc64 where fp regs are smaller than a word.  */
+ 
+       if (WORDS_BIG_ENDIAN)
+ 	word = 0;
        /* ??? Note that subregs are now ambiguous, in that those against
  	 pseudos are sized by the Word Size, while those against hard
  	 regs are sized by the underlying register size.  Better would be
  	 to always interpret the subreg offset parameter as bytes or bits.  */
!       else if (REGNO (x) < FIRST_PSEUDO_REGISTER)
  	word = (HARD_REGNO_NREGS (REGNO (x), GET_MODE (x))
  		- HARD_REGNO_NREGS (REGNO (x), mode));
+       else
+ 	word = ((GET_MODE_SIZE (GET_MODE (x))
+ 		 - MAX (GET_MODE_SIZE (mode), UNITS_PER_WORD))
+ 		/ UNITS_PER_WORD);
  
        if (REGNO (x) < FIRST_PSEUDO_REGISTER
  	  /* integrate.c can't handle parts of a return value register.  */



More information about the Gcc mailing list