It doesn't look like it's an issue with clang not knowing that __N is a
compile-time constant. It does look like it's not understanding K.
With Søren's patch, I'm now getting:
fatal error: error in backend: Unsupported asm: input constraint with a
matching output constraint of
incompatible type!
<sarcasm>These errors are so wonderfully helpful and specific</sarcasm>
I'll file a radar for this, but you may need to find a solution for __clang__
until it's resolved.
FWIW:
$ /usr/bin/clang -DHAVE_CONFIG_H -I. -I.. -DDEBUG -DXP_NO_X_HEADERS
-DXPLUGIN_DOCK_SUPPORT -mmmx -Winline -arch i386 -arch x86_64 -O0 -g3 -gdwarf-2
-Wall -fno-strict-aliasing -fvisibility=hidden -c pixman-mmx.c -fno-common
-DPIC -o .libs/libpixman_mmx_la-pixman-mmx.o
pixman-mmx.c:63:73: warning: unknown attribute '__artificial__' ignored
[-Wattributes]
extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__,
__artificial__))
^
fatal error: error in backend: Unsupported asm: input constraint with a
matching output constraint of
incompatible type!
$ /usr/bin/llvm-gcc-4.2 -DHAVE_CONFIG_H -I. -I.. -DDEBUG -DXP_NO_X_HEADERS
-DXPLUGIN_DOCK_SUPPORT -mmmx -Winline -arch i386 -arch x86_64 -O0 -g3 -gdwarf-2
-Wall -fno-strict-aliasing -fvisibility=hidden -c pixman-mmx.c -fno-common
-DPIC -o .libs/libpixman_mmx_la-pixman-mmx.o
pixman-mmx.c:65: warning: ‘__artificial__’ attribute directive ignored
pixman-mmx.c:65: warning: ‘__artificial__’ attribute directive ignored
<success>
On Feb 22, 2012, at 7:53 PM, Søren Sandmann <[email protected]> wrote:
> Matt Turner <[email protected]> writes:
>
>> This looks like an LLVM/clang bug.
>>
>> The 'K' constraint is documented here
>> http://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html#Machine-Constraints
>> as an 8-bit immediate.
>
> Maybe clang just doesn't realize that the __N is compile-time
> constant. If so, changing _mm_shuffle_pi16 to be a macro might help. See
> patch below.
>
>
> Søren
>
>
> From 77f1fcc1bf54f81aa27fd0d309c0190bf53bff66 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?S=C3=B8ren=20Sandmann=20Pedersen?= <[email protected]>
> Date: Wed, 22 Feb 2012 22:52:03 -0500
> Subject: [PATCH] mmx: Make _mm_shuffle_pi16() a macro
>
> That way compilers can have a better chance of realizing that the __N
> argument is compile-time constant.
> ---
> pixman/pixman-mmx.c | 22 +++++++++++-----------
> 1 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
> index a3500ce..9591c84 100644
> --- a/pixman/pixman-mmx.c
> +++ b/pixman/pixman-mmx.c
> @@ -70,18 +70,18 @@ _mm_mulhi_pu16 (__m64 __A, __m64 __B)
> return __A;
> }
>
> -extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__,
> __artificial__))
> -_mm_shuffle_pi16 (__m64 __A, int8_t const __N)
> -{
> - __m64 ret;
> -
> - asm ("pshufw %2, %1, %0\n\t"
> - : "=y" (ret)
> - : "y" (__A), "K" (__N)
> - );
> +/* This has to be a macro; otherwise the compiler may not realize
> + * that __N is a compile-time constant.
> + */
> +#define _mm_shuffle_pi16(__A, __N) \
> + ({ \
> + __m64 __retval; \
> + asm ("pshufw %2, %1, %0\n\t" \
> + : "=y" (__retval) \
> + : "y" (__A), "K" ((int8_t)__N)); \
> + __retval; \
> + })
>
> - return ret;
> -}
> #endif
>
> #define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
> --
> 1.7.4
_______________________________________________
Pixman mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pixman