On Sat, Oct 30, 2010 at 6:05 PM, Søren Sandmann <[email protected]> wrote:
> From: Søren Sandmann Pedersen <[email protected]>
>
> GCC assumes that input variables in inline assembly are fully consumed
> before any output variable is written. This means it may allocate the
> variables in the same register unless the output variables are marked
> as early-clobber.
>
> From Jeremy Huddleston:
>
>    I noticed a problem building pixman with clang and reported it to
>    the clang developers.  They responded back with a comment about
>    the inline asm in pixman-mmx.c and suggested a fix:
>
>    """
>    Incidentally, Jeremy, in the asm that reads
>    __asm__ (
>    "movq %7, %0\n"
>    "movq %7, %1\n"
>    "movq %7, %2\n"
>    "movq %7, %3\n"
>    "movq %7, %4\n"
>    "movq %7, %5\n"
>    "movq %7, %6\n"
>    : "=y" (v1), "=y" (v2), "=y" (v3),
>      "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
>    : "y" (vfill));
>
>    all the output operands except the last one should be marked as
>    earlyclobber ("=&y"). This is working by accident with gcc.
>    """
>
> Cc: [email protected]
> ---
>  pixman/pixman-mmx.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
> index e936c4c..34637a4 100644
> --- a/pixman/pixman-mmx.c
> +++ b/pixman/pixman-mmx.c
> @@ -1921,8 +1921,8 @@ pixman_fill_mmx (uint32_t *bits,
>         "movq          %7,     %4\n"
>         "movq          %7,     %5\n"
>         "movq          %7,     %6\n"
> -       : "=y" (v1), "=y" (v2), "=y" (v3),
> -         "=y" (v4), "=y" (v5), "=y" (v6), "=y" (v7)
> +       : "=&y" (v1), "=&y" (v2), "=&y" (v3),
> +         "=&y" (v4), "=&y" (v5), "=&y" (v6), "=y" (v7)
>        : "y" (vfill));
>  #endif
>
> --
> 1.7.3.1

Yep, that's the right thing to do.

Reviewed-by: Matt Turner <[email protected]>
_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman

Reply via email to