<html>
<head>
<meta content="charset=gb2312">
</head>
<style type="text/css">
<!--
p,td,body {font: 10.5pt}
small {font: 9pt;}
big {font: 24pt}
h1 {font: 22pt}
h2 {font: 20pt}
h3 {font: 18pt}
h4 {font: 16pt}
h5 {font: 14pt}
h6 {font: 12pt}
A:link {text-decoration: none; color: "#DBCAAE"}
A:visited {text-decoration: none; color: "#DBCAAE"}
A:active {text-decoration: none; color: "#DBCAAE"}
A:hover {text-decoration: none; color: "#FBEACE"}
-->
</style>
<body bgcolor="#000000" text="#DBCAAE" link="#DBCAAE" vlink="#DBCAAE" alink="#DBCAAE" topmargin="10" leftmargin="4">
<p>
<center>
<a href="tppmsgs/msgs0.htm#1" tppabs="http://freemind.163.net/index.html"><img src="bigtitle.gif" tppabs="http://freemind.163.net/bigtitle.gif" width=505 height=92 border="0"></a><br>
</center>
<big><FONT FACE="Arial"><B><FONT COLOR="#FBEACE">D</FONT><FONT COLOR="#EBDABE">A</FONT><FONT COLOR="#DBCAAE">T</FONT><FONT COLOR="#CBBA9E">A</FONT><FONT COLOR="#BBAA8E">B</FONT><FONT COLOR="#AB9A7E">A</FONT><FONT COLOR="#9B8A6E">S</FONT><FONT COLOR="#8B7A5E">E</FONT></B></FONT></big>
<table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td bgcolor="#CBBA9E" height="1"></td></tr><tr><td bgcolor="#FBEACE" height="1"></td></tr><tr><td bgcolor="#DBCAAE" height="1"></td></tr><tr><td bgcolor="#BBAA8E" height="1"></td></tr><tr><td bgcolor="#9B8A6E" height="1"></td></tr><tr><td bgcolor="#7B6A4E" height="1"></td></tr><tr><td bgcolor="#5B4A2E" height="1"></td></tr><tr><td bgcolor="#3B2A0E" height="1"></td></tr><tr><td height="10"></td></tr></table>
<center>
<big><font face="黑体">INTEL 体系结构<br>MMX™ 技术程序员参考手册</font></big><br>
<small><FONT FACE="Arial"><b>Intel Architecture MMX™ Technology Programmer's Reference Manual</b></font></small><br><br>
</center>
<table border="0" width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td align="right"><a href="mmx.htm" tppabs="http://freemind.163.net/database/mmx/mmx.htm">返回</a></td></tr></table>
<table border="0" width="100%"><tr><td bgcolor="#CBBA9E" height="2"></td></tr></table>
</p>
<p><font face="arial">
<h3><b>Chapter 5<BR>INTEL ARCHITECTURE MMX™ INSTRUCTION SET</b></h3>
This chapter presents the Intel Architecture MMX™ instructions in alphabetical order, with a full description of each instruction.<br><br>
The IA MMX technology defines fifty-seven new instructions. The instructions are grouped into the following functional categories:
<ul>
<li>Arithmetic Instructions
<li>Comparison Instructions
<li>Conversion Instructions
<li>Logical Instructions
<li>Shift Instructions
<li>Data Transfer Instructions
<li>Empty MMX State (EMMS) Instruction
</ul>
Appendix A summarizes the MMX instructions grouped by categories of related functions. Appendix B provides instruction formats and encodings, and Appendix C provides an alphabetical list of instruction mnemonics, their source data types, encodings in hexadecimal, and format. Appendix D provides an Opcode Map of the MMX instructions.<br><br>
Many of the instructions have multiple variations depending on the data types they support. Each variation has a different suffix. For example the PADD instruction has three variations: PADDB, PADDW, and PADDD, where the letters B, W, and D represent byte, word, and doubleword.
<H3><a name="5.1">5.1 INSTRUCTION SYNTAX</a></H3>
Instructions vary by:<br><br>
<ul>
<li>Data type: packed bytes, packed words, packed doublewords or quadwords
<li>Signed - Unsigned numbers
<li>Wraparound - Saturate arithmetic
</ul>
A typical MMX instruction has this syntax:
<ul>
<li>Prefix: <B>P</B> for Packed
<li>Instruction operation: for example - ADD, CMP, or XOR
<li>Suffix:<br>--<B>US</B> for Unsigned Saturation<br>--<B>S</B> for Signed saturation<br>--<B>B, W, D, Q</B> for the data type: packed byte, packed word, packed doubleword, or quadword.
</ul>
Instructions that have different input and output data elements have two data-type suffixes. For example, the conversion instruction converts from one data type to another. It has two suffixes: one for the original data type and the second for the converted data type.<br><br>
This is an example of an instruction mnemonic syntax:<br><br>
<ul>
<B>PADDUSW (Packed Add Unsigned with Saturation for Word)</B><br>
<B>P</B> = Packed<br>
<B>ADD</B> = the instruction operation<br>
<B>US</B> = Unsigned Saturation<br>
<B>W</B> = Word
</ul>
<H3><a name="5.2">5.2 INSTRUCTION FORMAT</a></H3>
The IA MMX instructions use the existing IA instruction format. All instructions, except the EMMS instruction, use the ModR/M format. All are preceded by the 0F prefix byte. For more details about the ModR/M format refer to <I>Pentium<sup>®</sup> Processor Family Developer's Manual Volume 3</I>, Section 25.2.1.<br><br>
For data-transfer instructions, the destination and source operands can reside in memory, integer registers, or MMX registers. For all other IA MMX instructions, the destination operands reside in MMX registers, and the source operands reside in memory, MMX registers, or immediate operands.<br><br>
All existing address modes are supported using the SIB (Scale Index Base) format.
<H3><a name="5.3">5.3 NOTATIONAL CONVENTIONS</a></H3>
The following conventions apply to all MMX instructions (except the EMMS instruction):
<ul>
<li>The instructions reference and operate on two operands: the source and destination operands. The right operand is the source and the left operand is the destination. The destination operand may also supply one of the inputs for the operation. The instruction overwrites the destination operand with the result.<br>
<li>When one of the operands is a memory location, the linear address corresponds to the address of the least significant byte of the referenced memory data.<br>
<li>The MMX instructions do not affect the condition flags.
</ul>
<H3><a name="5.4">5.4 HOW TO READ THE INSTRUCTION SET PAGES</a></H3>
The following is an example of the format used for each MMX instruction description in this chapter:<br><br>
<B>PSLL - Packed Shift Left Logical</B><br><br>
<center><table border="0" cellpadding="2" cellspacing="1" bgcolor="#EBDABE">
<TR><TD bgcolor="#000000" WIDTH=136><small><B>Opcode</small></B></TD><TD bgcolor="#000000" WIDTH=136><small><B>Instruction</small></B>
</TD><TD bgcolor="#000000" WIDTH=245><small><B>Description</small></B></TD>
</TR>
<TR><TD bgcolor="#000000" WIDTH=136><small>0F F1 /r</small></TD><TD bgcolor="#000000" WIDTH=136><small>PSLLW <I>mm, mm/m64</I></small>
</TD><TD bgcolor="#000000" WIDTH=245><small>Shift all words in MMX register to left by an amount specified in MMX register/memory, while shifting in zeros.</small>
</TD></TR>
</table></center>
<br>
The above table gives the instruction mnemonic and a brief description of the mnemonic. The columns content are explained below.<br><br>
<ul>
<B>Opcode Column</B><br><br>
The "Opcode" column provides the complete opcode produced for each form of the instruction.<br><br>
The codes are defined as hexadecimal bytes, in the same order in which they appear in memory. Definitions of entries other than hexadecimal bytes are as follows:<br><br>
<ul>
<li type=disc><B>/digit:</B> (digit is between 0 and 7) indicates that the ModR/M byte of the instruction uses only the r/m (register or memory) operand. The <B>reg</B> field contains the digit that provides a technology to the instruction's opcode.<br>
<li><B>/r</B>: indicates that the ModR/M byte of the instruction contains both a register operand and an r/m operand.<br>
<li><B>ib</B>: a 1-byte, immediate operand to the instruction that follows the opcode, ModR/M bytes, and scale-indexing bytes. The opcode determines if the operand is a signed value.<br><br>
</ul>
<B>Instruction Column</B><br><br>
The "Instruction" column contains the instruction syntax. The following is a list o