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]

[PATCH] Move stuff to simplify-rtx.c, 12/13 - VEC_SELECT


This patch is the one I had already sent, split into thirteen pieces. I hope it's easier to review it. This one moves a VEC_SELECT simplification to simplify-rtx.c, that extracts a scalar out of many concatenated vectors. I also added a call to avoid_constant_pool_reference here.

The patch set was bootstrapped and regtested all in one, on powerpc-apple-darwin8.3.0 and i686-pc-linux-gnu.

Paolo
diff -paura combine-abs/combine.c combine-vec-select/combine.c
--- combine-abs/combine.c	2005-12-13 22:44:22.000000000 +0100
+++ combine-vec-select/combine.c	2005-12-13 22:45:21.000000000 +0100
@@ -4589,44 +4589,6 @@ combine_simplify_rtx (rtx x, enum machin
 			      NULL_RTX, 0));
       break;
 
-    case VEC_SELECT:
-      {
-	rtx op0 = XEXP (x, 0);
-	rtx op1 = XEXP (x, 1);
-	int len;
-
-	gcc_assert (GET_CODE (op1) == PARALLEL);
-	len = XVECLEN (op1, 0);
-	if (len == 1
-	    && GET_CODE (XVECEXP (op1, 0, 0)) == CONST_INT
-	    && GET_CODE (op0) == VEC_CONCAT)
-	  {
-	    int offset = INTVAL (XVECEXP (op1, 0, 0)) * GET_MODE_SIZE (GET_MODE (x));
-
-	    /* Try to find the element in the VEC_CONCAT.  */
-	    for (;;)
-	      {
-		if (GET_MODE (op0) == GET_MODE (x))
-		  return op0;
-		if (GET_CODE (op0) == VEC_CONCAT)
-		  {
-		    HOST_WIDE_INT op0_size = GET_MODE_SIZE (GET_MODE (XEXP (op0, 0)));
-		    if (offset < op0_size)
-		      op0 = XEXP (op0, 0);
-		    else
-		      {
-			offset -= op0_size;
-			op0 = XEXP (op0, 1);
-		      }
-		  }
-		else
-		  break;
-	      }
-	  }
-      }
-
-      break;
-
     default:
       break;
     }
diff -paura combine-abs/simplify-rtx.c combine-vec-select/simplify-rtx.c
--- combine-abs/simplify-rtx.c	2005-12-13 22:51:23.000000000 +0100
+++ combine-vec-select/simplify-rtx.c	2005-12-13 22:51:35.000000000 +0100
@@ -2467,6 +2467,33 @@ simplify_binary_operation_1 (enum rtx_co
 	      return gen_rtx_CONST_VECTOR (mode, v);
 	    }
 	}
+
+      if (XVECLEN (trueop1, 0) == 1
+	  && GET_CODE (XVECEXP (trueop1, 0, 0)) == CONST_INT
+	  && GET_CODE (trueop0) == VEC_CONCAT)
+	{
+	  rtx vec = trueop0;
+	  int offset = INTVAL (XVECEXP (trueop1, 0, 0)) * GET_MODE_SIZE (mode);
+
+	  /* Try to find the element in the VEC_CONCAT.  */
+	  while (GET_MODE (vec) != mode
+		 && GET_CODE (vec) == VEC_CONCAT)
+	    {
+	      HOST_WIDE_INT vec_size = GET_MODE_SIZE (GET_MODE (XEXP (vec, 0)));
+	      if (offset < vec_size)
+		vec = XEXP (vec, 0);
+	      else
+		{
+		  offset -= vec_size;
+		  vec = XEXP (vec, 1);
+		}
+	      vec = avoid_constant_pool_reference (vec);
+	    }
+
+	  if (GET_MODE (vec) == mode)
+	    return vec;
+	}
+
       return 0;
     case VEC_CONCAT:
       {

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