This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Simplifying RTL shifts to narrower modes
- From: Richard Henderson <rth at redhat dot com>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 6 Jan 2005 15:56:05 -0800
- Subject: Re: [PATCH] Simplifying RTL shifts to narrower modes
- References: <Pine.LNX.firstname.lastname@example.org>
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.
> + /* 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.