Fix gcc 6.4 builds

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.

Change-Id: I3e0b4e246098bb9ce6ede28b311948260ef881b9
Task-number: QTBUG-56813
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Allan Sandfeld Jensen 2016-12-12 23:53:22 +01:00 committed by Jani Heikkinen
parent 4c0760d327
commit bb0f29f82b

View File

@ -535,7 +535,7 @@ QT_DEPRECATED_X("Use std::binary_search") Q_OUTOFLINE_TEMPLATE RandomAccessItera
# define QT_HAS_BUILTIN_CTZS # define QT_HAS_BUILTIN_CTZS
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
{ {
# if QT_HAS_BUILTIN(__builtin_ctzs) || defined(__BMI__) # if QT_HAS_BUILTIN(__builtin_ctzs)
return __builtin_ctzs(v); return __builtin_ctzs(v);
# else # else
return __builtin_ctz(v); return __builtin_ctz(v);
@ -544,7 +544,7 @@ Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_ctzs(quint16 v) Q_DECL_NOTHROW
#define QT_HAS_BUILTIN_CLZS #define QT_HAS_BUILTIN_CLZS
Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
{ {
# if QT_HAS_BUILTIN(__builtin_clzs) || defined(__BMI__) # if QT_HAS_BUILTIN(__builtin_clzs)
return __builtin_clzs(v); return __builtin_clzs(v);
# else # else
return __builtin_clz(v) - 16U; return __builtin_clz(v) - 16U;