[Pixman] [PATCH] mmx: convert while (w) to if (w) when possible

Taekyun Kim podain77 at gmail.com
Thu Sep 22 22:21:23 PDT 2011


Though it would be optimized out by the compiler,
how about removing also "w--" and "dst++"?

2011/9/23 Matt Turner <mattst88 at gmail.com>

> gcc isn't able to see that w is no greater than 1, so it generates
> unnecessary loop instructions with while (w).
>
> Signed-off-by: Matt Turner <mattst88 at gmail.com>
> ---
>  pixman/pixman-mmx.c |   10 +++++-----
>  1 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
> index f835a14..6c57909 100644
> --- a/pixman/pixman-mmx.c
> +++ b/pixman/pixman-mmx.c
> @@ -1142,7 +1142,7 @@ mmx_composite_over_n_8888 (pixman_implementation_t
> *imp,
>
>        CHECKPOINT ();
>
> -       while (w)
> +       if (w)
>        {
>            *dst = store8888 (over (vsrc, vsrca, load8888 (*dst)));
>
> @@ -1383,7 +1383,7 @@ mmx_composite_over_8888_n_8888
> (pixman_implementation_t *imp,
>            src += 2;
>        }
>
> -       while (w)
> +       if (w)
>        {
>            __m64 s = load8888 (*src);
>            __m64 d = load8888 (*dst);
> @@ -1758,7 +1758,7 @@ mmx_composite_over_n_8_8888 (pixman_implementation_t
> *imp,
>
>        CHECKPOINT ();
>
> -       while (w)
> +       if (w)
>        {
>            uint64_t m = *mask;
>
> @@ -2026,7 +2026,7 @@ mmx_composite_src_n_8_8888 (pixman_implementation_t
> *imp,
>
>        CHECKPOINT ();
>
> -       while (w)
> +       if (w)
>        {
>            uint64_t m = *mask;
>
> @@ -2366,7 +2366,7 @@ mmx_composite_over_pixbuf_8888
> (pixman_implementation_t *imp,
>            src += 2;
>        }
>
> -       while (w)
> +       if (w)
>        {
>            __m64 s = load8888 (*src);
>            __m64 d = load8888 (*dst);
> --
> 1.7.3.4
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
>



-- 
Best Regards,
Taekyun Kim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20110923/bb222483/attachment.htm>


More information about the Pixman mailing list