Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 21994

Only a gather loop is vectorized, not scatter, but I don't know why

$
0
0

I'm learning about vectorization and I don't know why this code is vectorized:

 for (i=0; i<N; i++)
    Y[i] = X[index [i]];

and this not:

 for (i=0; i<N; i++)
    X[index [i]]= Y[i];

I'm compiling with https://godbolt.org/ x86 gcc with -O3 option.

Why doesn't GCC auto-vectorize the scatter loop?


Viewing all articles
Browse latest Browse all 21994

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>