public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/43425]  New: enhance scalar expansion to vectorize this loop
@ 2010-03-18 18:14 changpeng dot fang at amd dot com
  2010-03-18 18:31 ` [Bug tree-optimization/43425] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-03-18 18:14 UTC (permalink / raw)
  To: gcc-bugs

chfang@pathscale:~/gcc$ cat foo.c
int a[100], b[100];

void foo(int n, int mid)
{
  int i, t = 0;
  for(i=0; i<n; i++)
    {
      a[i] = b[i] + t; 
      t = b[i];
    }
}
chfang@pathscale:~/gcc$ gcc -O3 -ftree-vectorizer-verbose=7 -c foo.c

foo.c:6: note: not vectorized: unsupported use in stmt.
foo.c:3: note: vectorized 0 loops in function.

scalar expansion of t into array to carry the values accross iteration.


-- 
           Summary: enhance scalar expansion to vectorize this loop
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: changpeng dot fang at amd dot com


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/43425] enhance scalar expansion to vectorize this loop
  2010-03-18 18:14 [Bug c/43425] New: enhance scalar expansion to vectorize this loop changpeng dot fang at amd dot com
@ 2010-03-18 18:31 ` pinskia at gcc dot gnu dot org
  2010-03-28  8:59 ` irar at il dot ibm dot com
  2010-05-07 21:33 ` [Bug tree-optimization/43425] gcc should vectorize this loop by substitution changpeng dot fang at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-03-18 18:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2010-03-18 18:31 -------
Basically undoing predictive commoning (which we switched the order for 4.5 to
fix a different issue).  Confirmed.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|c                           |tree-optimization
     Ever Confirmed|0                           |1
           Keywords|                            |missed-optimization
   Last reconfirmed|0000-00-00 00:00:00         |2010-03-18 18:31:30
               date|                            |


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/43425] enhance scalar expansion to vectorize this loop
  2010-03-18 18:14 [Bug c/43425] New: enhance scalar expansion to vectorize this loop changpeng dot fang at amd dot com
  2010-03-18 18:31 ` [Bug tree-optimization/43425] " pinskia at gcc dot gnu dot org
@ 2010-03-28  8:59 ` irar at il dot ibm dot com
  2010-05-07 21:33 ` [Bug tree-optimization/43425] gcc should vectorize this loop by substitution changpeng dot fang at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: irar at il dot ibm dot com @ 2010-03-28  8:59 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from irar at il dot ibm dot com  2010-03-28 08:59 -------
I think PR 35229 covers this issue.


-- 


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug tree-optimization/43425] gcc should vectorize this loop by substitution
  2010-03-18 18:14 [Bug c/43425] New: enhance scalar expansion to vectorize this loop changpeng dot fang at amd dot com
  2010-03-18 18:31 ` [Bug tree-optimization/43425] " pinskia at gcc dot gnu dot org
  2010-03-28  8:59 ` irar at il dot ibm dot com
@ 2010-05-07 21:33 ` changpeng dot fang at amd dot com
  2 siblings, 0 replies; 4+ messages in thread
From: changpeng dot fang at amd dot com @ 2010-05-07 21:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from changpeng dot fang at amd dot com  2010-05-07 21:33 -------
I just found that the test case in the same as (similar to) bug 35229.
The subject of this bug is wrong. Scalar expansion is not appropriate
for this case.

Actually the loop can be transform to:

void foo(int n)
{
  int i;
  a[0] = b[0]; /* + t if t live before this point */
  for(i=1; i<n; i++)
    {
      a[i] = b[i] + b[i-1]; 
    }
  /* t = b[n-1]; is t live after this point */
}

The this loop can be vectorized.

In open64, this optimization is called forward (backward) substitution, i.e.
substitute t with b[i-1].

I am not clear whether bug 35229 addresses the same issue. Maybe we should
close
one of them.


-- 

changpeng dot fang at amd dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|enhance scalar expansion to |gcc should vectorize this
                   |vectorize this loop         |loop by substitution


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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-07 21:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-18 18:14 [Bug c/43425] New: enhance scalar expansion to vectorize this loop changpeng dot fang at amd dot com
2010-03-18 18:31 ` [Bug tree-optimization/43425] " pinskia at gcc dot gnu dot org
2010-03-28  8:59 ` irar at il dot ibm dot com
2010-05-07 21:33 ` [Bug tree-optimization/43425] gcc should vectorize this loop by substitution changpeng dot fang at amd dot com

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).