Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
7724 Discussions

Guidelines for use of STL while not preventing vectorization

billtohara
Beginner
141 Views

Hello

Can someone point me at any available guidelines for use of STL in new C++ code, in such a way as to not prevent the Intel compiler from vectorizing the code?

For example, does the latest version successfully vectorize simple transforms such as this?

transfrom(x.begin(),x.end(),

y.begin(),

[](float x, float y){return x+y;});

or, say we have 2 such transforms, one after the other, can thje compiler fuse the loops and vectorize the result?

Thanks

0 Kudos
1 Reply
TimP
Black Belt
141 Views
Auto-vectorization of simpler transform() is often successful. If the compiler can't see that x and y aren't aliased, the restrict extension may be required. In a case where fusion would be desirable, plain C99 is more likely to do the job.
Reply