public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ira Rosen <ira.rosen@linaro.org>
To: gcc-patches@gcc.gnu.org
Cc: Patch Tracking <patches@linaro.org>
Subject: [patch] Improve peeling heuristic in the vectorizer
Date: Sun, 12 Jun 2011 10:34:00 -0000	[thread overview]
Message-ID: <BANLkTimUp8Rk3DFCHmqUikr=GSoG2y9jww@mail.gmail.com> (raw)

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;

                 reply	other threads:[~2011-06-12  7:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='BANLkTimUp8Rk3DFCHmqUikr=GSoG2y9jww@mail.gmail.com' \
    --to=ira.rosen@linaro.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=patches@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).