[Pixman] [RFC PATCH] mmx: Use shuffle instruction when available
sandmann at cs.au.dk
Mon Feb 13 13:21:17 PST 2012
sandmann at cs.au.dk (Søren Sandmann) writes:
> 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
> 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
Actually, I remember an issue with these instructions. The problem is
that to get gcc to accept them on x86, pixman-mmx.c would have to be
compiled with -msse. Unfortunately, this caused gcc to generate
SSE-but-not-3DNow! instructions that then caused the original OLPC to
It may be that we can get around this problem by using -m3dnow instead
and hope that this won't cause gcc to generate the floating point
instructions that were also part of 3DNow!, but not available for SSE.
If it *does* generate such instructions, maybe we should just skip MMX
for regular PCs. It's not like there are a lot of Pentium IIIs around
More information about the Pixman