Fix use of <x86intrin.h> for MSVC (GH #1198)

It seems Microsoft now defines GCC defines, like __BMI__
This commit is contained in:
Jeffrey Walton 2023-04-15 18:21:03 -04:00
parent f5f63850f9
commit ddb8f36e88
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
14 changed files with 38 additions and 34 deletions

View File

@ -33,11 +33,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_SSE41_AVAILABLE)
# include <emmintrin.h>

View File

@ -43,11 +43,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_SSE41_AVAILABLE)
# include <emmintrin.h>

View File

@ -45,11 +45,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_ARM_NEON_HEADER)
# include <arm_neon.h>

View File

@ -23,11 +23,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
// Clang intrinsic casts, http://bugs.llvm.org/show_bug.cgi?id=20670
#define DOUBLE_CAST(x) ((double*)(void*)(x))

View File

@ -87,4 +87,10 @@
# define CRYPTOPP_MSC_VERSION (_MSC_VER)
#endif
// To control <x86intrin.h> include. May need a guard, like GCC 4.5 and above
// Also see https://stackoverflow.com/a/42493893 and https://github.com/weidai11/cryptopp/issues/1198
#if defined(CRYPTOPP_GCC_VERSION) || defined(CRYPTOPP_APPLE_CLANG_VERSION) || defined(CRYPTOPP_LLVM_CLANG_VERSION)
# define CRYPTOPP_GCC_COMPATIBLE 1
#endif
#endif // CRYPTOPP_CONFIG_VERSION_H

View File

@ -27,11 +27,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
// Squash MS LNK4221 and libtool warnings
extern const char KECCAK_SIMD_FNAME[] = __FILE__;

View File

@ -23,11 +23,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_ARM_NEON_HEADER)
# include "adv_simd.h"

View File

@ -25,8 +25,7 @@ extern const char LSH256_AVX_FNAME[] = __FILE__;
# include <immintrin.h>
#endif
// GCC at 4.5. Clang is unknown. Also see https://stackoverflow.com/a/42493893.
#if (CRYPTOPP_GCC_VERSION >= 40500)
#if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
#endif

View File

@ -30,8 +30,7 @@ extern const char LSH256_SSE_FNAME[] = __FILE__;
# include <ammintrin.h>
#endif
// GCC at 4.5. Clang is unknown. Also see https://stackoverflow.com/a/42493893.
#if (CRYPTOPP_GCC_VERSION >= 40500)
#if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
#endif

View File

@ -25,8 +25,7 @@ extern const char LSH512_AVX_FNAME[] = __FILE__;
# include <immintrin.h>
#endif
// GCC at 4.5. Clang is unknown. Also see https://stackoverflow.com/a/42493893.
#if (CRYPTOPP_GCC_VERSION >= 40500)
#if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
#endif

View File

@ -29,8 +29,7 @@ extern const char LSH512_SSE_FNAME[] = __FILE__;
# include <ammintrin.h>
#endif
// GCC at 4.5. Clang is unknown. Also see https://stackoverflow.com/a/42493893.
#if (CRYPTOPP_GCC_VERSION >= 40500)
#if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
#endif

6
misc.h
View File

@ -80,9 +80,11 @@
#endif
#if defined(__BMI__)
# include <x86intrin.h>
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
# include <immintrin.h>
#endif // GCC and BMI
#endif // BMI
// More LLVM bullshit. Apple Clang 6.0 does not define them.
// Later version of Clang defines them and results in warnings.

View File

@ -23,11 +23,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_ARM_NEON_HEADER)
# include "adv_simd.h"

View File

@ -23,11 +23,11 @@
#endif
#if defined(__XOP__)
# include <ammintrin.h>
# if defined(__GNUC__)
# if defined(CRYPTOPP_GCC_COMPATIBLE)
# include <x86intrin.h>
# endif
#endif
# include <ammintrin.h>
#endif // XOP
#if (CRYPTOPP_ARM_NEON_HEADER)
# include "adv_simd.h"