18

I'm looking into using these to improve the performance of some code but good documentation seems hard to find for the functions defined in the *mmintrin.h headers, can anybody provide me with pointers to good info on these?

EDIT: particularly interested in a very basic tutorial on how to get started.

Peter Cordes
  • 328,167
  • 45
  • 605
  • 847
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49

2 Answers2

17

There's a handy online Intel Intrinsics Guide at https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html - it covers all Intel SIMD stuff from MMX through the various flavours of SSE up to AVX2 et al.

You can also get the following PDFs from Intel:

  • Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2A: Instruction Set Reference, A-M (253666-021)

  • Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 2B: Instruction Set Reference, N-Z (253667-021)

  • Intel® SSE4 Programming Reference (D91561-001)

Paul R
  • 208,748
  • 37
  • 389
  • 560
  • 1
    Very useful, but took me a bit of time to figure out how to get the thing to run on Linux. First time I've ever seen a shell script that had spaces and parentheses in the file name. – BD at Rivenhill Jul 29 '11 at 10:23
  • 2
    The Intel Intrinsics Guide is cryptic and useless for beginners. Isn't there anything more pedagogical and beginner-friendly (probably with some hello world examples)? – Nanashi No Gombe May 08 '19 at 15:28
  • 1
    The links to the intrinsics guide are no longer functional, and redirect to https://www.intel.com/content/www/us/en/developer/overview.html instead. – OmnipotentEntity Feb 16 '23 at 16:13
  • 2
    @OmnipotentEntity: The previous link was to a thing you could install locally, for Mac/Linux/Windows. If that's totally gone, the answer should just be simplified to just talk about the online guide where searching works via javascript. – Peter Cordes Feb 16 '23 at 22:37
  • 1
    I apologize, I honestly did not realize that the two links were originally pointing to two different things. I thought instead that the previous edit has simply not changed the first when he changed the third. Thank you for the correction. – OmnipotentEntity Feb 20 '23 at 22:10
10

This is the best introduction to MMX/SSE programming I ever found. (I've programmed SSE2 for 5 years and I still find this tutorial to be the most conceptually clear.)

http://www.tommesani.com/Docs.html

This is not a complete list of instructions; so once you're ready to learn more, do start reading the Intel intrinsics guide as @PaulR suggests.

One important thing to keep in mind is that MMX/SSE tend to be severely limiting in terms of movements of data (shuffle or arbitrary permutation, or change of single element). This is a limitation of CPU silicon design. Scatter-gather instructions were only added a few years ago, and might not even be available on your customer's computers.

There is a large repertoire of vectorization tricks for MMX/SSE similar to the way http://www.hackersdelight.org/ prescribes tricks for exploiting bit-parallel operations.

rwong
  • 6,062
  • 1
  • 23
  • 51