42

Is there any good C/C++ tutorials or examples for learning Intel SSE and AVX instructions?

I found few on Microsoft MSDN and Intel sites, but it would be great to understand it from the basics..

veda
  • 6,416
  • 15
  • 58
  • 78
  • 2
    See my summary on SIMD here http://stackoverflow.com/questions/20933746/parallel-programming-using-haswell-architecture/20948208#20948208 – Z boson Apr 10 '14 at 08:11
  • There are some links in the [SSE tag wiki](https://stackoverflow.com/tags/sse/info). Especially [SIMD at Insomniac Games (GDC 2015) slide](https://deplinenoise.wordpress.com/2015/03/06/slides-simd-at-insomniac-games-gdc-2015/) are nice and have some good stuff about laying out your data for SIMD. (i.e. don't use a SIMD vector as a 3D xyz vector and then give up on SIMD because it wasn't faster.) – Peter Cordes Oct 31 '17 at 17:54
  • [Getting started with Intel x86 SSE SIMD instructions](https://stackoverflow.com/q/1389712/995714) – phuclv Jun 18 '22 at 04:45

4 Answers4

16

For the visually inclined SIMD programmer, Stefano Tommesani's site is the best introduction to x86 SIMD programming.

http://www.tommesani.com/index.php/simd/46-sse-arithmetic.html

The diagrams are only provided for MMX and SSE2, but once a learner gets proficient with SSE2, it is relatively easy to move on and read the formal specifications.


Intel IA-32 Instructions beginning with A to M

http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-2a-manual.pdf

Intel IA-32 Instructions beginning with N to Z

http://www.intel.com/content/dam/www/public/us/en/documents/manuals/64-ia-32-architectures-software-developer-vol-2b-manual.pdf


In addition, it is important for Intel SIMD programmers to know the minimum required architecture for instructions that are outside the SSE2 generation.

Browsing by generations on Wikipedia:

Searching for a given Intel SIMD mnemonic on a single page (via a text search):


rwong
  • 6,062
  • 1
  • 23
  • 51
4

There is some good stuff on Apple's developer site, e.g. SSE Performance Programming.

Paul R
  • 208,748
  • 37
  • 389
  • 560
4

There is a nice introduction here

Code project SSE

Also if you have Microsoft DirectX SDK installed, the source from xnamath has lot of vector/matrix operations using sse intrinsics (check in the sdk include folder, xnamath.h, xnamathconvert.inl, xnamathmatrix.inl ...)

Nubok
  • 3,502
  • 7
  • 27
  • 47
mrvux
  • 8,523
  • 1
  • 27
  • 61
3

You might find it useful to look at examples of how SIMD can be applied to some common algorithms. At Games Developer Conference 2011, there was an Intel talk called "Hotspots, FLOPS, and uOps: To-the-Metal CPU Optimization" that attempts to demonstrate SIMD for algorithms common in games. The talk refers to some Intel sample code that shows how AVX can be applied to cloth calculations.

Brad Werth
  • 371
  • 1
  • 10