This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Minor simplify_rtx improvement
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Subject: Re: Minor simplify_rtx improvement
- From: law at redhat dot com
- Date: Fri, 29 Jun 2001 16:06:23 -0700
- cc: gcc-patches at gcc dot gnu dot org
- Reply-To: law at redhat dot com
In message <10106280120.AA27941@vlsi1.ultra.nyu.edu>you write:
> + /* Put complex operands first and constants second if commutative.
> */
> + if (GET_RTX_CLASS (code) == 'c'
> + && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
> + || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o'
> + && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')
> + || (GET_CODE (XEXP (x, 0)) == SUBREG
> + && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o'
> + && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')))
> + {
>
> This should call swap_commutative_operands_p (in rtlanal.c).
OK. Bootstrapped ia32-linux.
* simplify-rtx.c (simplify_rtx): Use swap_commutative_operands_p.
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/simplify-rtx.c,v
retrieving revision 1.63
diff -c -3 -p -r1.63 simplify-rtx.c
*** simplify-rtx.c 2001/06/29 21:15:01 1.63
--- simplify-rtx.c 2001/06/29 22:59:23
*************** simplify_rtx (x)
*** 2526,2539 ****
return simplify_unary_operation (code, mode,
XEXP (x, 0), GET_MODE (XEXP (x, 0)));
case 'c':
! /* Put complex operands first and constants second if commutative. */
! if (GET_RTX_CLASS (code) == 'c'
! && ((CONSTANT_P (XEXP (x, 0)) && GET_CODE (XEXP (x, 1)) != CONST_INT)
! || (GET_RTX_CLASS (GET_CODE (XEXP (x, 0))) == 'o'
! && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')
! || (GET_CODE (XEXP (x, 0)) == SUBREG
! && GET_RTX_CLASS (GET_CODE (SUBREG_REG (XEXP (x, 0)))) == 'o'
! && GET_RTX_CLASS (GET_CODE (XEXP (x, 1))) != 'o')))
{
rtx tem;
--- 2526,2532 ----
return simplify_unary_operation (code, mode,
XEXP (x, 0), GET_MODE (XEXP (x, 0)));
case 'c':
! if (swap_commutative_operands_p (XEXP (x, 0), XEXP (x, 1)))
{
rtx tem;