Hi,
I noticed that (in gcc 4.5 as of Oct-18) the following code is not
vectorized:
float sum=0;
int i;
for(i=0;i<16;i++)
sum += f1[i]*f2[i];
The error is "unhandled use in statement"
However, the web page at
http://gcc.gnu.org/projects/tree-ssa/vectorization.html says:
"Detection and vectorization of special idioms, such as dot-product and
widening-summation: Incorporated into GCC 4.2."
Can you tell me if I am missing something? Is the web page correct?
-BenRI
#define ALIGNED __attribute__((aligned(16)))
float* ALIGNED s1(int);
int s2(float);
int main(int argc, char* argv[])
{
float* __restrict f1 ALIGNED = s1(0);
float* __restrict f2 ALIGNED = s1(0);
float sum=0;
int i;
for(i=0;i<16;i++)
sum += f1[i]*f2[i];
s2(sum);
return 0;
}