|
These instructions generate a mask of ones or zeros which can be used by logical operations to select elements within a register: a developer can implement a packed conditional move operation without a set of branch instructions.
PCMPEQB mm, mm/m64 |
The PCMPEQ (Packed Compare for Equal) instructions compare the data elements in the destination operand to the corresponding data elements in the source operand. If the data elements are equal, the corresponding data element in the destination register is set to all ones, if they are not, it is set to all zeros. PCMPEQ supports packed byte (PCMPEQB), packed word (PCMPEQW) and packed doubleword (PCMPEQD) data types.
|
PCMPEQB instruction with 64-bit operands: IF DEST[7..0] = SRC[7..0] THEN DEST[7 0) ← FFH; ELSE DEST[7..0] ← 0; * Continue comparison of 2nd through 7th bytes in DEST and SRC * IF DEST[63..56] = SRC[63..56] THEN DEST[63..56] ← FFH; ELSE DEST[63..56] ← 0; PCMPEQW instruction with 64-bit operands: PCMPEQD instruction with 64-bit operands: |
PCMPEQB __m64 _mm_cmpeq_pi8 (__m64 m1, __m64 m2)
PCMPEQW __m64 _mm_cmpeq_pi16 (__m64 m1, __m64 m2) PCMPEQD __m64 _mm_cmpeq_pi32 (__m64 m1, __m64 m2) |
PCMPGTB mm, mm/m64 |
The PCMPGT (Packed Compare for Greater Than) instructions compare the signed data elements in the destination operand to the signed data elements in the source operand. If the signed data elements in the destination register are greater than those in the source operand, the corresponding data element in the destination operand is set to all ones, otherwise it is set to all zeros. PCMPGT supports packed byte (PCMPGTB), packed word (PCMPGTW) and packed doubleword (PCMPGTD) data types. |
PCMPGTB instruction with 64-bit operands: IF DEST[7..0] > SRC[7..0] THEN DEST[7 0) ← FFH; ELSE DEST[7..0] ← 0; * Continue comparison of 2nd through 7th bytes in DEST and SRC * IF DEST[63..56] > SRC[63..56] THEN DEST[63..56] ← FFH; ELSE DEST[63..56] ← 0; PCMPGTW instruction with 64-bit operands: PCMPGTD instruction with 64-bit operands: |
PCMPGTB __m64 _mm_cmpgt_pi8 (__m64 m1, __m64 m2)
PCMPGTW __m64 _mm_pcmpgt_pi16 (__m64 m1, __m64 m2) PCMPGTD __m64 _mm_pcmpgt_pi32 (__m64 m1, __m64 m2) |