From 42d91b76fcd2ae04e2c6d5218734b61372885881 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 7 Aug 2017 12:03:17 -0400 Subject: [PATCH] Fix compile under Clang 3.5 due to use of SSE4.1 Both Apple and LLVM Clang want -msse4.2 even when only SSE4.1 is used. Sidestep it because we don't know how it will affect some of the lower end Atoms. 84877:/usr/include/clang/3.5.0/include/nmmintrin.h:28:2: error: "SSE4.2 instruction set not enabled" 84878:#error "SSE4.2 instruction set not enabled" 84880:rijndael-simd.cpp:466:26: error: use of undeclared identifier '_mm_extract_epi32'; did you mean '_mm_extract_epi16'? 84887:rijndael-simd.cpp:480:11: error: use of undeclared identifier '_mm_insert_epi32'; did you mean '_mm_insert_epi16'? 84894:rijndael-simd.cpp:485:11: error: use of undeclared identifier '_mm_insert_epi32'; did you mean '_mm_insert_epi16'? ... --- neon.cpp | 4 ++-- rijndael-simd.cpp | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/neon.cpp b/neon.cpp index 99d87463..15b81a6b 100644 --- a/neon.cpp +++ b/neon.cpp @@ -73,10 +73,10 @@ bool CPU_TryNEON_ARM() } return result; # else -# if defined(__android__) && defined(CRYPTOPP_BOOL_ARM64) +# if defined(__android__) && (CRYPTOPP_BOOL_ARM64) if (android_getCpuFeatures() & ANDROID_CPU_ARM64_FEATURE_ASIMD) return true; -# elif defined(__android__) && defined(CRYPTOPP_BOOL_ARM32) +# elif defined(__android__) && (CRYPTOPP_BOOL_ARM32) if (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) return true; # elif defined(__linux__) && defined(__aarch64__) diff --git a/rijndael-simd.cpp b/rijndael-simd.cpp index e7e48e94..e97becad 100644 --- a/rijndael-simd.cpp +++ b/rijndael-simd.cpp @@ -31,12 +31,12 @@ #endif #if (CRYPTOPP_SSE41_AVAILABLE) -// Hack... Apple conflates SSE4.1 and SSE4.2. Without __SSE4_2__, -// Apple fails the compile with "SSE4.2 instruction set not enabled" -// when "nmmintrin.h" is included. Its non-trivial for us to -// automatically add -msse4.2 for Apple Clang. We also want to -// avoid problems on low-end Atoms which have AES but lack SSE4.2. -# if (CRYPTOPP_APPLE_CLANG_VERSION) +// Hack... Clang conflates SSE4.1 and SSE4.2. Without __SSE4_2__, +// early Apple and LLVM compilers fail with "SSE4.2 instruction +// set not enabled" when "nmmintrin.h" is included. Its non-trivial +// for us to automatically add -msse4.2 for Apple Clang. We also want +// to avoid problems on low-end Atoms which have AES but lack SSE4.2. +# if defined(__clang__) # define __SSE4_2__ 1 # endif # include "nmmintrin.h"