New: x*x in a loop folded to powf(x,2.) which prevents vectorization
3 answers - 655 bytes -

$ 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 -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:
/* x*x as pow(x,2.0), which is expanded as x*x. */
No.1 | | 121 bytes |
| 
Comment #1 from pinskia at gcc dot gnu dot org 2006-07-28 10:51
This bug has been marked as a duplicate of 21465
No.2 | | 300 bytes |
| 
Comment #2 from pinskia at gcc dot gnu dot org 2006-07-28 10:53
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.
No.3 | | 275 bytes |
| 
Comment #3 from fxcoudert at gcc dot gnu dot org 2006-07-28 10:55
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.