movq MM0,OWORD PTR NEW_SYMBOL.NAME
movq MM1,OWORD PTR NEW_SYMBOL.NAME+8
movq MM2,OWORD PTR NEW_SYMBOL.NAME+16
movq MM3,OWORD PTR NEW_SYMBOL.NAME+24

I want to use the above plus some more code to check if 2 32 byte strings are equivilent. I just wonding if MMX has any issues with endieness.

I never really used MMX. If anyone remebers the name of the AMD or Intel PDF with the MMX info, please tell me, I forgot where they are on my hardrives......
Posted on 2004-10-11 12:19:33 by ThoughtCriminal
Haven't used mmx, so I don't know about endieness.
But Intel pdf is 24319002.pdf (Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture).
Posted on 2004-10-11 13:19:21 by arafel
x86 CPU's are little endian, so I guess the string should be in little endian format as well. But this wont matter if you read both strings into registers and perform the compare between the two registers.
Posted on 2004-10-11 14:32:10 by x86asm


movq MM0,OWORD PTR NEW_SYMBOL.NAME
movq MM1,OWORD PTR NEW_SYMBOL.NAME+8
movq MM2,OWORD PTR NEW_SYMBOL.NAME+16
movq MM3,OWORD PTR NEW_SYMBOL.NAME+24

I want to use the above plus some more code to check if 2 32 byte strings are equivilent. I just wonding if MMX has any issues with endieness.

I never really used MMX. If anyone remebers the name of the AMD or Intel PDF with the MMX info, please tell me, I forgot where they are on my hardrives......


you can use PCMPEQB for the comparison, and PMOVMSKB to move the results of the high bits to a register to check to see if it matches. Here is a brief example. It isn't done in the fastest way, it's just to demonstrate. Also PMOVMSKB requires a P3 or higher.



movq mm0, oword ptr [string1]
movq mm1, oword ptr [string2]
pcmpeqb mm0,mm1 ; destroys the values in mm0, by saving the comparisons to it
pmovmskb eax,mm0 ; moves the high bit of each byte into EAX
; the previous comparison saves FF for each byte that matches
; and 0 for each byte that does not
not eax ; flip the bits so that now 1's indicate not matching so we can use TEST
test eax,0ffh ; any bits set? If so mismatch
jnz mis_match

Posted on 2004-10-18 21:25:35 by mark_larson
Thanks mark. This is the code I came up with:


movq MM0,OWORD PTR NEW_SYMBOL.NAME
movq MM4,OWORD PTR DIRECTIVE
pcmpeqb MM0,MM4
movd eax,MM0
test al,0
jne parse_start

movq MM1,OWORD PTR NEW_SYMBOL.NAME+8
movq MM5,OWORD PTR DIRECTIVE+8
pcmpeqb MM1,MM5
movd eax,MM1
test al,0
jne parse_start

movq MM2,OWORD PTR NEW_SYMBOL.NAME+16
movq MM6,OWORD PTR DIRECTIVE+16
pcmpeqb MM2,MM6
movd eax,MM2
test al,0
jne parse_start

movq MM3,OWORD PTR NEW_SYMBOL.NAME+24
movq MM7,OWORD PTR DIRECTIVE+24
pcmpeqb MM3,MM7
movd eax,MM3
test al,0
jne parse_start
Posted on 2004-10-21 04:38:32 by ThoughtCriminal