Step Into Labs

Step Into x64 Assembly · Lesson 13 · Speed & Dispatch

SIMD: Sixteen Bytes at Once

xmm registers as vectors: packed adds, comparing 16 bytes in one instruction and turning the result into a bit mask.

Part of Step Into x64 Assembly. The full lesson, its missions and the real compiler and debugger are in the course. Try a free lesson first to see how it works.

The xmm registers you used for doubles are 128 bits wide, and that is enough for a whole vector: 2 qwords, 4 dwords, 8 words or 16 bytes. SIMD (single instruction, multiple data) instructions work on every lane at once. This is how strlen, memchr, video codecs and JSON parsers go fast.

In this lesson

Missions

  1. Four adds in one
  2. A vector sum
  3. Count matching bytes
  4. strlen, 16 at a time