public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "eres at il dot ibm dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/34195]  New: missed optimization with store motion (vectorizer)
Date: Thu, 22 Nov 2007 15:30:00 -0000	[thread overview]
Message-ID: <bug-34195-13229@http.gcc.gnu.org/bugzilla/> (raw)

The following loop does not get vectorized 
on powerpc64-linux, r130275, GCC 4.3.0:

#define M 10

struct S
{
  float x;
  float y;
} pS[100];

float a[1000];
float b[1000];

void
foo (int n)
{
  int i, j;

  for (i = 0; i < n; i++)
    {
      pS[i].x = 0;
      pS[i].y = 0;

      for (j = 0; j < M; j++)
        {
          pS[i].x += (a[i]+b[i]);
          pS[i].y += (a[i]-b[i]);
        }
    }
}

Here is a snippet from the vectorizer dump file:

u3.c:17: note: dependence distance modulo vf == 0 between pS[i_37].x and
pS[i_37].x
u3.c:17: note: dependence distance  = 0.
u3.c:17: note: accesses have the same alignment.
u3.c:17: note: dependence distance modulo vf == 0 between pS[i_37].y and
pS[i_37].y
u3.c:17: note: === vect_analyze_data_ref_accesses ===
u3.c:17: note: Detected interleaving of size 2
u3.c:17: note: not vectorized: complicated access pattern.
u3.c:17: note: bad data access.(get_loop_exit_condition

...

        base_address: &pS
        offset from base address: (<unnamed-signed:32>) ((unsigned int) i_37 *
8)
        constant offset from base address: 0
        step: 0
        aligned to: 8
        base_object: pS[0].x
        symbol tag: pS
        FAILED as dr address is invariant

u3.c:22: note: not vectorized: unhandled data-ref
u3.c:22: note: bad data references.
u3.c:14: note: vectorized 0 loops in function.

[Zdenek's patch which extends lim can help to do store motion and thus help to
the vectorizer - http://gcc.gnu.org/ml/gcc-patches/2007-01/msg02331.html, but
AFAICT it is not applicable to current mainline)]


-- 
           Summary: missed optimization with store motion (vectorizer)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: eres at il dot ibm dot com


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


             reply	other threads:[~2007-11-22 15:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-22 15:30 eres at il dot ibm dot com [this message]
2007-11-22 16:02 ` [Bug tree-optimization/34195] " rguenth at gcc dot gnu dot org
2007-11-25 11:21 ` eres at il dot ibm dot com
2007-11-30 13:41 ` rguenth at gcc dot gnu dot org
2007-11-30 13:47 ` rguenth at gcc dot gnu dot org
2007-11-30 17:24 ` eres at il dot ibm dot com

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-34195-13229@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).