This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH]: Simplify inside CONST expressions
- 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: Tue, 06 Sep 2005 09:12:27 +0200
- Subject: Re: [PATCH]: Simplify inside CONST expressions
- References: <20050905135022.GA3306@de.ibm.com>
! if (GET_CODE (lhs) == CONST && GET_CODE (rhs) == CONST
! && GET_MODE (lhs) == GET_MODE (rhs))
! {
! tem = simplify_binary_operation (ncode, mode,
! XEXP (lhs, 0),
! XEXP (rhs, 0));
! if (!CONSTANT_P (tem))
! tem = gen_rtx_CONST (GET_MODE (lhs), tem);
! }
! else
! tem = simplify_binary_operation (ncode, mode, lhs, rhs);
What about this instead:
{
rtx tem_lhs = GET_CODE (lhs) == CONST ? XEXP (lhs, 0) : lhs;
rtx tem_rhs = GET_CODE (rhs) == CONST ? XEXP (rhs, 0) : rhs;
tem = simplify_binary_operation (ncode, mode, tem_lhs, tem_rhs);
if (GET_CODE (lhs) == CONST && GET_CODE (rhs) == CONST)
{
gcc_assert (GET_MODE (lhs) == GET_MODE (rhs));
if (!CONSTANT (tem))
tem = gen_rtx_CONST (GET_MODE (lhs), tem);
}
}
Paolo