[Pixman] [RFC PATCH] mmx: Use shuffle instruction when available

Søren Sandmann sandmann at cs.au.dk
Mon Feb 13 11:18:46 PST 2012


Matt Turner <mattst88 at gmail.com> writes:

> Although not part of the original MMX instruction set, both SSE and
> AMD's Extended 3DNow! both provide the pshufw instruction.
>
> ARM iwMMXt also has an equivalent instruction, as do the Loongson
> Multimedia Instructions.
>
> We can simplify the expand_alpha, expand_alpha_rev, and invert_colors
> functions down to this single instruction.
>
> The SSE intrinsics provide _mm_shuffle_pi16, but there aren't 3DNow!
> intrinsics (to my knowledge). This will require a bit of work to
> configure.ac, which I haven't done yet.

> I'm interested in hearing some opinions on using Extended MMX
> instructions.

It looks like we already require the "MMX_EXTENSIONS" flag in
pixman-cpu.c in order to use the MMX implementation, so I can't see any
reason to not just use these instructions without any ifdefs etc. Note
that the SSE flag is 0x6 - ie., it also sets MMX_EXTENSIONS which is
0x2).

Is there any reason to think that the SSE intrinsics wouldn't also work
for 3DNow? As far as I know, Intel adopted the integer extensions to MMX
that were part of 3DNow! without changes.


Søren


More information about the Pixman mailing list