Description: fix build with gcc 6.3 and newer versions
 The builtins clzs and ctzs have been removed. Additionally they were
 never proper internal GCC builtins and shouldn't have been used in a
 constexpr function in the first place. This patch removes the assumption
 that they exist when BMI is available, and let GCC fall back to using
 __builtin_clz and __builtin_ctz.
Origin: upstream, https://code.qt.io/cgit/qt/qtbase.git/commit/?id=bb0f29f82b934b48
 Manually rebased against the 5.7.1 release by Dmitry Shachnev.
Bug: https://bugs.debian.org/846996
Last-Update: 2016-12-23

--- a/src/corelib/tools/qalgorithms.h
+++ b/src/corelib/tools/qalgorithms.h
@@ -626,7 +626,7 @@
 Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
 {
 #if defined(Q_CC_GNU)
-#  if QT_HAS_BUILTIN(__builtin_ctzs) || (defined(__LZCNT__) && defined(__BMI__))
+#  if QT_HAS_BUILTIN(__builtin_ctzs)
     return v ? __builtin_ctzs(v) : 16U;
 #  else
     return v ? __builtin_ctz(v) : 16U;
@@ -689,7 +689,7 @@
 Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
 {
 #if defined(Q_CC_GNU)
-#  if QT_HAS_BUILTIN(__builtin_clzs) || (defined(__LZCNT__) && defined(__BMI__))
+#  if QT_HAS_BUILTIN(__builtin_clzs)
     return v ? __builtin_clzs(v) : 16U;
 #  else
     return v ? __builtin_clz(v)-16U : 16U;
