This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/41881] Complete unrolling (inner) versus vectorization of reduction
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 30 Oct 2009 22:20:46 -0000
- Subject: [Bug tree-optimization/41881] Complete unrolling (inner) versus vectorization of reduction
- References: <bug-41881-3264@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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