[3/7] Fix load/store costs for strided groups
authorRichard Sandiford <richard.sandiford@arm.com>
Wed, 6 Jul 2016 08:12:36 +0000 (08:12 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 6 Jul 2016 08:12:36 +0000 (08:12 +0000)
vect_model_store_cost had:

      /* Costs of the stores.  */
      if (STMT_VINFO_STRIDED_P (stmt_info)
          && !STMT_VINFO_GROUPED_ACCESS (stmt_info))
        {
          /* N scalar stores plus extracting the elements.  */
          inside_cost += record_stmt_cost (body_cost_vec,
       ncopies * TYPE_VECTOR_SUBPARTS (vectype),
       scalar_store, stmt_info, 0, vect_body);

But non-SLP strided groups also use individual scalar stores rather than
vector stores, so I think we should skip this only for SLP groups.

The same applies to vect_model_load_cost.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.

gcc/
* tree-vect-stmts.c (vect_model_store_cost): For non-SLP
strided groups, use the cost of N scalar accesses instead
of ncopies vector accesses.
(vect_model_load_cost): Likewise.

From-SVN: r238035

gcc/ChangeLog
gcc/tree-vect-stmts.c

index 408f4af44a2256c4a8e52054ad1b25cac4136caa..60dec98ebcde6ff35d4c8bdaf988849a397c4dcb 100644 (file)
@@ -1,3 +1,10 @@
+2016-07-06  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * tree-vect-stmts.c (vect_model_store_cost): For non-SLP
+       strided groups, use the cost of N scalar accesses instead
+       of ncopies vector accesses.
+       (vect_model_load_cost): Likewise.
+
 2016-07-06  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-stmts.c (vect_cost_group_size): Delete.
index aff0cc6851fd7f275eebeb0f5a551e696cda58e0..b17fa7b3f1851531d2d9d78b248c115bb6a43908 100644 (file)
@@ -926,8 +926,7 @@ vect_model_store_cost (stmt_vec_info stmt_info, int ncopies,
 
   tree vectype = STMT_VINFO_VECTYPE (stmt_info);
   /* Costs of the stores.  */
-  if (STMT_VINFO_STRIDED_P (stmt_info)
-      && !STMT_VINFO_GROUPED_ACCESS (stmt_info))
+  if (STMT_VINFO_STRIDED_P (stmt_info) && !slp_node)
     {
       /* N scalar stores plus extracting the elements.  */
       inside_cost += record_stmt_cost (body_cost_vec,
@@ -1059,8 +1058,7 @@ vect_model_load_cost (stmt_vec_info stmt_info, int ncopies,
     }
 
   /* The loads themselves.  */
-  if (STMT_VINFO_STRIDED_P (stmt_info)
-      && !STMT_VINFO_GROUPED_ACCESS (stmt_info))
+  if (STMT_VINFO_STRIDED_P (stmt_info) && !slp_node)
     {
       /* N scalar loads plus gathering them into a vector.  */
       tree vectype = STMT_VINFO_VECTYPE (stmt_info);