This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: [RFC] nonzero_bits (was Re: Another Java sparc-sun-solaris2.8 bootstrap failure)


On Wed, Mar 27, 2002 at 02:17:49PM -0800, Richard Henderson wrote:
> > -	  && reg_last_set_mode[REGNO (x)] == mode
> > +	  && (reg_last_set_mode[REGNO (x)] == mode
> > +	      || (GET_MODE_CLASS (reg_last_set_mode[REGNO (x)]) == MODE_INT
> > +		  && GET_MODE_CLASS (mode) == MODE_INT))
> 
> Need to check that both modes fit HOST_BITS_PER_WIDE_INT, no?

mode is surely fits in HOST_BITS_PER_WIDE_INT (early in nonzero_bits):

  if (mode_width > HOST_BITS_PER_WIDE_INT)
    /* Our only callers in this case look for single bit values.  So
       just return the mode mask.  Those tests will then be false.  */
    return nonzero;

For reg_last_set_mode this is not guaranteed, but guess it would be better
to do it in the following hunk (if reg_last_set_mode will be bigger than
HOST_WIDE_INT, then nonzero_bits will return ~(HWI)0):

> 
> > +      enum machine_mode mode = GET_MODE (reg);
> >        subst_low_cuid = INSN_CUID (insn);
> > -      reg_last_set_mode[regno] = GET_MODE (reg);
> > -      reg_last_set_nonzero_bits[regno] = nonzero_bits (value, GET_MODE (reg));
> > +      reg_last_set_mode[regno] = mode;
> > +      if (GET_MODE_CLASS (mode) == MODE_INT)

Replace the above line with
if (GET_MODE_CLASS (mode) == MODE_INT
    && GET_MODE_BITSIZE (mode) <= HOST_BITS_PER_WIDE_INT)

> > +	mode = nonzero_bits_mode;
> > +      reg_last_set_nonzero_bits[regno] = nonzero_bits (value, mode);
> 
> Looks ok.
> 
> >  	  if (SUBREG_PROMOTED_UNSIGNED_P (subreg))
> > +	    /* XXX Is this correct even for MODE_INT modes
> > +	       if reg_last_set_nonzero_bits was computed for
> > +	       nonzero_bits_mode larger than reg_last_set_mode?  */
> >  	    reg_last_set_nonzero_bits[regno] &= GET_MODE_MASK (mode);
> 
> Yes.  SUBREG_PROMOTED_UNSIGNED_P is an affirmation.

The thing I'm not sure about is if there is:
(subreg/u:QI (reg:SI ))
and nonzero_bits_mode is DI, whether this sais anything about the upper 32
bits (ie. if it shouldn't be &= 0xffffffff000000ff instead of 0xff above).

	Jakub


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