auto vectorizer

burlen burlen.loring@gmail.com
Tue Aug 25 06:55:00 GMT 2009


My loop doesn't vectorize. The message says:

./TestAutoVect.cpp:31: note: not vectorized: unhandled data-ref

22 
//-----------------------------------------------------------------------------
23 void MaskRGBA(
24       const int *in,
25       const int * const inEnd,
26       int *out,
27       const int * const m)
28 {
29   for (;in<inEnd; ++in, ++out)
30     {
31     *out=*in&*m;
32     }
33 }

I found that when I change it to this

23 
//-----------------------------------------------------------------------------
24 void MaskRGBA(
25       const int *in,
26       const int * const inEnd,
27       int *out,
28       const int * const mask)
29 {
30   const int m=*mask;
31   for (;in<inEnd; ++in, ++out)
32     {
33     *out=*in&m;
34     }
35 }

It gets vectorized. What is the reason behind that?



More information about the Gcc-help mailing list