Intel System MMX instructions

Source: Internet
Author: User
Emms MMX status is left blank:
Leave FP feature characters empty (full 1) so that subsequent floating point instructions can use floating point registers, and other MMX commands automatically set FP to full 0. this instruction should be used when all MMX routines end and call routines that can contain FP instructions to clear the MMX status.
Movd mm, R/M32
Movd R/M32, mm
Transfer 32-bit data:
Move 32-bit data from the integer register/memory to the MMX register, and move the data in reverse direction. movd cannot move data between MMX registers, memory registers, and integer registers. when the target operand is an MMX register, the 32-bit source operand is written to the low 32-bit destination register. the target register "0 extension" is 64-bit. when the source operand is an MMX register, the low 32 bit of this register is written to the target operand.
Movq mm, R/M64
Movq R. M64, mm
Transfer 64-bit data:
The 64-bit data is moved from the integer register/memory to the MMX register, and backward. the destination and source operations can be MMX registers and 64-Bit Memory operations. however, movq cannot transfer data between memory and memory.

Packsswb mm, mm/M64
Packssdw mm, mm/M64

Grouped data with signed saturation mode:
Convert the signed character group in the MMX register and MMX register/memory unit into the signed byte Group of the MMX register. and convert the signed two-character group in the MMX register and MMX register/memory unit into the signed word group of the MMX register. (Note 1)
Packuswb mm, mm/M64 Groups of unsigned saturation data
Change the signed character group in the MMX register and MMX register/memory unit to the unsigned byte group in the MMX register. (Note 1)

Paddb mm, mm/M64
Paddw mm, mm/M64
Paddd mm, mm/M64

Add the surround mode data group:
Add the byte group (Word Group, double-word group) in the MMX register/memory unit to the MMX register (note 1)

Paddsb mm, mm/M64
Paddsw mm, mm/M64

Adding signed data groups in saturation mode:
Add the signed byte group (Word Group) in the MMX register/memory unit to the signed byte group (Word Group) data in the MMX register. (Note 1)

Paddusb mm, mm/M64
Paddusw mm, mm/M64

Adding unsigned data groups in saturation mode:
Add the unsigned byte group (Word Group) in the MMX register/memory unit to the unsigned byte group (Word Group) data in the MMX register. (Note 1)

Pand mm, mm/M64

Bit-by-bit logic and:
Perform and operate the 64-bit data in the MMX register/memory unit. The result is stored in the MMX register.

Pandn mm, mm/M64

Bit-by-bit logic and non:
The 64-bit values in the MMX register are reversed, and the 64-bit data in the reverse MMX register and the MMX register/memory unit are operated and operated. The result is stored in the MMX register.

Pcmpeqb mm, mm/M64
Pcmpeqw mm, mm/M64
Pcmpeqd mm, mm/M64

Equal comparison of group data:
Compare the MMX register with the byte group (Word Group, double-word group) data in the MMX register/memory unit.
This command compares the data elements of the target and source operands. If the values are equal, the corresponding data elements of the target register are set to full 1. Otherwise, the value is set to full 0.
Eg: pcmpeqe mm, mm/M64

Mm ? ? 00000000000000111 0111000111000111
Mm/M64 ? ? 11111110000001100 0111000111000111
Result mm ? ? 00000000000000000 1111111111111111

Pcmpgtb mm, mm/M64
Pcmpgtw mm, mm/M64
Pcmpgtd mm, mm/M64

