Gentoo Archives: gentoo-commits

From: Austin English <wizardedit@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: x11-libs/pixman/files/, x11-libs/pixman/
Date: Sun, 26 Jun 2016 22:52:26
Message-Id: 1466981529.617823801a0fd4105e0de308d6b4a4efedcd1fdf.wizardedit@gentoo
1 commit: 617823801a0fd4105e0de308d6b4a4efedcd1fdf
2 Author: Austin English <wizardedit <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jun 26 22:51:05 2016 +0000
4 Commit: Austin English <wizardedit <AT> gentoo <DOT> org>
5 CommitDate: Sun Jun 26 22:52:09 2016 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=61782380
7
8 x11-libs/pixman: fix building with Clang
9
10 Gentoo-Bug: https://bugs.gentoo.org/566048
11
12 Package-Manager: portage-2.2.28
13
14 x11-libs/pixman/files/pixman-0.32.8-clang.patch | 93 +++++++++++++++++++++++++
15 x11-libs/pixman/pixman-0.32.8.ebuild | 7 +-
16 2 files changed, 99 insertions(+), 1 deletion(-)
17
18 diff --git a/x11-libs/pixman/files/pixman-0.32.8-clang.patch b/x11-libs/pixman/files/pixman-0.32.8-clang.patch
19 new file mode 100644
20 index 0000000..d531929
21 --- /dev/null
22 +++ b/x11-libs/pixman/files/pixman-0.32.8-clang.patch
23 @@ -0,0 +1,93 @@
24 +From d24b415f3e2753a588759d028b811e1ce38fea6c Mon Sep 17 00:00:00 2001
25 +From: Andrea Canciani <ranma42@×××××.com>
26 +Date: Sun, 11 Oct 2015 09:45:57 +0200
27 +Subject: mmx: Improve detection of support for "K" constraint
28 +
29 +Older versions of clang emitted an error on the "K" constraint, but at
30 +least since version 3.7 it is supported. Just like gcc, this
31 +constraint is only allowed for constants, but apparently clang
32 +requires them to be known before inlining.
33 +
34 +Using the macro definition _mm_shuffle_pi16(A, N) ensures that the "K"
35 +constraint is always applied to a literal constant, independently from
36 +the compiler optimizations and allows building pixman-mmx on modern
37 +clang.
38 +
39 +Reviewed-by: Matt Turner <mattst88@×××××.com>
40 +Signed-off-by: Andrea Canciani <ranma42@×××××.com>
41 +
42 +diff --git a/configure.ac b/configure.ac
43 +index 2178126..3a66909 100644
44 +--- a/configure.ac
45 ++++ b/configure.ac
46 +@@ -347,15 +347,27 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
47 + #error "Need GCC >= 3.4 for MMX intrinsics"
48 + #endif
49 + #include <mmintrin.h>
50 ++#include <stdint.h>
51 ++
52 ++/* Check support for block expressions */
53 ++#define _mm_shuffle_pi16(A, N) \
54 ++ ({ \
55 ++ __m64 ret; \
56 ++ \
57 ++ /* Some versions of clang will choke on K */ \
58 ++ asm ("pshufw %2, %1, %0\n\t" \
59 ++ : "=y" (ret) \
60 ++ : "y" (A), "K" ((const int8_t)N) \
61 ++ ); \
62 ++ \
63 ++ ret; \
64 ++ })
65 ++
66 + int main () {
67 + __m64 v = _mm_cvtsi32_si64 (1);
68 + __m64 w;
69 +
70 +- /* Some versions of clang will choke on K */
71 +- asm ("pshufw %2, %1, %0\n\t"
72 +- : "=y" (w)
73 +- : "y" (v), "K" (5)
74 +- );
75 ++ w = _mm_shuffle_pi16(v, 5);
76 +
77 + /* Some versions of clang will choke on this */
78 + asm ("pmulhuw %1, %0\n\t"
79 +diff --git a/pixman/pixman-mmx.c b/pixman/pixman-mmx.c
80 +index 05c48a4..dec3974 100644
81 +--- a/pixman/pixman-mmx.c
82 ++++ b/pixman/pixman-mmx.c
83 +@@ -89,21 +89,7 @@ _mm_mulhi_pu16 (__m64 __A, __m64 __B)
84 + return __A;
85 + }
86 +
87 +-# ifdef __OPTIMIZE__
88 +-extern __inline __m64 __attribute__((__gnu_inline__, __always_inline__, __artificial__))
89 +-_mm_shuffle_pi16 (__m64 __A, int8_t const __N)
90 +-{
91 +- __m64 ret;
92 +-
93 +- asm ("pshufw %2, %1, %0\n\t"
94 +- : "=y" (ret)
95 +- : "y" (__A), "K" (__N)
96 +- );
97 +-
98 +- return ret;
99 +-}
100 +-# else
101 +-# define _mm_shuffle_pi16(A, N) \
102 ++# define _mm_shuffle_pi16(A, N) \
103 + ({ \
104 + __m64 ret; \
105 + \
106 +@@ -114,7 +100,6 @@ _mm_shuffle_pi16 (__m64 __A, int8_t const __N)
107 + \
108 + ret; \
109 + })
110 +-# endif
111 + # endif
112 + #endif
113 +
114 +--
115 +cgit v0.10.2
116 +
117
118 diff --git a/x11-libs/pixman/pixman-0.32.8.ebuild b/x11-libs/pixman/pixman-0.32.8.ebuild
119 index cefd423..e612abc 100644
120 --- a/x11-libs/pixman/pixman-0.32.8.ebuild
121 +++ b/x11-libs/pixman/pixman-0.32.8.ebuild
122 @@ -1,8 +1,9 @@
123 -# Copyright 1999-2015 Gentoo Foundation
124 +# Copyright 1999-2016 Gentoo Foundation
125 # Distributed under the terms of the GNU General Public License v2
126 # $Id$
127
128 EAPI=5
129 +XORG_EAUTORECONF=yes
130 XORG_MULTILIB=yes
131 inherit xorg-2 toolchain-funcs versionator
132
133 @@ -16,6 +17,10 @@ RDEPEND="abi_x86_32? (
134 !app-emulation/emul-linux-x86-gtklibs[-abi_x86_32(-)]
135 )"
136
137 +PATCHES=(
138 + "${FILESDIR}/${P}-clang.patch"
139 +)
140 +
141 src_configure() {
142 XORG_CONFIGURE_OPTIONS=(
143 $(use_enable cpu_flags_x86_mmxext mmx)