1 |
commit: 3e0bbe689cf555a4b68cea32a5ba5d5f5b898641 |
2 |
Author: Michael Palimaka <kensington <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 28 10:58:58 2017 +0000 |
4 |
Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 28 10:59:53 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e0bbe68 |
7 |
|
8 |
dev-qt/qtcore: backport patch from upstream fixing build when AVX2 is enabled but __F16C__ isn't defined |
9 |
|
10 |
Closes: https://bugs.gentoo.org/635388 |
11 |
Package-Manager: Portage-2.3.14, Repoman-2.3.6 |
12 |
|
13 |
dev-qt/qtcore/files/qtcore-5.9.3-avx.patch | 69 ++++++++++++++++++++++++++++++ |
14 |
dev-qt/qtcore/qtcore-5.9.3.ebuild | 2 + |
15 |
2 files changed, 71 insertions(+) |
16 |
|
17 |
diff --git a/dev-qt/qtcore/files/qtcore-5.9.3-avx.patch b/dev-qt/qtcore/files/qtcore-5.9.3-avx.patch |
18 |
new file mode 100644 |
19 |
index 00000000000..be18433be20 |
20 |
--- /dev/null |
21 |
+++ b/dev-qt/qtcore/files/qtcore-5.9.3-avx.patch |
22 |
@@ -0,0 +1,69 @@ |
23 |
+From d813c66bfcfac1837814ec4d174d0389172f0d4c Mon Sep 17 00:00:00 2001 |
24 |
+From: Thiago Macieira <thiago.macieira@×××××.com> |
25 |
+Date: Tue, 25 Apr 2017 12:02:09 -0300 |
26 |
+Subject: Fix the build when AVX2 is enabled but __F16C__ isn't defined |
27 |
+ |
28 |
+If -mavx2 is used, __AVX2__ is defined, which enables the F16C code |
29 |
+after commit 280e321e52fd4e86545f3f0d4bd4e047786a897e, but that was |
30 |
+wrong since we aren't allowed to use the F16C intrinsics with either |
31 |
+Clang or GCC (we can only do that with GCC 4.9 and Clang 4.8, and only |
32 |
+with an __attribute__ decoration). |
33 |
+ |
34 |
+With ICC and MSVC, we are allowed to use the intrinsics, but the |
35 |
+#include was missing. |
36 |
+ |
37 |
+[ChangeLog][QtCore] Fixed a compilation issue with qfloat16 if AVX2 |
38 |
+support is enabled in the compiler. Since all processors that support |
39 |
+AVX2 also support F16C, for GCC and Clang it is recommended to either |
40 |
+add -mf16c to your build or to use the corresponding -march= switch. |
41 |
+ |
42 |
+Task-number: QTBUG-64529 |
43 |
+Change-Id: I84e363d735b443cb9beefffd14b8ac1fd4baa978 |
44 |
+Reviewed-by: Allan Sandfeld Jensen <allan.jensen@××.io> |
45 |
+--- |
46 |
+ src/corelib/global/qfloat16.h | 15 ++++++++++++--- |
47 |
+ 1 file changed, 12 insertions(+), 3 deletions(-) |
48 |
+ |
49 |
+diff --git a/src/corelib/global/qfloat16.h b/src/corelib/global/qfloat16.h |
50 |
+index 89a62a93db..a0aa9496b4 100644 |
51 |
+--- a/src/corelib/global/qfloat16.h |
52 |
++++ b/src/corelib/global/qfloat16.h |
53 |
+@@ -44,7 +44,16 @@ |
54 |
+ #include <QtCore/qmetatype.h> |
55 |
+ #include <string.h> |
56 |
+ |
57 |
+-#if defined __F16C__ |
58 |
++#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__) |
59 |
++// All processors that support AVX2 do support F16C too. That doesn't mean |
60 |
++// we're allowed to use the intrinsics directly, so we'll do it only for |
61 |
++// the Intel and Microsoft's compilers. |
62 |
++# if defined(Q_CC_INTEL) || defined(Q_CC_MSVC) |
63 |
++# define __F16C__ 1 |
64 |
++# endif |
65 |
++#endif |
66 |
++ |
67 |
++#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) |
68 |
+ #include <immintrin.h> |
69 |
+ #endif |
70 |
+ |
71 |
+@@ -116,7 +125,7 @@ QT_WARNING_DISABLE_CLANG("-Wc99-extensions") |
72 |
+ QT_WARNING_DISABLE_GCC("-Wold-style-cast") |
73 |
+ inline qfloat16::qfloat16(float f) Q_DECL_NOTHROW |
74 |
+ { |
75 |
+-#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__)) |
76 |
++#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) |
77 |
+ __m128 packsingle = _mm_set_ss(f); |
78 |
+ __m128i packhalf = _mm_cvtps_ph(packsingle, 0); |
79 |
+ b16 = _mm_extract_epi16(packhalf, 0); |
80 |
+@@ -134,7 +143,7 @@ QT_WARNING_POP |
81 |
+ |
82 |
+ inline qfloat16::operator float() const Q_DECL_NOTHROW |
83 |
+ { |
84 |
+-#if defined(QT_COMPILER_SUPPORTS_F16C) && (defined(__F16C__) || defined(__AVX2__)) |
85 |
++#if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__F16C__) |
86 |
+ __m128i packhalf = _mm_cvtsi32_si128(b16); |
87 |
+ __m128 packsingle = _mm_cvtph_ps(packhalf); |
88 |
+ return _mm_cvtss_f32(packsingle); |
89 |
+-- |
90 |
+cgit v1.1-6-g87c4 |
91 |
+ |
92 |
|
93 |
diff --git a/dev-qt/qtcore/qtcore-5.9.3.ebuild b/dev-qt/qtcore/qtcore-5.9.3.ebuild |
94 |
index 779bc30c7b9..5442d7c47bf 100644 |
95 |
--- a/dev-qt/qtcore/qtcore-5.9.3.ebuild |
96 |
+++ b/dev-qt/qtcore/qtcore-5.9.3.ebuild |
97 |
@@ -24,6 +24,8 @@ DEPEND=" |
98 |
" |
99 |
RDEPEND="${DEPEND}" |
100 |
|
101 |
+PATCHES=( "${FILESDIR}/${P}-avx.patch" ) |
102 |
+ |
103 |
QT5_TARGET_SUBDIRS=( |
104 |
src/tools/bootstrap |
105 |
src/tools/moc |