[PATCH] Simplifying RTL shifts to narrower modes

Richard Henderson rth@redhat.com
Thu Jan 6 23:56:00 GMT 2005


On Thu, Jan 06, 2005 at 10:43:27AM -0700, Roger Sayle wrote:
> Narrowing the mode of operators in simplify-rtx.c seems reasonable
> from a middle-end perspective, but I'm posting this RFA to enquire of
> the backend folks if this sort of transformation is likely to cause
> problems for targets with PARTIAL_REGISTER_STALLs etc...  Presumably
> this should already be handled by .md file patterns and constraints,

Indeed it should.

> 	* simplify-rtx.c (simplify_subreg): Simplify truncations of shifts
> 	of sign or zero extended values.

Ok, but

> +   /* Simplify (subreg:QI (lshiftrt:SI (sign_extend:SI (x:QI)) C), 0) into
> +      to (ashiftrt:QI (x:QI) C), where C is a suitable small constant and
> +      the outer subreg is effectively a truncation to the original mode.  */
> +   if ((GET_CODE (op) == LSHIFTRT
> +        || GET_CODE (op) == ASHIFTRT)
> +       && SCALAR_INT_MODE_P (outermode)
> +       && (2 * GET_MODE_BITSIZE (outermode)) <= GET_MODE_BITSIZE (innermode)

Could do with a word or two about this last line.  Took me a moment
or five to figure it out.


r~



More information about the Gcc-patches mailing list