Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7953 Discussions

Guidelines for use of STL while not preventing vectorization

billtohara
Beginner
288 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
Honored Contributor III
288 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.
0 Kudos
Reply