Hello again...

sorry if this post does not belong in this group...

is there some way of executing an MMX compare instruction that modifies the flags? AFAIK, there are no such instructions, but i could be wrong.

for example:
pshrq MM0,1 ;divide MM0 by two.

can i make it such that this program will execute a jump (say to the end of a function) if MM0 is zero, but continue on if it is not?
i know i can use the following, though it seems inefficient:

pshrq MM0,1 ;divide MM0 by two.
pxor MM1,MM1

pcmp MM1,MM0
;something to waste a clock

movq ,MM1
;some instruction to waste a cycle here, too

mov ecx,
;nop?

cmp ecx,0
je JumpPoint

...

JumpPoint:
retf


btw, no hurry... i'm just asking out of curiosity.
thanks in advance!
Posted on 2002-03-22 21:49:50 by jademtech
IMO, I think there isn't one that modifies the flags. :(

Quoting from the Intel manuals:
The PCMPEQB, PCMPEQW, and PCMPEQD (compare packed data for equal) and PCMPGTB, PCMPGTW, and PCMPGTD (compare packed signed integers for greater than) instructions compare the corresponding signed data elements (bytes, words, or doublewords) in the source and destination operands for equal to or greater than, respectively. These instructions generate a mask of ones or zeros which are written to the destination operand. Logical operations can use the mask to select packed elements. This can be used to implement a packed conditional move operation without a branch or a set of branch instructions. No flags in the EFLAGS register are affected.
But you could always do something like:


movd eax, MM0
movd edx, MM1
cmp eax, edx
...:)
Posted on 2002-03-22 22:20:56 by stryker

IMO, I think there isn't one that modifies the flags. :(

Quoting from the Intel manuals:But you could always do something like:


movd eax, MM0
movd edx, MM1
cmp eax, edx
...:)

i thought as much... thanks anyway :)

this was originally for a large number routine (i mean, c'mon! who hasn't written one?) but i stopped after a while... to much time, optimising, between school and all. it was doing something like this:
Main_Loop:
MiniLoop
MiniLoop
MiniLoop
MiniLoop
;If i could escape if the registers==0 quickly, that would have been good.
MiniLoop
MiniLoop
MiniLoop
MiniLoop
dec ecx
jne MainLoop

and that jne was my only compare in the addition routine (also one of three non-pairing instructions in the routine)
Posted on 2002-03-22 22:27:09 by jademtech