No subject

=3D?UTF-8?q?S=3DC3=3DB8ren=3D20Sandmann=3D20Pedersen?=3D ssp at redhat.=
Wed Feb 22 19:21:42 PST 2012


com>
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;
 }
=20
-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"
-	: "=3Dy" (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"                                    \
+            : "=3Dy" (__retval)                                          \
+            : "y" (__A), "K" ((int8_t)__N));                           \
+       __retval;                                                       \
+    })
=20
-    return ret;
-}
 #endif
=20
 #define _MM_SHUFFLE(fp3,fp2,fp1,fp0) \
--=20
1.7.4


More information about the Pixman mailing list