Check for _xgetbv() presence
This commit is contained in:
parent
f23d7eff4d
commit
9eea164007
@ -675,7 +675,7 @@ AS_IF([test "x$EMSCRIPTEN" = "x"],[
|
||||
AC_CHECK_FUNCS([arc4random arc4random_buf])
|
||||
AC_CHECK_FUNCS([mmap mlock madvise mprotect explicit_bzero nanosleep])
|
||||
])
|
||||
AC_CHECK_FUNCS([posix_memalign getpid])
|
||||
AC_CHECK_FUNCS([posix_memalign getpid _xgetbv])
|
||||
|
||||
AC_SUBST([LIBTOOL_EXTRA_FLAGS])
|
||||
|
||||
|
@ -3,8 +3,8 @@
|
||||
#ifdef HAVE_ANDROID_GETCPUFEATURES
|
||||
# include <cpu-features.h>
|
||||
#endif
|
||||
#if defined(_MSC_VER) && \
|
||||
(defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86))
|
||||
#if (defined(_MSC_VER) && \
|
||||
(defined(_M_X64) || defined(_M_AMD64) || defined(_M_IX86))) || defined(HAVE__XGETBV)
|
||||
# include <intrin.h>
|
||||
#endif
|
||||
|
||||
@ -149,7 +149,9 @@ _sodium_runtime_intel_cpu_features(CPUFeatures * const cpu_features)
|
||||
if ((cpu_info[2] & (CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) ==
|
||||
(CPUID_ECX_AVX | CPUID_ECX_XSAVE | CPUID_ECX_OSXSAVE)) {
|
||||
uint32_t xcr0 = 0U;
|
||||
# if defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) && _MSC_FULL_VER >= 160040219
|
||||
# if defined(HAVE__XGETBV) ||
|
||||
(defined(_MSC_VER) && defined(_XCR_XFEATURE_ENABLED_MASK) &&
|
||||
_MSC_FULL_VER >= 160040219)
|
||||
xcr0 = (uint32_t) _xgetbv(0);
|
||||
# elif defined(_MSC_VER) && defined(_M_IX86)
|
||||
__asm {
|
||||
|
Loading…
Reference in New Issue
Block a user