This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: bug fix for validate_replace_rtx_1
- To: rth at redhat dot com (Richard Henderson)
- Subject: Re: bug fix for validate_replace_rtx_1
- From: Joern Rennecke <amylaar at cambridge dot redhat dot com>
- Date: Sun, 21 Jan 2001 07:01:54 +0000 (GMT)
- Cc: amylaar at cambridge dot redhat dot com (Joern Rennecke),gcc-patches at gcc dot gnu dot org
Talk about last-minute changes... this:
> ! valh = vall < 0 ? ~0 : 0;
Doesn't work with an unsigned vall.
That showed up as an 'comparison is always false' warning in my pre-checkin
bootstrap. It also wanted four more parentheses for differences used as
shiftcount. OK to amend the patch as below?
Sun Jan 21 06:53:09 2001 J"orn Rennecke <amylaar@redhat.com>
* recog.c (validate_replace_rtx_1): In ZERO_EXTEND / SIGN_EXTEND
case, don't use operand_subword to calculate a SUBREG that is
wider than a word.
Index: recog.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/recog.c,v
retrieving revision 1.86
diff -p -r1.86 recog.c
*** recog.c 2000/11/27 17:50:11 1.86
--- recog.c 2001/01/21 06:52:53
*************** validate_replace_rtx_1 (loc, from, to, o
*** 491,498 ****
/* If there is a subreg involved, crop to the portion of the
constant that we are interested in. */
if (GET_CODE (XEXP (x, 0)) == SUBREG)
! to = operand_subword (to, SUBREG_WORD (XEXP (x, 0)),
! 0, GET_MODE (from));
/* If the above didn't fail, perform the extension from the
mode of the operand (and not the mode of FROM). */
--- 491,532 ----
/* If there is a subreg involved, crop to the portion of the
constant that we are interested in. */
if (GET_CODE (XEXP (x, 0)) == SUBREG)
! {
! if (GET_MODE_SIZE (GET_MODE (XEXP (x, 0))) <= UNITS_PER_WORD)
! to = operand_subword (to, SUBREG_WORD (XEXP (x, 0)),
! 0, GET_MODE (from));
! else if (GET_MODE_CLASS (GET_MODE (from)) == MODE_INT
! && (GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0)))
! <= HOST_BITS_PER_WIDE_INT))
! {
! int i = SUBREG_WORD (XEXP (x, 0)) * BITS_PER_WORD;
! HOST_WIDE_INT valh;
! unsigned HOST_WIDE_INT vall;
!
! if (GET_CODE (to) == CONST_INT)
! {
! vall = INTVAL (to);
! valh = (HOST_WIDE_INT) vall < 0 ? ~0 : 0;
! }
! else
! {
! vall = CONST_DOUBLE_LOW (to);
! valh = CONST_DOUBLE_HIGH (to);
! }
!
! if (WORDS_BIG_ENDIAN)
! i = (GET_MODE_BITSIZE (GET_MODE (from))
! - GET_MODE_BITSIZE (GET_MODE (XEXP (x, 0))) - i);
! if (i > 0 && i < HOST_BITS_PER_WIDE_INT)
! vall = vall >> i | valh << (HOST_BITS_PER_WIDE_INT - i);
! else if (i >= HOST_BITS_PER_WIDE_INT)
! vall = valh >> (i - HOST_BITS_PER_WIDE_INT);
! to = GEN_INT (trunc_int_for_mode (vall,
! GET_MODE (XEXP (x, 0))));
! }
! else
! to = gen_rtx_CLOBBER (GET_MODE (x), const0_rtx);
! }
/* If the above didn't fail, perform the extension from the
mode of the operand (and not the mode of FROM). */