Hello,

I've applied changes for AArch64 vectorizer config suggested by Richard Biener (here https://gcc.gnu.org/ml/gcc/2015-04/msg00086.html) and checked the effect on spec2006 and geekbench benchmarks.

Benchmarks were compiled with and without patch, in both cases with and without '-mcpu=cortex-a57'.

As it turns out, there is no effect of this change on generated code. With cortex-a57 flag, mentioned loop is not vectorized before and after the patch. Binaries for benchmarks test cases are identical. Without the flag loop is vectorized in both cases.

However, this change makes aarch64 vector costs consistent vectorizer code, while approach based on loop nesting level clearly underestimates cost of those statements.

Thanks,
Pawel

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 10df325..ffafc3f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2015-07-27  Pawel Kupidura <pawel.kupid...@arm.com>
+
+    * config/aarch64/aarch64.c: Changed inner loop statement cost
+    to be consistent with vectorizer code.
+
 2015-07-26  Uros Bizjak <ubiz...@gmail.com>

     * config/alpha/alpha.c: Use SUBREG_P predicate.
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 020f63c..3b6f8c5 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -7079,15 +7079,9 @@ aarch64_add_stmt_cost (void *data, int count, enum vect_cost_for_stmt kind,

       /* Statements in an inner loop relative to the loop being
      vectorized are weighted more heavily.  The value here is
-     a function (linear for now) of the loop nest level.  */
+     arbitrary and could potentially be improved with analysis.  */
if (where == vect_body && stmt_info && stmt_in_inner_loop_p (stmt_info))
-    {
-      loop_vec_info loop_info = STMT_VINFO_LOOP_VINFO (stmt_info);
-      struct loop *loop =  LOOP_VINFO_LOOP (loop_info);
-      unsigned nest_level = loop_depth (loop);
-
-      count *= nest_level;
-    }
+    count *= 50; /* FIXME */

       retval = (unsigned) (count * stmt_cost);
       cost[where] += retval;

Reply via email to