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]

[RFA] three simple combine cleanups, 2/3: use simplify_const_binary_operation


This patch uses simplify_const_binary_operation in a couple
of places where, according to the surrounding source code or
comments, the transformations are meant to reassociate
operations so that they have constant operands.

This should be more efficient, and safer if these transforms are
ever moved to simplify_binary_operation_1.

Paolo

This patch uses simplify_const_binary_operation in a couple
of places where, according to the surrounding source code or
comments, the transformations are meant to reassociate
operations so that they have constant operands.

This should be more efficient, and safer if these transforms are
ever moved to simplify-rtx.c.

Paolo

2005-12-18  Paolo Bonzini  <bonzini@gnu.org>

        * combine.c (simplify_shift_const): Use, whenever applicable,
	simplify_const_binary_operation.

Index: combine.c
===================================================================
--- combine.c	(revision 108634)
+++ combine.c	(working copy)
@@ -8622,8 +8590,8 @@ simplify_shift_const (rtx x, enum rtx_co
 	      mask_rtx = GEN_INT (nonzero_bits (varop, GET_MODE (varop)));
 
 	      mask_rtx
-		= simplify_binary_operation (code, result_mode, mask_rtx,
-					     GEN_INT (count));
+		= simplify_const_binary_operation (code, result_mode, mask_rtx,
+						   GEN_INT (count));
 
 	      /* Give up if we can't compute an outer operation to use.  */
 	      if (mask_rtx == 0
@@ -8664,12 +8629,12 @@ simplify_shift_const (rtx x, enum rtx_co
 	     B is not a constant.  */
 
 	  else if (GET_CODE (varop) == code
-		   && GET_CODE (XEXP (varop, 1)) != CONST_INT
-		   && 0 != (new
-			    = simplify_binary_operation (code, mode,
-							 XEXP (varop, 0),
-							 GEN_INT (count))))
+		   && GET_CODE (XEXP (varop, 0)) == CONST_INT
+		   && GET_CODE (XEXP (varop, 1)) != CONST_INT)
 	    {
+	      rtx new = simplify_const_binary_operation (code, mode,
+							 XEXP (varop, 0),
+							 GEN_INT (count));
 	      varop = gen_rtx_fmt_ee (code, mode, new, XEXP (varop, 1));
 	      count = 0;
 	      continue;
@@ -8722,9 +8686,9 @@ simplify_shift_const (rtx x, enum rtx_co
 	      && !(code == ASHIFTRT && GET_CODE (varop) == XOR
 		   && 0 > trunc_int_for_mode (INTVAL (XEXP (varop, 1)),
 					      shift_mode))
-	      && (new = simplify_binary_operation (code, result_mode,
-						   XEXP (varop, 1),
-						   GEN_INT (count))) != 0
+	      && (new = simplify_const_binary_operation (code, result_mode,
+						         XEXP (varop, 1),
+						         GEN_INT (count))) != 0
 	      && GET_CODE (new) == CONST_INT
 	      && merge_outer_ops (&outer_op, &outer_const, GET_CODE (varop),
 				  INTVAL (new), result_mode, &complement_p))
@@ -8871,9 +8833,9 @@ simplify_shift_const (rtx x, enum rtx_co
 	  if (code == LSHIFTRT
 	      && GET_CODE (XEXP (varop, 1)) == CONST_INT
 	      && mode_signbit_p (result_mode, XEXP (varop, 1))
-	      && (new = simplify_binary_operation (code, result_mode,
-						   XEXP (varop, 1),
-						   GEN_INT (count))) != 0
+	      && (new = simplify_const_binary_operation (code, result_mode,
+						         XEXP (varop, 1),
+						         GEN_INT (count))) != 0
 	      && GET_CODE (new) == CONST_INT
 	      && merge_outer_ops (&outer_op, &outer_const, XOR,
 				  INTVAL (new), result_mode, &complement_p))

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