RC RANDOM CHAOS

How Programmers Wrangled SIMD on Intel's 1997 Pentium MMX

· via Hacker News

Original source

SIMD in the 90s: Programming Intel's Pentium MMX

Hacker News →

Long before AVX-512, NEON, and GPU compute, Intel’s 1997 Pentium MMX brought SIMD — one instruction operating on multiple data elements at once — to mainstream x86 desktops. MMX added 57 instructions and eight 64-bit registers (MM0–MM7), letting a single operation like paddb add eight packed bytes simultaneously instead of looping through them one at a time. To save silicon, Intel aliased the MMX registers onto the lower 64 bits of the existing 80-bit x87 floating-point stack, a clever reuse that also imposed a hard constraint: code couldn’t freely mix MMX and floating-point work without switching the CPU’s mode.

MMX didn’t invent SIMD — the article traces the lineage back to the 1960s ILLIAC IV, the first massively parallel machine, and the 1976 Cray-1 vector processor. It also draws a useful distinction: true vector processors like the Cray-1 used a settable vector-length register to stream elements of variable count through a functional unit over multiple cycles, whereas SIMD is tied to fixed-width registers. MMX’s real importance was accessibility — it was the first time ordinary PC enthusiasts and game programmers could hand-write parallel assembly to chase extra frames per second.

The piece walks through the features that made MMX genuinely useful for multimedia: saturating arithmetic (paddusb) that clamps at 0 and 255 so pixel brightness stops maxing out instead of wrapping around, packed comparison instructions (pcmpgtb) that emit 0xFF/0x00 masks for thresholding, sprite transparency, and collision checks, and packed bit-shifts as a cheap substitute for the era’s expensive multiply and divide operations. It’s a hands-on look at where practical desktop SIMD programming began.

Read the full article

Continue reading at Hacker News →

This is an AI-generated summary. Read the original for the full story.