From 677811870e7afc58f68a5564358b2bbd6169169f Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Thu, 1 Aug 2024 23:47:29 +0300 Subject: [PATCH] Add a patch to use _Float16 only when SSE2 is enabled. Closes: #1076986. --- debian/changelog | 2 + debian/patches/series | 1 + .../patches/use_float16_only_with_sse2.patch | 39 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 debian/patches/use_float16_only_with_sse2.patch diff --git a/debian/changelog b/debian/changelog index f95004f..8e8bca4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,7 @@ qt6-base (6.6.2+dfsg-11) UNRELEASED; urgency=medium + [ Dmitry Shachnev ] + * Add a patch to use _Float16 only when SSE2 is enabled (closes: #1076986). -- Debian Qt/KDE Maintainers Thu, 01 Aug 2024 23:45:39 +0300 diff --git a/debian/patches/series b/debian/patches/series index 18d208c..2202b39 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -8,6 +8,7 @@ Add-SH-detection.patch # Pushed to gerrit be_verbose_on_plugin_inclusion.patch +use_float16_only_with_sse2.patch # Debian specific remove_privacy_breaches.diff diff --git a/debian/patches/use_float16_only_with_sse2.patch b/debian/patches/use_float16_only_with_sse2.patch new file mode 100644 index 0000000..faf24af --- /dev/null +++ b/debian/patches/use_float16_only_with_sse2.patch @@ -0,0 +1,39 @@ +Description: use _Float16 only when SSE2 is enabled + The GCC documentation [1] says: “On x86 targets with SSE2 enabled, GCC + supports half-precision (16-bit) floating point via the _Float16 type”. + . + On non-SSE2 x86 (such as Debian i386 baseline [2]), __FLT16_MAX__ is + defined starting with GCC 14 [3], however any non-trivial use of the + _Float16 type results in an error: + . + error: operation not permitted on type ‘_Float16’ without option ‘-msse2’ + . + which makes some packages fail to build on i386 architecture [4]. + . + [1]: https://gcc.gnu.org/onlinedocs/gcc/Half-Precision.html + [2]: https://wiki.debian.org/ArchitectureSpecificsMemo#i386-1 + [3]: https://gcc.gnu.org/g:9a19fa8b616f83474c35cc5b34a3865073ced829 + [4]: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1076986 +Author: Dmitry Shachnev +Forwarded: https://codereview.qt-project.org/c/qt/qtbase/+/579205 +Last-Update: 2024-08-01 + +--- a/src/corelib/global/qtypes.h ++++ b/src/corelib/global/qtypes.h +@@ -263,13 +263,12 @@ using NativeFloat16Type = std::float16_t + // disabled due to https://github.com/llvm/llvm-project/issues/56963 + # define QFLOAT16_IS_NATIVE 1 + using NativeFloat16Type = decltype(__FLT16_MAX__); +-#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__) ++#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__) && defined(__ARM_FP16_FORMAT_IEEE) + # define QFLOAT16_IS_NATIVE 1 +-# ifdef __ARM_FP16_FORMAT_IEEE + using NativeFloat16Type = __fp16; +-# else ++#elif defined(Q_CC_GNU_ONLY) && defined(__FLT16_MAX__) && defined(__SSE2__) ++# define QFLOAT16_IS_NATIVE 1 + using NativeFloat16Type = _Float16; +-# endif + #else + # define QFLOAT16_IS_NATIVE 0 + using NativeFloat16Type = void;