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]

emit-rtl.c (gen_lowpart_common) fails with small UNITS_PER_WORD



There's a test in gen_lowpart_common () which appears to be trying to
exclude paradoxical SUBREGs.  However, if you have a machine where
UNITS_PER_WORD == 1 and BITS_PER_UNIT == 8 (e.g. a machine with 8 bit
registers and an 8 bit ALU), then this test will incorrectly fail to
return the low part when called with RTL like

       (subreg:SI (reg:DI 522) 4)

and the requested lowpart MODE is HImode.  [e.g. we're ASKING to get
back something like

       (subreg:HI (reg:DI 522) 6)

This patch handles machines where UNITS_PER_WORD is small and where we
find it desirable to support SI and DI arithmetic.  I would like to just
remove the direct comparison against UNITS_PER_WORD, but Richard Henderson
believes that is too risky a change and asked that I write a patch that
OR's my test with the existing tests.

ChangeLog entry:


2000-09-24  Alan Lehotsky  <alehotsky@cygnus.com>

	*  emit-rtl-c (gen_lowpart_common): Accept non-paradoxical SUBREG when
	UNITS_PER_WORD is small.
	

Index: emit-rtl.c
===================================================================
RCS file: /export/home/cvsroot/cygnus/devo/gcc/emit-rtl.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 emit-rtl.c
*** emit-rtl.c	2000/09/19 19:51:01	1.1.1.3
--- emit-rtl.c	2000/09/24 21:30:42
***************
*** 711,717 ****
	return gen_rtx_fmt_e (GET_CODE (x), mode, XEXP (x, 0));
      }
    else if (GET_CODE (x) == SUBREG
!	   && (GET_MODE_SIZE (mode) <= UNITS_PER_WORD
	       || GET_MODE_SIZE (mode) == GET_MODE_UNIT_SIZE (GET_MODE (x))))
      return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0
	    ? SUBREG_REG (x)
--- 711,718 ----
	return gen_rtx_fmt_e (GET_CODE (x), mode, XEXP (x, 0));
      }
    else if (GET_CODE (x) == SUBREG
!	   && (GET_MODE_SIZE (mode) <= GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))
!	       || GET_MODE_SIZE (mode) <= UNITS_PER_WORD
	       || GET_MODE_SIZE (mode) == GET_MODE_UNIT_SIZE (GET_MODE (x))))
      return (GET_MODE (SUBREG_REG (x)) == mode && SUBREG_WORD (x) == 0
	    ? SUBREG_REG (x)



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