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

Getting auto-vectorization with GCC?

$
0
0

In the context of evaluating negative-log-likelihoods, I have toperform a bunch of operations that could benefit from vectorization:

  1. for (i = 1...n) { a[i] = 0; } // but this I think

    std::fill( a.begin(), a.end(), 0 ) is already optimal

  2. for (i = 1...n) { a[i] += b * c[i]; }

  3. sum = 0; for (i = 1 .. n) { sum += a[i] * log( b[i] / c ); }

Do you know if there is any hope to get GCC 434 to do auto-vectorization, and how should I code the loop to help him (e.g.using indices vs using iterators, should I break up (2) in simplerloops, ...)? Up to now I am using doubles, have to check if I can move to floats at least for (1).


Viewing all articles
Browse latest Browse all 22202

Trending Articles



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