summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAustin English <wizardedit@gentoo.org>2016-06-26 17:51:05 -0500
committerAustin English <wizardedit@gentoo.org>2016-06-26 17:52:09 -0500
commit617823801a0fd4105e0de308d6b4a4efedcd1fdf (patch)
tree4cf8712ad46428f94c2990d8295c183795bf43f5 /x11-libs/pixman/files
parentlicenses: Remove unused. (diff)
downloadgentoo-617823801a0fd4105e0de308d6b4a4efedcd1fdf.tar.gz
gentoo-617823801a0fd4105e0de308d6b4a4efedcd1fdf.tar.bz2
gentoo-617823801a0fd4105e0de308d6b4a4efedcd1fdf.zip
x11-libs/pixman: fix building with Clang
Gentoo-Bug: https://bugs.gentoo.org/566048 Package-Manager: portage-2.2.28
Diffstat (limited to 'x11-libs/pixman/files')
-rw-r--r--x11-libs/pixman/files/pixman-0.32.8-clang.patch93
1 files changed, 93 insertions, 0 deletions
diff --git a/x11-libs/pixman/files/pixman-0.32.8-clang.patch b/x11-libs/pixman/files/pixman-0.32.8-clang.patch
new file mode 100644
index 000000000000..d5319292fbd8
--- /dev/null
+++ b/x11-libs/pixman/files/pixman-0.32.8-clang.patch
@@ -0,0 +1,93 @@
+From d24b415f3e2753a588759d028b811e1ce38fea6c Mon Sep 17 00:00:00 2001
+From: Andrea Canciani <ranma42@gmail.com>
+Date: Sun, 11 Oct 2015 09:45:57 +0200
+Subject: mmx: Improve detection of support for "K" constraint
+
+Older versions of clang emitted an error on the "K" constraint, but at
+least since version 3.7 it is supported. Just like gcc, this
+constraint is only allowed for constants, but apparently clang
+requires them to be known before inlining.
+
+Using the macro definition _mm_shuffle_pi16(A, N) ensures that the "K"
+constraint is always applied to a literal constant, independently from
+the compiler optimizations and allows building pixman-mmx on modern
+clang.
+
+Reviewed-by: Matt Turner <mattst88@gmail.com>
+Signed-off-by: Andrea Canciani <ranma42@gmail.com>
+
+diff --git a/configure.ac b/configure.ac
+index 2178126..3a66909 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -347,15 +347,27 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
+ #error "Need GCC >= 3.4 for MMX intrinsics"
+ #endif
+ #include <mmintrin.h>
++#include <stdint.h>
++
++/* Check support for block expressions */
++#define _mm_shuffle_pi16(A, N) \
++ ({ \
++ __m64 ret; \
++ \
++ /* Some versions of clang will choke on K */ \
++ asm ("pshufw %2, %1, %0\n\t" \
++ : "=y" (ret) \
++ : "y" (A), "K" ((const int8_t)N) \
++ ); \
++ \
++ ret; \
++ })
++
+ int main () {
+ __m64 v = _mm_cvtsi32_si64 (1);
+ __m64 w;
+
+- /* Some versions of clang will choke on K */
+- asm ("pshufw %2, %1, %0\n\t"
+- : "=y" (w)
+- : "y" (v), "K" (5)
+- );
++ w = _mm_shuffle_pi16(v, 5);
+
+ /* Some versions of clang will choke on this */
+ asm ("pmulhuw %1, %0\n\t"
+diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
+index 05c48a4..dec3974 100644
+--- a/pixman/pixman-mmx.c
++++ b/pixman/pixman-mmx.c
+@@ -89,21 +89,7 @@ _mm_mulhi_pu16 (__m64 __A, __m64 __B)
+ return __A;
+ }
+
+-# ifdef __OPTIMIZE__
+-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)
+- );
+-
+- return ret;
+-}
+-# else
+-# define _mm_shuffle_pi16(A, N) \
++# define _mm_shuffle_pi16(A, N) \
+ ({ \
+ __m64 ret; \
+ \
+@@ -114,7 +100,6 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
+ \
+ ret; \
+ })
+-# endif
+ # endif
+ #endif
+
+--
+cgit v0.10.2
+