------- Comment #1 from rguenth at gcc dot gnu dot org 2009-10-30 22:20 -------
You could use -O2 -ftree-vectorize.
Another pretty straight-forward way to write the operation is
TYPE fun3(TYPE *x, TYPE *y, unsigned int n)
{
int i, j;
TYPE dot = 0;
for (i = 0; i < n / 8; i++)
{
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
dot += *(x++) * *(y++);
}
return dot;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41881