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] Generic vectorization 1/3


This patch avoids using GET_MODE_NUNITS, it instead uses TYPE_VECTOR_SUBPARTS directly on the mode.

Patch 2/3 tries to use UNITS_PER_WORD-sized vector modes. Patch 3/3 accepts integer modes as well and adds testsuite support.

Bootstrapped/regtested powerpc-apple-darwin, ok for mainline?

Paolo
2005-04-06  Paolo Bonzini  <bonzini@gnu.org>

	* tree-vect-analyze (vect_determine_vectorization_factor):
	Do not use GET_MODE_NUNITS.
	* tree-vect-transform.c (vect_get_vec_def_for_operand,
	(vectorizable_load, vect_transform_loop): Likewise.

Index: tree-vect-analyze.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-analyze.c,v
retrieving revision 2.17
diff -p -u -u -r2.17 tree-vect-analyze.c
--- tree-vect-analyze.c	6 Apr 2005 07:59:01 -0000	2.17
+++ tree-vect-analyze.c	6 Apr 2005 08:30:27 -0000
@@ -390,7 +392,7 @@ vect_determine_vectorization_factor (loo
             }
           STMT_VINFO_VECTYPE (stmt_info) = vectype;
 
-          nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
+          nunits = TYPE_VECTOR_SUBPARTS (vectype);
           if (vect_print_dump_info (REPORT_DETAILS, UNKNOWN_LOC))
             fprintf (vect_dump, "nunits = %d", nunits);
 
Index: tree-vect-transform.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vect-transform.c,v
retrieving revision 2.9
diff -p -u -u -r2.9 tree-vect-transform.c
--- tree-vect-transform.c	29 Mar 2005 17:45:39 -0000	2.9
+++ tree-vect-transform.c	6 Apr 2005 08:30:28 -0000
@@ -505,7 +505,7 @@ vect_get_vec_def_for_operand (tree op, t
   stmt_vec_info def_stmt_info = NULL;
   stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt);
   tree vectype = STMT_VINFO_VECTYPE (stmt_vinfo);
-  int nunits = GET_MODE_NUNITS (TYPE_MODE (vectype));
+  int nunits = TYPE_VECTOR_SUBPARTS (vectype);
   loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo);
   struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
   basic_block bb;
@@ -1064,7 +1099,7 @@ vectorizable_load (tree stmt, block_stmt
 
       /* <2> Create lsq = *(floor(p2')) in the loop  */ 
       offset = build_int_cst (integer_type_node, 
-			      GET_MODE_NUNITS (TYPE_MODE (vectype)));
+			      TYPE_VECTOR_SUBPARTS (vectype));
       offset = int_const_binop (MINUS_EXPR, offset, integer_one_node, 1);
       vec_dest = vect_create_destination_var (scalar_dest, vectype);
       dataref_ptr = vect_create_data_ref_ptr (stmt, bsi, offset, &dummy, false);
@@ -1817,7 +1852,7 @@ vect_transform_loop (loop_vec_info loop_
 	  /* FORNOW: Verify that all stmts operate on the same number of
 	             units and no inner unrolling is necessary.  */
 	  gcc_assert 
-		(GET_MODE_NUNITS (TYPE_MODE (STMT_VINFO_VECTYPE (stmt_info)))
+		(TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info))
 		 == vectorization_factor);
 #endif
 	  /* -------- vectorize statement ------------ */

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