MMX (instruction set)
|This article needs additional citations for verification. (July 2007)|
MMX is a single instruction, multiple data (SIMD) instruction set designed by Intel, introduced in 1997 with its P5-based Pentium line of microprocessors, designated as "Pentium with MMX Technology". It developed out of a similar unit introduced on the Intel i860, and earlier the Intel i750 video pixel processor. MMX is a processor supplementary capability that is supported on recent IA-32 processors by Intel and other vendors.
MMX is officially a meaningless initialism trademarked by Intel; unofficially, the initials have been variously explained as standing for MultiMedia eXtension, Multiple Math eXtension, or Matrix Math eXtension.
AMD, during one of its numerous court battles with Intel, produced marketing material from Intel indicating that MMX stood for "Matrix Math Extensions". Since an initialism cannot be trademarked, this was an attempt to invalidate Intel's trademark. In 1997, Intel filed suit against AMD and Cyrix Corp. for misuse of its trademark MMX. AMD and Intel settled, with AMD acknowledging MMX as a trademark owned by Intel, and with Intel granting AMD rights to use the MMX trademark as a technology name, but not a processor name.
MMX defined eight registers, called MM0 through MM7, and operations that operate on them. Each register is 64 bits wide and can be used to hold either 64-bit integers, or multiple smaller integers in a "packed" format: a single instruction can then be applied to two 32-bit integers, four 16-bit integers, or eight 8-bit integers at once.
MMX provides only integer operations. When originally developed, for the Intel i860, the use of integer math made sense (both 2D and 3D calculations required it), but as graphics cards that did much of this became common, integer SIMD in the CPU became somewhat redundant for graphical applications. On the other hand, the saturation arithmetic operations in MMX could[vague] significantly speed up some digital signal processing applications.
To avoid compatibility problems with the context switch mechanisms in existing operating systems, the MMX registers were aliases for the existing x87 FPU registers, which context switches would already save and restore. Unlike the x87 registers, which behaved like a stack, the MMX registers were each directly addressable (random access).
Any operation involving the floating point stack might also affect the MMX registers and vice versa, so this aliasing made it difficult to work with floating point and SIMD operations in the same application. To maximize performance, programmers often used the processor exclusively in one mode or the other, deferring the relatively slow switch between them as long as possible.
Each 64-bit MMX register corresponded to the mantissa part of an 80-bit x87 register. The upper 16 bits of the x87 registers thus go unused in MMX, and these bits are all set to ones, making them NaNs or infinities in the floating point representation. This could be used by applications to decide whether a particular register's content is intended as floating point or SIMD data.
Software support for MMX was slow in coming. Intel's C Compiler and related development tools obtained intrinsics for invoking MMX instructions and Intel released libraries of common vectorized algorithms using MMX. Both Intel and Metrowerks attempted automatic vectorization in their compilers, but the operations in the C programming language mapped poorly onto the MMX instruction set and custom algorithms as of 2000 typically still had to be written in assembly.
AMD, a competing x86 microprocessor vendor, enhanced Intel's MMX with their own 3DNow! instruction set. 3DNow is best known for adding single-precision (32-bit) floating-point support to the SIMD instruction-set, among other integer and more general enhancements.
Following MMX, Intel's next major x86 extension was the SSE, introduced with the Pentium-III family (roughly a year after AMD's 3DNow! was introduced.)
SSE addressed the core shortcomings of MMX (inability to mix integer-SIMD ops with any floating-point ops) by creating a new 128-bit wide register file (XMM0–XMM7) and new SIMD instructions for it. Like 3DNow!, SSE focused exclusively on single-precision floating-point operations (32-bit); integer SIMD operations were still performed using the MMX register and instruction set. However, the new XMM register-file allowed SSE SIMD-operations to be freely mixed with either MMX or x87 FPU ops.
SSE2, introduced with the Pentium 4, further extended the x86 SIMD instruction set with integer (8/16/32 bit) and double-precision floating-point data support for the XMM register file. SSE2 also allowed the MMX opcodes to use XMM register operands, but ended this support with SSE4 (and recently with SSE4.2, introduced in the Core microarchitecture). However, since processor support for any SSE revision also implies support for MMX, the removal does not limit the data types usable by x86 SIMD.
MMX in embedded applications
Intel's and Marvell's XScale microprocessor core starting with PXA270 include an SIMD instruction set extension to the ARM core called iwMMXt whose functions are similar to those of the IA-32 MMX extension. iwMMXt stands for "Intel Wireless MMX Technology". It provides arithmetic and logic operations on 64-bit integer numbers (the software may choose to instead perform two 32-bit, four 16-bit or eight 8-bit operations in a single instruction). The extension contains 16 data registers of 64-bits and eight control registers of 32-bits. All registers are accessed through standard ARM architecture coprocessor mapping mechanism. iwMMXt occupies coprocessors 0 and 1 space, and some of its opcodes clash with the opcodes of the earlier floating-point extension, FPA.
Later versions of Marvell's ARM processors supports both WMMX (Wireless MMX) and WMMX2 (Wireless MMX2) support.
- Intel Pentium Processors with MMX Technology for Embedded Computing - Overview
- Mittal, Millind; Peleg, Alex; Weiser, Uri (1997). "MMX Technology Architecture Overview" (PDF). Intel Technology Journal 1 (3).
- Conte, G.; Tommesani, S.; Zanichelli, F. (2000). The long and winding road to high-performance image processing with MMX/SSE (PDF). Proc. IEEE Int'l Workshop on Computer Architectures for Machine Perception.
- Manepally, R. and Sprague, D.; Intel Princeton Oper., Plainsboro, NJ; Intel's i750 (R) video processor-the programmable solution, Compcon Spring '91, Digest of Papers, pp. 324–329; 25 Feb-1 Mar 1991; San Francisco, CA, USA; ISBN 0-8186-2134-6.
- Intel Intrinsics Guide
- Intel Pentium Processor with MMX Technology Documentation
- The MMX Instruction Set from The Art of Assembly Language
- IA Software Developer's Manual, Vol 1 (PDF), see chapter 8 for MMX programming