Equal comparison of group data:
Compare the MMX register with the byte group (Word Group, double-word group) data in the MMX register/memory unit.
This command compares the corresponding data elements of the target and source operands. If the value is greater than 1, the corresponding data elements of the target register are set to full 1. Otherwise, the value is set to full 0. (refer to the previous one)
Pmaddwd mm, mm/M64 Multiplication and addition of a data group (Word Group:
The MMX register is multiplied by the group data in the MMX register/memory unit, and the 32-bit result is added in pairs and saved in the MMX register as a double character.
Eg: pmaddwd mm, mm/M64
Mm ? ? 0111000111000111 0111000111000111
Operation * * * *
Mm, mm/M64 ? ? 1000000000000000 0000010000000000
Operation /_____ + ____/ /______ + _____/
Mm ? ? 1100100011100011 1001110000000000

Pmulhw mm, mm/M64

The multiplication of group data (word groups) takes the highest position:
Multiply the MMX register and the signed word group data in the MMX register/memory unit, and then store the 16-bit high result into the MMX register.
Eg: pmulhw mm, mm/M64
Mm ? ? 0111000111000111 0111000111000111
Operation * * * *
Mm/M64 ? ? 1000000000000000 0000010000000000
Operation High Order High Order High Order High Order
Mm ? ? 1100011100011100 0000000111000111

Pmullw mm, mm/M64

For group data (Word Group), take the low position after multiplication:
Multiply the MMX register with the signed word group data in the MMX register/memory unit, and then store the 16-bit lower result to the MMX register (refer to the previous one)
Por mm, mm/M64 Logic by bit or:
The 64-bit data in the MMX register/memory unit is stored in the MMX register.

Psllw mm, mm/M64
Pslld mm, mm/M64
Psllq mm, mm/M64
Psllw mm, imm8
Pslld mm, imm8
Psllq mm, imm8

Logical left shift of group data:
Move the data in the MMX register (dual, four-character) to the left based on the number specified by the MMX register/memory unit, and move the data in the low position to 0.
Move the words (dual, four-character) in the MMX register to the left of the number specified by the number of digits immediately at 8 bits, and move the data at the low position to 0.
Psraw mm, mm/M64
Psrad mm, mm/M64
Psraw mm, imm8
Psrad mm, imm8
Arithmetic shift of group data to the right:
Shift the word (dual-word) data in the MMX register to the right based on the number specified by the MMX register/memory unit, and keep the symbol bit in the movement.
Shift the number of characters (dual-characters) in the MMX register to the right based on the number specified by the number of immediate 8 bits, and keep the symbol bit in the movement.
Psrlw mm, mm/M64
Psrld mm, mm/M64
Psrscsi mm, mm/M64
Psrlw mm, imm8
Psrld mm, imm8
Psrscsi mm, imm8
Logical right shift of group data:
Shift the word (dual-word) data in the MMX register to the right based on the number specified by the MMX register/memory unit, and fill the data with 0 after the removal.
Shift the number of characters (dual-characters) in the MMX register to the right based on the number specified by the number of immediate 8 bits, and fill the number with 0 when the removal bits.
Psubb mm, mm/M64
Psubw mm, mm/M64
Psubd mm, mm/M64
Group data subtraction in the surround mode:
Subtract byte (word, double word) from the MMX register/memory unit from the byte (word, double word) group. (Note 1)

Psubsb mm, mm/M64
Psubsw mm, mm/M64

The saturation mode is signed to subtract group data:
Remove the signed byte (Word) group data in the MMX register/memory unit from the signed group data in the MMX register. (Note 1)
Psubusb mm, mm/M64
Psubusw mm, mm/M64
The saturation mode is signed to subtract group data:
Subtract the unsigned byte (Word) group data from the unsigned group data in the MMX register/memory unit. (Note 1)
Punpckhbw mm, mm/M64
Punpckhwd mm, mm/M64
Punpckhdq mm, mm/M64
High group data decomposition:
This command is used to take out the high half of the data element of the source and target operands alternately. The low half of the data element is ignored when written to the target operand.
Eg: punpckhbw mm, mm/M64
Punpcklbw mm, mm/M64
Punpcklwd mm, mm/M64
Punpckldq mm, mm/M64
Low-level grouped data decomposition:
This command is used to take out the lower half of the data element of the source and target operands alternately. The higher half of the data element is ignored when written to the target operand. (refer to the previous one)
Pxor mm, mm/M64 Bit-by-bit logic or:
The 64-bit data in the MMX register/memory unit is stored in the MMX register.

 

 

Intel's MMX (Multimedia enhancement Instruction Set) technology can greatly improve application processing capabilities for 2D and 3D graphics and images. Intel MMX technology can be used for complex processing of large amounts of data and complex arrays. The basic units of data that can be processed using MMX technology can be byte, word ), or double-word ).

Visual Studio. NET 2003 provides support for MMX instruction set features, so that you can directly use C ++ code to implement MMX commands without having to write assembly code. By referring to Intel software manuals [1] and reading the MMX programming technology topics in msdn, you can better grasp the highlights of MMX programming.

MMX technology implements the Execution Mode of multiple data streams (SIMD, single-instruction, multiple-data) with single commands. Consider the following task to be programmed and add a number to each element in a byte array. In traditional programs, the algorithm for implementing this function is as follows:

For each B in array // for each element B in the array
B = B + N // Add the previous number n

Let's take a look at its implementation details:

For each B in array // for each element B in the array
{
Load B into the register
Add n to the number in this register
Return the result in the obtained register to the memory.
}

The processor with MMX instruction set support has eight 64-bit registers. Each register can store 8 bytes and 4 words) double-word ). The MMX technology also provides an MMX instruction set, where instructions can load a value (its type can be byte, word, or dual word) into these MMX registers, perform arithmetic or logical operations in the Register, and then put the results in the register back into the memory storage unit.

MMX effectively improves the processing speed of the CPU on video, audio, and other multimedia, But 3D operations are mostly floating-point operations, while MMX instruction sets do not contribute much to the floating-point computing capability of the CPU, therefore, the MMX Instruction Set has no practical significance in 3D production.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.