This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][PING] 2 tiny but unreviewed patches


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-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]