I wrote the following program:
#include <stdio.h>
int main() {
float a=1, b=2, c=3, d=4;
float e=1, f=2, g=3, h=4;
for (int i=0; i<1000000000; ++i) {
a += e;
b += f;
c += g;
d += h;
e /= a;
f /= b;
g /= c;
h /= d;
}
printf("%f %f %f %f\n", a, b, c, d);
return 0;
}
and compiled it with:
llvm-gcc -std=c99 -O3 -msse3 vector.c -o vector
But it did not generate the vector code that I was expecting and my hand
written IR is 2.5x faster. Is it possible to get llvm-gcc to do this
optimization and, if so, how?
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e