[Pixman] [PATCH 5/6] mmx: introduce is_equal and is_zero functions
Søren Sandmann
sandmann at cs.au.dk
Tue Feb 28 18:25:02 PST 2012
Matt Turner <mattst88 at gmail.com> writes:
> To be used by the next commit.
>
> Signed-off-by: Matt Turner <mattst88 at gmail.com>
> ---
> pixman/pixman-mmx.c | 17 +++++++++++++++++
> 1 files changed, 17 insertions(+), 0 deletions(-)
>
> diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
> index 8b55b32..63edf18 100644
> --- a/pixman/pixman-mmx.c
> +++ b/pixman/pixman-mmx.c
> @@ -416,6 +416,23 @@ store8888 (uint32_t *dest, __m64 v)
> store(dest, v);
> }
>
> +static force_inline pixman_bool_t
> +is_equal (__m64 a, __m64 b)
> +{
> +#ifdef USE_LOONGSON_MMI
> + /* __m64 is double, we can compare directly. */
> + return a == b;
> +#else
> + return to_uint64 (a) == to_uint64 (b);
> +#endif
> +}
This looks like it will be somewhat less efficient on x86 and possibly
iwmmxt, because it will result in a and b being converted from mmx to 64
bit integers before comparing.
A better way probably be to do something along the lines of what the SSE
implementation does and introduce is_opaque() and is_zero() functions
that use pcmpeqw and pmovmskb.
The pmovmskb instruction is part of the MMX extended instruction set, so
it can be handled similarly to pshufw and pmulhuw.
Soren
More information about the Pixman
mailing list