Compartilhar via


Auto-Vectorizer in Visual Studio 2012 – Cookbook

If you’ve not read previous posts in this series about auto-vectorization, you may want to begin at the beginning.

This post presents a cookbook, aimed to help you get your C++ loops auto-vectorized.  Please use this as you experiment with Visual Studio 2012, and post any feedback as comments to this post.  We will use the feedback to improve the cookbook, which will be published on MSDN as part of the regular product documentation.

Please click Auto-Vectorization-Cookbook to access the document.

Comments

  • Anonymous
    July 15, 2012
    Earlier I asked about auto-vectorising outside of loops (ie. mathematical vectors). I don't think that's been addressed in these posts yet, is there anything for that?

  • Anonymous
    July 16, 2012
    @Andrew This first release of the auto-vectorizer attacks only loops.  That can include accessing a field in an array of structs - in this case, the source locations are not contiguous, but they are the same distance apart.   But we don't, for the moment, auto-vectorize non-loop operations - such math vectors. Thinking back over the past N posts, I don't think I explained struct accesses in any detail.  However, I think we have covered most of what is most useful, so the Cookbook is likely the last post I'll do on this topic. I still list a sequence of examples in the opening TOC post.  We'll get to these as time allows.  Matrix multiplication makes for a very interesting first case.

  • Anonymous
    October 10, 2012
    Is there any plans to expose the mathematical functions, like sqrt, sin, cos, tan and etc, for developers to use in their handcrafted SIMD code?

  • Anonymous
    October 11, 2012
    @Wong: Short answer is no.  We designed it for internal use by the compiler - so it uses its own call protocol, passing arguments in specific registers, for improved performance. Jim