Minor simplify_rtx improvement

law@redhat.com law@redhat.com
Fri Jun 29 16:07:00 GMT 2001


  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;
  




More information about the Gcc-patches mailing list