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: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, Andreas Krebbel <krebbel1 at de dot ibm dot com>
- Date: Fri, 10 Feb 2006 11:45:37 +0100
- Subject: Re: [PATCH][PING] 2 tiny but unreviewed patches
- References: <20060210103037.GA3251@de.ibm.com>
Andreas Krebbel wrote:
Hello,
could please someone have a look at these:
Simplify inside CONST expressions:
http://gcc.gnu.org/ml/gcc-patches/2005-09/msg00320.html
hmm, I don't like the patch anymore. For example, I believe it cannot
simplify (plus (const (plus (something) 4)) (const_int 4)).
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);
}
assuming it works... ;-)
Paolo