Bug 28524 - x*x in a loop folded to powf(x,2.) which prevents vectorization
Summary: x*x in a loop folded to powf(x,2.) which prevents vectorization
Status: RESOLVED DUPLICATE of bug 21465
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: missed-optimization
Depends on:
Blocks:
 
Reported: 2006-07-28 10:50 UTC by Francois-Xavier Coudert
Modified: 2006-07-28 10:55 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Francois-Xavier Coudert 2006-07-28 10:50:17 UTC
$ cat a.c
void foo (float * restrict x, float * restrict y)
{
  int i;
  for (i = 0; i < 10000; i++)
    x[i] = y[i] * y[i];
}
$ gcc a.c -O1 -ffast-math -msse -mfpmath=sse -ftree-vectorize -ftree-vectorizer-verbose=5 -std=c99 -c

a.c:5: note: Alignment of access forced using peeling.
a.c:5: note: Vectorizing an unaligned access.
a.c:5: note: not vectorized: relevant stmt not supported: D.1353_14 =
__builtin_powf (D.1352_13, 2.0e+0)
a.c:5: note: vectorized 0 loops in function.


I find in fold-const.c:fold_binary, around line 9091, I found the following:
         /* Optimize x*x as pow(x,2.0), which is expanded as x*x.  */
Comment 1 Andrew Pinski 2006-07-28 10:51:30 UTC

*** This bug has been marked as a duplicate of 21465 ***
Comment 2 Andrew Pinski 2006-07-28 10:53:00 UTC
Richard, next time you tell someone to file a bug report, please at least look quickly at other bug reports which were filed before telling them to file a new one.  Finding the other bug was easy because the summary is correct.
Comment 3 Francois-Xavier Coudert 2006-07-28 10:55:09 UTC
I did do a bugzilla search before writing to mailing-list, searching for the error message "relevant stmt not supported" in the comment, but it looks like the error message was changed at some point.