This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][PING] 2 tiny but unreviewed patches
- From: Andreas Krebbel <krebbel1 at de dot ibm dot com>
- To: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 10 Feb 2006 13:22:35 +0100
- Subject: Re: [PATCH][PING] 2 tiny but unreviewed patches
- References: <20060210103037.GA3251@de.ibm.com> <43EC6ED1.8060802@lu.unisi.ch>
Hi,
> hmm, I don't like the patch anymore. For example, I believe it cannot
> simplify (plus (const (plus (something) 4)) (const_int 4)).
Oh. I think the simplication would be done quite well but we would miss
to rewrap it in a CONST expression. This is even worse than a missing
simplification.
> My impression is that this is not enough:
>
> + if (GET_CODE (lhs) == CONST && GET_CODE (rhs) == CONST)
> + {
> + gcc_assert (GET_MODE (lhs) == GET_MODE (rhs));
> + if (!CONSTANT_P (tem))
> + tem = gen_rtx_CONST (GET_MODE (lhs), tem);
> + }
>
> I'd rather do something like
>
> if (CONSTANT_P (lhs) && CONSTANT_P (rhs) && !CONSTANT_P (tem))
> {
> gcc_assert (GET_MODE (tem) != VOIDmode);
> gcc_assert (GET_CODE (lhs) == CONST || GET_CODE (rhs) == CONST);
> tem = gen_rtx_CONST (GET_MODE (tem), tem);
> }
With this patch I was always a bit concerned about creating to complicated
CONST expressions. Thats why I've tried to make it as special (for my purpose)
as possible. But I agree that adding a const_int to a const expression should
always make a valid const rtx.
So I'll give it a whirl - thanks!
Bye,
-Andreas-