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 tree-optimization/99395] s116 benchmark of TSVC is vectorized by clang and not by gcc
Date: Tue, 18 Oct 2022 10:37:07 +0000	[thread overview]
Message-ID: <bug-99395-4-MNJVDRwrhr@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-99395-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixing the CSE in the testcase by doing

double a[1024];
void foo ()
{
  for (int i = 0; i < 1022; i += 2)
    {
      double tem = a[i+1];
      a[i] = tem * a[i];
      a[i+1] = a[i+2] * tem;
    }
}

gets us

t.c:4:21: note:   Detected interleaving load a[i_15] and a[_1]
t.c:4:21: note:   Detected interleaving store a[i_15] and a[_1]
t.c:4:21: note:   Detected interleaving load of size 2
t.c:4:21: note:         _2 = a[i_15];
t.c:4:21: note:         tem_10 = a[_1];
t.c:4:21: note:   Detected single element interleaving a[_4] step 16
t.c:4:21: note:   Detected interleaving store of size 2
t.c:4:21: note:         a[i_15] = _3;
t.c:4:21: note:         a[_1] = _6;

in the loop pass and failed dependence analysis and
with the SLP pass (no predcom):

t.c:10:1: note:   Detected interleaving load a[i_15] and a[_1]
t.c:10:1: note:   Detected interleaving load a[i_15] and a[_4]
t.c:10:1: note:   Detected interleaving store a[i_15] and a[_1]
t.c:10:1: note:   Detected interleaving load of size 3
t.c:10:1: note:         _2 = a[i_15];
t.c:10:1: note:         tem_10 = a[_1];
t.c:10:1: note:         _5 = a[_4];
t.c:10:1: note:   Detected interleaving store of size 2
t.c:10:1: note:         a[i_15] = _3;
t.c:10:1: note:         a[_1] = _6;

which then runs into gap vect issues for how we'd vectorize the three
element load.

The dependence analysis is done by analyzing the validity of the
vectorized load/store placement and the implied motion of the
scalar load/store statements.  The missed optimization here would
be the missed alternate placement that would be correct.  But I
think the way we form groups would need to be revisited first here.

  parent reply	other threads:[~2022-10-18 10:37 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-04 23:01 [Bug middle-end/99395] New: " hubicka at gcc dot gnu.org
2021-03-04 23:24 ` [Bug middle-end/99395] " hubicka at gcc dot gnu.org
2021-03-05  8:27 ` [Bug tree-optimization/99395] " rguenth at gcc dot gnu.org
2021-03-05 15:42 ` hubicka at gcc dot gnu.org
2022-10-18 10:28 ` rguenth at gcc dot gnu.org
2022-10-18 10:37 ` rguenth at gcc dot gnu.org [this message]
2023-10-07  9:10 ` juzhe.zhong at rivai dot ai
2023-10-09  6:30 ` rguenth at gcc dot gnu.org
2024-01-30 11:37 ` juzhe.zhong at rivai dot ai
2024-01-30 12:26 ` rguenth at gcc dot gnu.org
2024-01-31  1:32 ` juzhe.zhong at rivai dot ai
2024-01-31  3:50 ` juzhe.zhong at rivai dot ai
2024-01-31  7:00 ` juzhe.zhong at rivai dot ai
2024-01-31  7:59 ` rguenth at gcc dot gnu.org
2024-01-31  8:09 ` juzhe.zhong at rivai dot ai
2024-01-31  8:18 ` rguenther at suse dot de
2024-01-31  8:27 ` juzhe.zhong at rivai dot ai
2024-01-31  9:08 ` rguenther at suse dot de
2024-01-31  9:19 ` juzhe.zhong at rivai dot ai
2024-01-31  9:56 ` rguenther at suse dot de
2024-04-07 21:33 ` pinskia 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-99395-4-MNJVDRwrhr@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).