gcc4.0 autovect-branch
Daniel Berlin
dberlin@dberlin.org
Mon Dec 20 15:50:00 GMT 2004
On Mon, 20 Dec 2004, Villemin Ryusuke wrote:
> Thank you for your reply!
> I was expecting an output like icc, so I checked the assembler code file
> ("-S") but didn t see any vector instruction...
we've meant to add a flag to output info like icc does when compiling, and
we have the info to do so, it's just nobody actually went and did it :)
>
> It was because I declared my arrays local to the foo function:
>
> foo () {
> float a[256], b[256], c[256];
> int i;
> for (i=0; i<256; i++){
> a[i] = b[i] + c[i];
> }
> }
>
> the vect output is :
> loop at vecto.c:9: not vectorized: unsupported data-type
>
You never use the results, so we delete the computations when they are
local.
Thus, the reason it's not vectorizing is because there is nothing left to
vectorize.
Your loop looks like this by that point:
foo () {
int i;
for (i = 0; i < 256; i++) {
}
}
If you add another loop or something that uses the value of a[i], so that
it's actually needed, you'll see we vectorize the loop.
for example, add
for (i=0; i<256; i++)
printf ("%f\n", a[i]);
and we'll vectorize your loop.
More information about the Gcc-help
mailing list