Don't use _pext_u64() directly

This intrinsic to call BMI2 PEXT instruction is
defined in immintrin.h. This header should be
included only when USE_PEXT is defined, otherwise
we define _pext_u64 as 0 forcing a nop.

But under some mingw platforms, even if we don't
include the header, immintrin.h gets included
anyhow through an include chain that starts with
STL <algorithm> header. So we end up both defining
_pext_u64 function and at the same time defining
_pext_u64 as 0 leading to a compile error.

The correct solution is of not using _pext_u64 directly.

This patch fixes a compile error with some mingw64
package when compiling with x86-64.

No functional change.
This commit is contained in:
Marco Costalba
2015-01-20 22:17:22 +01:00
parent ca3622f8e8
commit f54c44e6be
3 changed files with 4 additions and 3 deletions

View File

@@ -71,8 +71,9 @@
#if defined(USE_PEXT)
# include <immintrin.h> // Header for _pext_u64() intrinsic
# define pext(b, m) _pext_u64(b, m)
#else
# define _pext_u64(b, m) (0)
# define pext(b, m) (0)
#endif
#ifdef _MSC_VER