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/37021] Fortran Complex reduction / multiplication not vectorized
Date: Wed, 13 Feb 2013 15:58:00 -0000	[thread overview]
Message-ID: <bug-37021-4-VGjh8rc1zM@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-37021-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37021

--- Comment #14 from Richard Biener <rguenth at gcc dot gnu.org> 2013-02-13 15:58:31 UTC ---
The following testcase shows the issue well:

_Complex double self[1024];
_Complex double a[1024][1024];
_Complex double b[1024];

void foo (void)
{
  int i, j;
  for (i = 0; i < 1024; i+=3)
    for (j = 0; j < 1024; j+=3)
      self[i] = self[i] + a[i][j]*b[j];
}

we have to get the complex multiplication pattern recognized by SLP
which looks like (without PRE):

  <bb 3>:

  <bb 4>:
  # j_21 = PHI <j_13(3), 0(7)>
  # self_I_RE_lsm.2_12 = PHI <_26(3), self_I_RE_lsm.2_7(7)>
  # self_I_IM_lsm.3_28 = PHI <_27(3), self_I_IM_lsm.3_8(7)>
  # ivtmp_16 = PHI <ivtmp_1(3), 342(7)>
  _2 = REALPART_EXPR <a[i_20][j_21]>;
  _18 = IMAGPART_EXPR <a[i_20][j_21]>;
  _19 = REALPART_EXPR <b[j_21]>;
  _17 = IMAGPART_EXPR <b[j_21]>;
  _4 = _19 * _2;
  _3 = _18 * _17;
  _6 = _17 * _2;
  _23 = _19 * _18;
  _24 = _4 - _3;
  _25 = _23 + _6;
  _26 = _24 + self_I_RE_lsm.2_12;
  _27 = _25 + self_I_IM_lsm.3_28;
  j_13 = j_21 + 3;
  ivtmp_1 = ivtmp_16 - 1;
  if (ivtmp_1 != 0)
    goto <bb 3>;

we fail to build the SLP tree for _25 = _23 + _6 because the matching
stmt is _24 = _4 - _3 which has a different operation (SSE4 addsub
would support vectorizing this).  I don't see how we can easily
make this supported with the current pattern support ... the
support doesn't allow tieing together two SLP group members.
Simply allowing analysis to proceeed here reveals the fact that
the interleaving has a gap of 6 which makes the analysis fail.
Allowing it to proceed for ncopies == 1 (thus no actual interleaving
required) reveals the next check is slightly bogus in that case.
Fixing that ends us with

t.c:9: note: Load permutation 0 0 1 0 1 1 0 1
t.c:9: note: Build SLP failed: unsupported load permutation _27 = _25 +
self_I_IM_lsm.3_28;

... (to be continued)


  parent reply	other threads:[~2013-02-13 15:58 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-37021-4@http.gcc.gnu.org/bugzilla/>
2011-03-25 11:49 ` sebastian.hegler@tu-dresden.de
2011-03-25 12:27 ` sebastian.hegler@tu-dresden.de
2011-03-25 13:13 ` rguenther at suse dot de
2012-07-13  8:46 ` rguenth at gcc dot gnu.org
2013-02-13 15:58 ` rguenth at gcc dot gnu.org [this message]
2013-03-27 10:39 ` rguenth at gcc dot gnu.org
2013-03-27 10:40 ` rguenth at gcc dot gnu.org
2013-04-07 13:18 ` dominiq at lps dot ens.fr
2015-05-12 11:56 ` rguenth at gcc dot gnu.org
2015-06-10 10:45 ` rguenth at gcc dot gnu.org
2015-08-25  8:11 ` rguenth at gcc dot gnu.org
2015-08-27 22:09 ` wschmidt at gcc dot gnu.org
2015-08-28  7:46 ` rguenther at suse dot de
2015-08-28 13:20 ` wschmidt at gcc dot gnu.org
2015-08-28 13:31 ` wschmidt at gcc dot gnu.org
2015-10-22 10:03 ` rguenth at gcc dot gnu.org
2023-07-21 12:28 ` rguenth at gcc dot gnu.org
2008-08-04 17:57 [Bug tree-optimization/37021] New: " rguenth at gcc dot gnu dot org
2008-08-04 17:59 ` [Bug tree-optimization/37021] " rguenth at gcc dot gnu dot org
2008-08-19 15:31 ` rguenth at gcc dot gnu dot org
2009-01-21 15:43 ` rguenth at gcc dot gnu dot org
2009-01-23 15:33 ` rguenth at gcc dot gnu dot org
2009-01-23 15:36 ` rguenth at gcc dot gnu dot org
2009-01-25  9:13 ` irar at il dot ibm dot com
2009-01-25 11:04 ` rguenther at suse dot de
2009-01-25 12:17 ` irar at il dot ibm dot com
2009-01-27 12:40 ` dorit at gcc dot gnu dot 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-37021-4-VGjh8rc1zM@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).