[PATCH] Optimize subregs of zero and sign extensions

Richard Henderson rth@redhat.com
Wed Jan 21 18:54:00 GMT 2004


On Wed, Jan 21, 2004 at 10:30:08AM -0700, Roger Sayle wrote:
> 	* simplify-rtx.c (simplify_subreg): Optimize subregs of zero and
> 	sign extensions.

Ok, except,

> +       unsigned int lsbword, lsbbyte, lsbbitpos;
> +
> +       if (WORDS_BIG_ENDIAN)
> + 	lsbword = (GET_MODE_SIZE (innermode)
> + 		   - (byte + GET_MODE_SIZE (outermode))) / UNITS_PER_WORD;
> +       else
> + 	lsbword = byte / UNITS_PER_WORD;
> +       lsbbitpos = lsbword * BITS_PER_WORD;
> +
> +       if (BYTES_BIG_ENDIAN)
> + 	lsbbyte = (GET_MODE_SIZE (innermode)
> + 		   - (byte + GET_MODE_SIZE (outermode))) % UNITS_PER_WORD;
> +       else
> + 	lsbbyte = byte % UNITS_PER_WORD;
> +       lsbbitpos += lsbbyte * BITS_PER_UNIT;

Again, you should be using subreg_lsb.


r~



More information about the Gcc-patches mailing list