public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/65962] Missed vectorization of strided stores
Date: Tue, 27 Oct 2015 11:16:00 -0000	[thread overview]
Message-ID: <bug-65962-4-wZh5zhq2Ws@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65962-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65962

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
The main difference is

+/home/wschmidt/gcc/gcc-mainline-base/gcc/testsuite/gcc.dg/vect/vect-62.c:39:3: 
note: LOOP VECTORIZED
+/home/wschmidt/gcc/gcc-mainline-base/gcc/testsuite/gcc.dg/vect/vect-62.c:39:3: 
note: OUTER LOOP VECTORIZED
...
-/home/wschmidt/gcc/gcc-mainline-base/gcc/testsuite/gcc.dg/vect/vect-62.c:9:5:
note: vectorized 1 loops in function.
+/home/wschmidt/gcc/gcc-mainline-base/gcc/testsuite/gcc.dg/vect/vect-62.c:9:5:
note: vectorized 2 loops in function.

so we now vectorize two loops.  The newly vectorized loop is

  /* Multidimensional array. Aligned. The "inner" dimensions
     are invariant in the inner loop. Vectorizable, but the
     vectorizer detects that everything is invariant and that
     the loop is better left untouched. (it should be optimized away). */
  for (i = 0; i < N; i++)
    {
      for (j = 0; j < N; j++)
        {
           ia[i][1][8] = ib[i];
        }
    }

on x86_64 the latch block is not empty - for some reason not so on ppc.
I suspect that if we had a cddce pass after loop invariant/store motion
(which should make the inner loop empty) we'd even remove the inner loop
and vectorize this regularly.

Ah, so on x86_64 we PREd ib[0] while on ppc the ib initializer is probably
in a constant pool entry.  Yes:

  <bb 2>:
  ib = *.LC0;

vs.

  <bb 2>:
  ib[0] = 0;
  ib[1] = 3;
  ib[2] = 6;
  ib[3] = 9;
...

The PRE heuristic to not confuse vectorization doesn't fire here.

I have a fix for that (and the testcase).


  parent reply	other threads:[~2015-10-27 11:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-01 11:45 [Bug middle-end/65962] New: " alalaw01 at gcc dot gnu.org
2015-05-01 11:46 ` [Bug middle-end/65962] " alalaw01 at gcc dot gnu.org
2015-05-04 11:19 ` rguenth at gcc dot gnu.org
2015-10-22 10:28 ` rguenth at gcc dot gnu.org
2015-10-22 13:33 ` rguenth at gcc dot gnu.org
2015-10-22 13:34 ` rguenth at gcc dot gnu.org
2015-10-23 22:32 ` wschmidt at gcc dot gnu.org
2015-10-26 11:51 ` rguenth at gcc dot gnu.org
2015-10-26 16:51 ` wschmidt at gcc dot gnu.org
2015-10-26 16:52 ` wschmidt at gcc dot gnu.org
2015-10-26 16:52 ` wschmidt at gcc dot gnu.org
2015-10-27 11:16 ` rguenth at gcc dot gnu.org [this message]
2015-10-27 13:17 ` wschmidt at gcc dot gnu.org
2015-10-28 10:10 ` rguenth at gcc dot gnu.org
2015-10-28 16:47 ` clyon at gcc dot gnu.org
2015-10-29  9:48 ` rguenther at suse dot de
2015-10-29 14:57 ` clyon at gcc dot gnu.org
2015-10-29 14:58 ` clyon at gcc dot gnu.org
2015-10-29 14:59 ` clyon at gcc dot gnu.org
2015-10-29 15:14 ` rguenth at gcc dot gnu.org
2015-10-30  9:49 ` clyon at gcc dot gnu.org

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=bug-65962-4-wZh5zhq2Ws@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).