Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
11 Views

Guidelines for use of STL while not preventing vectorization

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
Highlighted
Black Belt
11 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