flat assembler
Message board for the users of flat assembler.

Index > Main > Notes on using basic MMX

Author
Thread Post new topic Reply to topic
hopcode



Joined: 04 Mar 2008
Posts: 563
Location: Germany
hopcode
Hallo Everybody,
I am starting a new thread to post here all notes and snippets using the basic Pentium MMX instructions.
I will start with the PCMPGTB.
As stated in Intel docs
Quote:
0F 64 /r PCMPGTB mm, mm/m64
A Valid Valid Compare packed signed byte integers in mm and mm/m64 for greater than.

the following snippet works as expected, to substitute 20h <= chars > 7Fh with dot (2Eh) :
Code:
 mask2E dq 2E2E2E2E2E2E2E2Eh
 mask20 dq 2020202020202020h
 result dq 0
 dummy dd 0
 szStr1 db "hell",127,128,129,13

 movq mm3,qword[mask2E]
 movq mm4,qword[mask20]

 movq mm0,qword[szStr1]
 movq mm1,mm0
 pcmpgtb mm0,mm4
 pand mm1,mm0
 pandn mm0,mm3
 por mm1,mm0
 movq qword[result],mm1
    

After comparing

13 129 128 127 l l e h gives 00 00 00 FF FF FF FF FF in MM0

It is to say,you dont need another compare for chars > 7F. But signedness is not described (or the doc was not yet updated) on RHyde MMX Chapter 11.7.5

Cheers, Very Happy
hopcode
.
Post 24 Feb 2010, 06:35
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
You can always download the Intel/AMD docs directly for the current info. No need to rely upon third party websites, they could be out of date or wrong.
Post 24 Feb 2010, 07:13
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.