Stefano Tommesani

  • Increase font size
  • Default font size
  • Decrease font size
Home Programming MMX Comparison

MMX Comparison

Hits

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
PCMPEQW mm, mm/m64
PCMPEQD 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:
IF DEST[15..0] = SRC[15..0]
THEN DEST[15..0] ← FFFFH;
ELSE DEST[15..0] ← 0;
* Continue comparison of 2nd and 3rd words in DEST and SRC *
IF DEST[63..48] = SRC[63..48]
THEN DEST[63..48] ← FFFFH;
ELSE DEST[63..48] ← 0;

PCMPEQD instruction with 64-bit operands:
IF DEST[31..0] = SRC[31..0]
THEN DEST[31..0] ← FFFFFFFFH;
ELSE DEST[31..0] ← 0;
IF DEST[63..32] = SRC[63..32]
THEN DEST[63..32] ← FFFFFFFFH;
ELSE DEST[63..32] ← 0;

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
PCMPGTW mm, mm/m64
PCMPGTD 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:
IF DEST[15..0] > SRC[15..0]
THEN DEST[15..0] ← FFFFH;
ELSE DEST[15..0] ← 0;
* Continue comparison of 2nd and 3rd words in DEST and SRC *
IF DEST[63..48] > SRC[63..48]
THEN DEST[63..48] ← FFFFH;
ELSE DEST[63..48] ← 0;

PCMPGTD instruction with 64-bit operands:
IF DEST[31..0] > SRC[31..0]
THEN DEST[31..0] ← FFFFFFFFH;
ELSE DEST[31..0] ← 0;
IF DEST[63..32] > SRC[63..32]
THEN DEST[63..32] ← FFFFFFFFH;
ELSE DEST[63..32] ← 0;

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)

Quote this article on your site

To create link towards this article on your website,
copy and paste the text below in your page.




Preview :

MMX Comparison
Saturday, 24 April 2010

Powered by QuoteThis © 2008
 

Latest Articles

A software to stand out 27 January 2018, 14.35 Web
A software to stand out
Standing out of the pack starts by being visible, and being noticed by the right group of professionals. No matter how good your profile is, it is lost in a sea of similar profiles, so you need to show up and start attracting
Web page scraping, the easy way 07 January 2018, 00.46 Web
Web page scraping, the easy way
There are many ways to extract data elements from web pages, almost all of them prettier and cooler than the method proposed here, but as we are in an hurry, let's get that data quickly, ok? Suppose we have to extract the
Scraping dynamic page content 06 January 2018, 23.57 Web
Scraping dynamic page content
One of the most common roadblocks when scraping the content of web sites is getting the full contents of the page, including JS-generated data elements (probably, the ones you are looking for). So, when using CEFSharp to scrape
Unit-testing file I/O 26 November 2017, 12.09 Testing
Unit-testing file I/O
Two good news: file I/O is unit-testable, and it is surprisingly easy to do. Let's see how it works! A software no-one asked for First, we need a piece of software that deals with files and that has to be unit-tested. The
Fixing Git pull errors in SourceTree 10 April 2017, 01.44 Software
Fixing Git pull errors in SourceTree
If you encounter the following error when pulling a repository in SourceTree: VirtualAlloc pointer is null, Win32 error 487 it is due to to the Cygwin system failing to allocate a 5 MB large chunk of memory for its heap at
View Stefano Tommesani's profile on LinkedIn