Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
7568 Discussions

Guidelines for use of STL while not preventing vectorization

billtohara
Beginner
90 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
90 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