Not sure if this belongs here or algos... but since it is not complete, i put it here...
This is a routine that converts an integer of length 256 bytes into a string. For example, given a pointer to 102h in esi, it should output:
102 (plus a bunch of trailing 0s) into a string pointed to by edi
i've run into a speed crunch dilemma when i encounter a nibble with a value >9. i could do a PCMP with another quadword, but that would involve tieing up another MMX register... and i'm all out! i don't want to read from memory again, because that would slow this down. Would anyone like to take a stab at this? (yes, i'm aware i can process only 8 bytes at a time instead of 16, but then i would get some stalls due to write/write or write/reads. thanks in advance!

movq MM7,
movq MM6,

mov ecx,16

movq MM0,
movq MM1,

movq MM2,MM0
movq MM3,MM1

psrlq MM0,4
psrlq MM1,4

pand MM2,MM6
pand MM3,MM6

pand MM0,MM6
pand MM1,MM6

paddb MM0,MM7
paddb MM1,MM7

paddb MM2,MM7
paddb MM3,MM7

movq MM4,MM0
movq MM5,MM1

punpcklbw MM0,MM2
punpcklbw MM1,MM3

punpckhbw MM4,MM2
punpckhbw MM5,MM3

movq ,MM0
movq ,MM4

movq ,MM1
add esi,16

movq ,MM5
add edi,32

dec ecx
jne @B

BToSC1 dq 03030303030303030h
BToSC2 dq 00F0F0F0F0F0F0F0Fh
Posted on 2002-03-29 14:55:08 by jademtech