[mmx] Mark some of the output variables as early-clobber.
authorSøren Sandmann Pedersen <ssp@redhat.com>
Sat, 30 Oct 2010 21:20:22 +0000 (17:20 -0400)
committerSøren Sandmann Pedersen <ssp@redhat.com>
Fri, 5 Nov 2010 01:03:38 +0000 (21:03 -0400)
commitf405b4079872ecc312f9514fdadc5287e8f20b08
treefbfc9b10cb4c109a517453a1b175be268239c727
parent9c19a85b0037d48fdd180a2c59ef05bdc4f46680
[mmx] Mark some of the output variables as early-clobber.

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: jeremyhu@apple.com
Reviewed-by: Matt Turner <mattst88@gmail.com>
pixman/pixman-mmx.c