x86: Fix build with BMI but no LZCNT extensions
The GCC builtins for clzs and ctzs are enabled when the x86 extension
for LZCNT and TZCNT are enabled. The use of only __BMI__ in commit
f5f47987ce
was incorrect.
But GCC needs both BMI and LZCNT enabled to enable this builtin.
Change-Id: I1cc7601489634e96833cfffd145647e9fc9f2f51
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
7a4ce3cbcc
commit
43ff604f94
@ -626,7 +626,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint8 v) Q_DECL_NOT
|
|||||||
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
|
Q_DECL_RELAXED_CONSTEXPR inline uint qCountTrailingZeroBits(quint16 v) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
#if defined(Q_CC_GNU)
|
#if defined(Q_CC_GNU)
|
||||||
# if QT_HAS_BUILTIN(__builtin_ctzs) || defined(__BMI__)
|
# if QT_HAS_BUILTIN(__builtin_ctzs) || (defined(__LZCNT__) && defined(__BMI__))
|
||||||
return v ? __builtin_ctzs(v) : 16U;
|
return v ? __builtin_ctzs(v) : 16U;
|
||||||
# else
|
# else
|
||||||
return v ? __builtin_ctz(v) : 16U;
|
return v ? __builtin_ctz(v) : 16U;
|
||||||
@ -689,7 +689,7 @@ Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint8 v) Q_DECL_NOTH
|
|||||||
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
|
Q_DECL_RELAXED_CONSTEXPR inline uint qCountLeadingZeroBits(quint16 v) Q_DECL_NOTHROW
|
||||||
{
|
{
|
||||||
#if defined(Q_CC_GNU)
|
#if defined(Q_CC_GNU)
|
||||||
# if QT_HAS_BUILTIN(__builtin_clzs) || defined(__BMI__)
|
# if QT_HAS_BUILTIN(__builtin_clzs) || (defined(__LZCNT__) && defined(__BMI__))
|
||||||
return v ? __builtin_clzs(v) : 16U;
|
return v ? __builtin_clzs(v) : 16U;
|
||||||
# else
|
# else
|
||||||
return v ? __builtin_clz(v)-16U : 16U;
|
return v ? __builtin_clz(v)-16U : 16U;
|
||||||
|
Loading…
Reference in New Issue
Block a user