Improve logic for <arm_acle.h> include (GH #568)
parent
5adfe4e812
commit
5cee4a6573
|
|
@ -108,21 +108,21 @@ case "$THE_ARCH" in
|
|||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -funwind-tables -fexceptions -frtti"
|
||||
AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -DCRYPTOPP_DISABLE_ASM -funwind-tables -fexceptions -frtti"
|
||||
;;
|
||||
armv7a|armv7-a|armeabi-v7a)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi-v7a"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti"
|
||||
AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCRYPTOPP_DISABLE_ASM -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti"
|
||||
;;
|
||||
hard|armv7a-hard|armeabi-v7a-hard)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi-v7a"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard"
|
||||
AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -DCRYPTOPP_DISABLE_ASM -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard"
|
||||
;;
|
||||
neon|armv7a-neon)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
|
|
|
|||
|
|
@ -10,16 +10,19 @@
|
|||
#include "config.h"
|
||||
#include "misc.h"
|
||||
|
||||
#if !(defined(__ARM_NEON) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||
#if (CRYPTOPP_SSSE3_AVAILABLE)
|
||||
# include <tmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SSSE3_AVAILABLE)
|
||||
# include <tmmintrin.h>
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// Clang __m128i casts, http://bugs.llvm.org/show_bug.cgi?id=20670
|
||||
|
|
|
|||
|
|
@ -22,10 +22,6 @@
|
|||
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if !(defined(__ARM_NEON) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SSE41_AVAILABLE)
|
||||
# include <emmintrin.h>
|
||||
# include <tmmintrin.h>
|
||||
|
|
@ -36,6 +32,13 @@
|
|||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// Clang __m128i casts, http://bugs.llvm.org/show_bug.cgi?id=20670
|
||||
#define M128_CAST(x) ((__m128i *)(void *)(x))
|
||||
#define CONST_M128_CAST(x) ((const __m128i *)(const void *)(x))
|
||||
|
|
|
|||
41
config.h
41
config.h
|
|
@ -563,12 +563,20 @@ NAMESPACE_END
|
|||
// Requires ARMv7 and ACLE 1.0. Testing shows ARMv7 is really ARMv7a under most toolchains.
|
||||
// Android still uses ARMv5 and ARMv6 so we have to be conservative when enabling NEON.
|
||||
#if !defined(CRYPTOPP_ARM_NEON_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
|
||||
# if defined(__ARM_NEON) || defined(__ARM_NEON_FP) || defined(__ARM_FEATURE_NEON) || defined(__ARM_FEATURE_ASIMD) || \
|
||||
# if defined(__ARM_NEON) || defined(__ARM_NEON_FP) || defined(__ARM_FEATURE_NEON) || \
|
||||
(__ARM_ARCH >= 7) || (CRYPTOPP_MSC_VERSION >= 1700)
|
||||
# define CRYPTOPP_ARM_NEON_AVAILABLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// ARMv8 and ASIMD, which is NEON. It is part of ARMv8 core.
|
||||
// TODO: Add MSC_VER and ARM-64 platform define when available
|
||||
#if !defined(CRYPTOPP_ARM_ASIMD_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM)
|
||||
# if defined(__aarch32__) || defined(__aarch64__) || (CRYPTOPP_MSC_VERSION >= 1910)
|
||||
# define CRYPTOPP_ARM_ASIMD_AVAILABLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
|
||||
// LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
|
||||
// Microsoft plans to support ARM-64, but its not clear how to detect it.
|
||||
|
|
@ -598,26 +606,33 @@ NAMESPACE_END
|
|||
// Microsoft plans to support ARM-64, but its not clear how to detect it.
|
||||
// TODO: Add Android ARMv8 support for AES and SHA
|
||||
// TODO: Add MSC_VER and ARM-64 platform define when available
|
||||
#if !defined(CRYPTOPP_ARM_CRYPTO_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(__ANDROID__)
|
||||
#if !defined(CRYPTOPP_ARM_AES_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(__ANDROID__)
|
||||
# if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_MSC_VERSION >= 1910) || \
|
||||
defined(__aarch32__) || defined(__aarch64__)
|
||||
# define CRYPTOPP_ARM_AES_AVAILABLE 1
|
||||
# define CRYPTOPP_ARM_SHA_AVAILABLE 1
|
||||
# define CRYPTOPP_ARM_CRYPTO_AVAILABLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Don't include <arm_acle.h> when using Apple Clang. Early Apple compilers
|
||||
// fail to compile with <arm_acle.h> included. Later Apple compilers compile
|
||||
// intrinsics without <arm_acle.h> included. Also avoid it with GCC 4.8,
|
||||
// and avoid it on Android, too.
|
||||
#if defined(CRYPTOPP_ARM_NEON_AVAILABLE) || defined(CRYPTOPP_ARM_CRC32_AVAILABLE) || \
|
||||
defined(CRYPTOPP_ARM_AES_AVAILABLE) || defined(CRYPTOPP_ARM_PMULL_AVAILABLE) || \
|
||||
defined(CRYPTOPP_ARM_SHA_AVAILABLE)
|
||||
# define CRYPTOPP_ARM_ACLE_AVAILABLE 1
|
||||
// Requires ARMv8 and ACLE 2.0. GCC requires 4.8 and above.
|
||||
// LLVM Clang requires 3.5. Apple Clang is unknown at the moment.
|
||||
// Microsoft plans to support ARM-64, but its not clear how to detect it.
|
||||
// TODO: Add Android ARMv8 support for AES and SHA
|
||||
// TODO: Add MSC_VER and ARM-64 platform define when available
|
||||
#if !defined(CRYPTOPP_ARM_SHA_AVAILABLE) && !defined(CRYPTOPP_DISABLE_ASM) && !defined(__ANDROID__)
|
||||
# if defined(__ARM_FEATURE_CRYPTO) || (CRYPTOPP_MSC_VERSION >= 1910) || \
|
||||
defined(__aarch32__) || defined(__aarch64__)
|
||||
# define CRYPTOPP_ARM_SHA_AVAILABLE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if (defined(__ANDROID__) || defined(ANDROID)) && !defined(__ARM_ACLE)
|
||||
// Limit the <arm_acle.h> include.
|
||||
#if defined(__aarch32__) || defined(__aarch64__) || (__ARM_ARCH >= 8) || defined(__ARM_ACLE)
|
||||
# define CRYPTOPP_ARM_ACLE_AVAILABLE 1
|
||||
#endif
|
||||
|
||||
// Man, this is borked. Apple Clang defines __ARM_ACLE but then fails
|
||||
// to compile with "fatal error: 'arm_acle.h' file not found"
|
||||
#if defined(__ANDROID__) || defined(ANDROID) || defined(__APPLE__)
|
||||
# undef CRYPTOPP_ARM_ACLE_AVAILABLE
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -14,10 +14,13 @@
|
|||
# include <nmmintrin.h>
|
||||
#endif
|
||||
|
||||
// Use ARMv8 rather than NEON due to compiler inconsistencies
|
||||
#if (CRYPTOPP_ARM_CRC32_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
|
|
|
|||
|
|
@ -39,11 +39,14 @@
|
|||
# include <wmmintrin.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE || CRYPTOPP_ARM_PMULL_AVAILABLE)
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -10,15 +10,14 @@
|
|||
#include "config.h"
|
||||
#include "stdcpp.h"
|
||||
|
||||
#if !(defined(__ARM_NEON) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,6 @@
|
|||
#include "misc.h"
|
||||
#include "adv-simd.h"
|
||||
|
||||
// We set CRYPTOPP_ARM_AES_AVAILABLE based on compiler version.
|
||||
// If the crypto is not available, then we have to disable it here.
|
||||
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_AES_AVAILABLE
|
||||
#endif
|
||||
|
||||
// We set CRYPTOPP_POWER8_CRYPTO_AVAILABLE based on compiler version.
|
||||
// If the crypto is not available, then we have to disable it here.
|
||||
#if !(defined(__CRYPTO) || defined(_ARCH_PWR8) || defined(_ARCH_PWR9))
|
||||
|
|
@ -43,11 +37,16 @@
|
|||
# include <wmmintrin.h>
|
||||
#endif
|
||||
|
||||
// Use ARMv8 rather than NEON due to compiler inconsistencies
|
||||
#if (CRYPTOPP_ARM_AES_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
#if defined(CRYPTOPP_POWER8_AES_AVAILABLE)
|
||||
|
|
|
|||
|
|
@ -101,21 +101,21 @@ case "$THE_ARCH" in
|
|||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -funwind-tables -fexceptions -frtti"
|
||||
AOSP_FLAGS="-march=armv5te -mtune=xscale -mthumb -msoft-float -DCRYPTOPP_DISABLE_ASM -funwind-tables -fexceptions -frtti"
|
||||
;;
|
||||
armv7a|armv7-a|armeabi-v7a)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi-v7a"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti"
|
||||
AOSP_FLAGS="-march=armv7-a -mthumb -mfpu=vfpv3-d16 -mfloat-abi=softfp -DCRYPTOPP_DISABLE_ASM -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti"
|
||||
;;
|
||||
hard|armv7a-hard|armeabi-v7a-hard)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
TOOLCHAIN_NAME="arm-linux-androideabi"
|
||||
AOSP_ABI="armeabi-v7a"
|
||||
AOSP_ARCH="arch-arm"
|
||||
AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard"
|
||||
AOSP_FLAGS="-mhard-float -D_NDK_MATH_NO_SOFTFP=1 -march=armv7-a -mfpu=vfpv3-d16 -DCRYPTOPP_DISABLE_ASM -mfloat-abi=softfp -Wl,--fix-cortex-a8 -funwind-tables -fexceptions -frtti -Wl,--no-warn-mismatch -Wl,-lm_hard"
|
||||
;;
|
||||
neon|armv7a-neon)
|
||||
TOOLCHAIN_ARCH="arm-linux-androideabi"
|
||||
|
|
|
|||
17
sha-simd.cpp
17
sha-simd.cpp
|
|
@ -11,22 +11,21 @@
|
|||
#include "sha.h"
|
||||
#include "misc.h"
|
||||
|
||||
// We set CRYPTOPP_ARM_SHA_AVAILABLE based on compiler version.
|
||||
// If the crypto is not available, then we have to disable it here.
|
||||
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_SHA_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SHANI_AVAILABLE)
|
||||
# include <nmmintrin.h>
|
||||
# include <immintrin.h>
|
||||
#endif
|
||||
|
||||
// Use ARMv8 rather than NEON due to compiler inconsistencies
|
||||
#if (CRYPTOPP_ARM_SHA_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
#if CRYPTOPP_POWER8_SHA_AVAILABLE
|
||||
|
|
|
|||
|
|
@ -17,21 +17,21 @@
|
|||
#include "sha.h"
|
||||
#include "misc.h"
|
||||
|
||||
// Clang and GCC hoops...
|
||||
#if !(defined(__ARM_FEATURE_CRYPTO) || defined(_MSC_VER))
|
||||
# undef CRYPTOPP_ARM_SHA_AVAILABLE
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SHANI_AVAILABLE)
|
||||
# include <nmmintrin.h>
|
||||
# include <immintrin.h>
|
||||
#endif
|
||||
|
||||
// Use ARMv8 rather than NEON due to compiler inconsistencies
|
||||
#if (CRYPTOPP_ARM_SHA_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
# if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <arm_acle.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// Clang __m128i casts, http://bugs.llvm.org/show_bug.cgi?id=20670
|
||||
|
|
|
|||
|
|
@ -18,10 +18,6 @@
|
|||
// #undef CRYPTOPP_SSE41_AVAILABLE
|
||||
// #undef CRYPTOPP_ARM_NEON_AVAILABLE
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SSSE3_AVAILABLE)
|
||||
# include <pmmintrin.h>
|
||||
# include <tmmintrin.h>
|
||||
|
|
@ -36,6 +32,17 @@
|
|||
# include <immintrin.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// https://www.spinics.net/lists/gcchelp/msg47735.html and
|
||||
// https://www.spinics.net/lists/gcchelp/msg47749.html
|
||||
#if (CRYPTOPP_GCC_VERSION >= 40900)
|
||||
|
|
|
|||
|
|
@ -27,10 +27,6 @@
|
|||
# define WORKAROUND_GCC_AARCH64_BUG 1
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_SSSE3_AVAILABLE)
|
||||
# include <pmmintrin.h>
|
||||
# include <tmmintrin.h>
|
||||
|
|
@ -45,6 +41,17 @@
|
|||
# include <immintrin.h>
|
||||
#endif
|
||||
|
||||
#if (CRYPTOPP_ARM_NEON_AVAILABLE)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
|
||||
// Can't use CRYPTOPP_ARM_XXX_AVAILABLE because too many
|
||||
// compilers don't follow ACLE conventions for the include.
|
||||
#if defined(CRYPTOPP_ARM_ACLE_AVAILABLE)
|
||||
# include <stdint.h>
|
||||
# include <arm_acle.h>
|
||||
#endif
|
||||
|
||||
// https://www.spinics.net/lists/gcchelp/msg47735.html and
|
||||
// https://www.spinics.net/lists/gcchelp/msg47749.html
|
||||
#if (CRYPTOPP_GCC_VERSION >= 40900)
|
||||
|
|
|
|||
Loading…
Reference in New Issue