Is there a simple way to do a (dword) rotate left with MMX? At the moment the best I can think of is:

regsrc - The register to rotate
c - Number of bits to rotate
regx - Spare register to use

prlld MACRO regsrc:REQ,c:REQ,regx:=<MM7>

movq regx,regsrc
pslld regsrc,c
psllr regx,32 - c
por regsrc,regx


So in use:

prlld MM0,13,MM1
prlld MM3,19

Any sugesstions?
Posted on 2002-06-07 02:31:57 by huh
If the ROL is a multiple of 16 PSHULW could be used on
Athlon / P3 / P4. Cool thing is you get a movq for free too.

pshulw dest,scr,10010011y ; ROL 16 ; ROR 48
pshulw dest,scr,01001110y ; ROL 32 ; ROR 32
pshulw dest,scr,00111001y ; ROL 48 ; ROR 16
nop ; pshulw dest,scr,11100100y ; ROL 64 ; ROR 64
Posted on 2002-06-07 05:39:05 by bitRAKE