public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Improve peeling heuristic in the vectorizer
@ 2011-06-12 10:34 Ira Rosen
  0 siblings, 0 replies; only message in thread
From: Ira Rosen @ 2011-06-12 10:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: Patch Tracking

Hi,

gcc.dg/vect/vect-72.c is not expected to use loop peeling for
alignment, but it does on ARM with double-word vectors. The loop
contains two data-refs of type char: one is aligned and the other is
misaligned by 1. When the cost model is disabled the peeling heuristic
chooses to peel a number of scalar iterations that aligns the highest
number of data-refs in the loop. When there are two (with different
alignment), the decision is arbitrary, which causes the vectorizer to
peel 7 iterations in vect-72.c, while not peeling at all is an
obviously better option (at least since the cost model is disabled).
This patch takes into account the required number of iterations to
peel.

Bootstrapped and tested on powerpc64-suse-linux, and tested the
vectorizer testsuite on arm-linux-gnueabi.
Committed.

Ira

ChangeLog:

      * tree-vect-data-refs.c (vect_peeling_hash_get_most_frequent):
      Take number of iterations to peel into account for equally frequent
      misalignment values.

Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c       (revision 174964)
+++ tree-vect-data-refs.c       (working copy)
@@ -1248,7 +1248,9 @@ vect_peeling_hash_get_most_frequent (void **slot,
   vect_peel_info elem = (vect_peel_info) *slot;
   vect_peel_extended_info max = (vect_peel_extended_info) data;

-  if (elem->count > max->peel_info.count)
+  if (elem->count > max->peel_info.count
+      || (elem->count == max->peel_info.count
+          && max->peel_info.npeel > elem->npeel))
     {
       max->peel_info.npeel = elem->npeel;
       max->peel_info.count = elem->count;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-06-12  7:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-12 10:34 [patch] Improve peeling heuristic in the vectorizer Ira Rosen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).