[Pixman] [PATCH] [mmx] Mark some of the output variables as earlyclobber.

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Oct 30 20:37:47 PDT 2010


On Sunday 31 October 2010 01:05:59 Søren Sandmann wrote:
> 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.
>     """

Strictly speaking, this code should be always executed correctly even though it
definitely looks suspicious. Assuming that the compiler does not have bugs, the
worst that can happen is that some register would be assigned to itself, which
is a redundant instruction with some minor performance loss. In the end, all
the operands are going to have "vfill" value, no matter whether "vfill" happens
to be shared with some other operand or not.

So the patch looks good and improves code quality, but the comment is
misleading because it sounds like it tries to address some serious problem.

-- 
Best regards,
Siarhei Siamashka
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/pixman/attachments/20101031/8527d66a/attachment.pgp>


More information about the Pixman mailing list