[PATCH] Fix ICE in do_SUBST

Jakub Jelinek jakub@redhat.com
Fri May 17 00:07:00 GMT 2002


On Thu, May 16, 2002 at 06:05:45PM -0700, Richard Henderson wrote:
> On Fri, May 17, 2002 at 12:35:39AM +0200, Jakub Jelinek wrote:
> > -      /* If OP1 is a CONST_INT and X is an IOR or XOR, clear bits outside
> > -	 MASK since OP1 might have been sign-extended but we never want
> > -	 to turn on extra bits, since combine might have previously relied
> > -	 on them being off.  */
> > -      if (GET_CODE (op1) == CONST_INT && (code == IOR || code == XOR)
> > -	  && (INTVAL (op1) & mask) != 0)
> > -	op1 = GEN_INT (INTVAL (op1) & mask);
> 
> It appears that MASK can be arbitrary.  I don't feel good about
> removing this entirely.  How about
> 
> 	op1 = gen_int_mode (INTVAL (op1) & mask, op_mode);

The force_to_mode call on CONST_INT above it already masks it
(maybe this should be rewritten using gen_int_mode though):

  if (GET_CODE (x) == CONST_INT)
    {
      HOST_WIDE_INT cval = INTVAL (x) & mask;
      int width = GET_MODE_BITSIZE (mode);

      /* If MODE is narrower that HOST_WIDE_INT and CVAL is a negative
         number, sign extend it.  */
      if (width > 0 && width < HOST_BITS_PER_WIDE_INT
          && (cval & ((HOST_WIDE_INT) 1 << (width - 1))) != 0)
        cval |= (HOST_WIDE_INT) -1 << width;

      return GEN_INT (cval);
    }

so I don't think it is necessary to duplicate it there again.

	Jakub



More information about the Gcc-patches mailing list