This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [wwwdocs] Vectorizer's updates to 4.3.0 changes
On Tue, Mar 11, 2008 at 11:41:32AM +0100, Andi Kleen wrote:
> > + <li>The <code>-ftree-vectorize</code> option is now on by default
> > under
> > + <code>-O3</code>.
>
> That seems awfully brief. I would recommend you mention at least
> e.g. that it needs sse2 or altivec enabled and roughly what the
> vectorizer does (in very high level terms for users) and that it may
> increase code size.
You don't need sse2 nor altivec enabled (though of course vectorization is
better if you do). Consider say:
char buf[1024] __attribute__((aligned));
void foo (void)
{
int i;
for (i = 0; i < 1024; i++)
buf[i] |= 2;
}
Even without sse this is (e.g. on i386) vectorized, with -O3 you get
following loop:
.L2:
orl $33686018, (%eax)
addl $4, %eax
cmpl $buf+1024, %eax
jne .L2
with -O2 or -O3 -fno-tree-vectorize
.L2:
orb $2, buf(%eax)
addl $1, %eax
cmpl $1024, %eax
jne .L2
Jakub