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.
- ~40 minreading and coding
- 4missions
- membersaccess
- x64 Assemblylanguage
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
- One instruction, many numbers
- Loading and storing
- The packed integer instructions
- From a vector back to a decision
- Adding up a vector: the horizontal sum
- Filling a vector with one byte
Missions
- Four adds in one
- A vector sum
- Count matching bytes
- strlen, 16 at a time