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
