reg_nonzero_bits_for_combine misunderstood

Paulo Matos pmatos@broadcom.com
Thu Nov 28 11:45:00 GMT 2013


> -----Original Message-----
> From: Eric Botcazou [mailto:ebotcazou@adacore.com]
> Sent: 28 November 2013 11:27
> To: Paulo Matos
> Cc: gcc@gcc.gnu.org
> Subject: Re: reg_nonzero_bits_for_combine misunderstood
> 
> > Right, didn't notice nonzero_sign_valid below. I think restricting mode ==
> > last_set_mode is too restrictive.
> >
> > nonzero_bits is still valid if the new mode has less precision than the old
> > mode.
> 
> Sure, but I'm not suggesting to restrict anything, quite the contrary:
> 
>     {
>       unsigned HOST_WIDE_INT mask = rsp->last_set_nonzero_bits;
> 
>       if (GET_MODE_PRECISION (rsp->last_set_mode) < GET_MODE_PRECISION (mode))
> 	/* We don't know anything about the upper bits.  */
> 	mask |= GET_MODE_MASK (mode) ^ GET_MODE_MASK (rsp->last_set_mode);
>       *nonzero &= mask;
>       return NULL;
>     }

Ah, I re-read your message. :)
Your initial suggestion was to duplicate the patch in nonzero_sign_valid, not to duplicate the fix already in nonzero_sign_valid to nonzero_bits. Sorry.

Yes, I agree with your patch. That should be the way to go. If you're ok with it I will submit a patch to nonzero_bits and nonzero_sign_valid based on our discussion to gcc-patches for approval.


More information about the Gcc mailing list