From 268b261739f824b82e24456105060070278d2ee6 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 11 Jul 2016 00:39:13 -0400 Subject: [PATCH 1/3] Update comment for Sun Studio 12.4 --- config.h | 3 ++- config.recommend | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/config.h b/config.h index 39b11d87..e5e73c5e 100644 --- a/config.h +++ b/config.h @@ -456,7 +456,8 @@ NAMESPACE_END // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and // MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx) -#if !defined(CRYPTOPP_DISABLE_SSE2) && !defined(CRYPTOPP_DISABLE_SSE4) && (((_MSC_VER >= 1500) && !defined(_M_ARM)) || defined(__SSE4_2__)) && (!defined(__SUNPRO_CC) || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130))) +// SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4. +#if !defined(CRYPTOPP_DISABLE_SSE2) && !defined(CRYPTOPP_DISABLE_SSE4) && (((_MSC_VER >= 1500) && !defined(_M_ARM)) || defined(__SSE4_2__) || (__SUNPRO_CC >= 0x5130)) #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1 #else #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0 diff --git a/config.recommend b/config.recommend index 4e24db31..94114bcb 100644 --- a/config.recommend +++ b/config.recommend @@ -456,7 +456,8 @@ NAMESPACE_END // Intrinsics availible in GCC 4.3 (http://gcc.gnu.org/gcc-4.3/changes.html) and // MSVC 2008 (http://msdn.microsoft.com/en-us/library/bb892950%28v=vs.90%29.aspx) -#if !defined(CRYPTOPP_DISABLE_SSE2) && !defined(CRYPTOPP_DISABLE_SSE4) && (((_MSC_VER >= 1500) && !defined(_M_ARM)) || defined(__SSE4_2__)) && (!defined(__SUNPRO_CC) || (defined(__SUNPRO_CC) && (__SUNPRO_CC >= 0x5130))) +// SunCC could generate SSE4 at 12.1, but the intrinsics are missing until 12.4. +#if !defined(CRYPTOPP_DISABLE_SSE2) && !defined(CRYPTOPP_DISABLE_SSE4) && (((_MSC_VER >= 1500) && !defined(_M_ARM)) || defined(__SSE4_2__) || (__SUNPRO_CC >= 0x5130)) #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 1 #else #define CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE 0 From 5361185ef1c6fdc71f7d52074d501c154007425e Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 11 Jul 2016 15:24:43 -0400 Subject: [PATCH 2/3] Fixed spelling errors in setenv-* scripts --- cryptest.sh | 4 ++-- setenv-android.sh | 2 +- setenv-embedded.sh | 2 +- setenv-ios.sh | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cryptest.sh b/cryptest.sh index 427c598e..82724e63 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -3532,7 +3532,7 @@ if [[ "$HAVE_ARM_CRC" -ne "0" ]]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crc ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crc" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then @@ -3561,7 +3561,7 @@ if [[ "$HAVE_ARM_CRYPTO" -ne "0" ]]; then "$MAKE" clean > /dev/null 2>&1 rm -f adhoc.cpp > /dev/null 2>&1 - export CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crypto ${RETAINED_CXXFLAGS[@]}" + export CXXFLAGS="$RELEASE_CXXFLAGS -march=armv8-a+crypto" "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then diff --git a/setenv-android.sh b/setenv-android.sh index 16f037dd..02b0016a 100755 --- a/setenv-android.sh +++ b/setenv-android.sh @@ -345,7 +345,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environemnt is set correcty. Your next step is" +echo "It looks the the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo diff --git a/setenv-embedded.sh b/setenv-embedded.sh index f8675302..a6caf9ae 100755 --- a/setenv-embedded.sh +++ b/setenv-embedded.sh @@ -132,7 +132,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environemnt is set correcty. Your next step is" +echo "It looks the the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo diff --git a/setenv-ios.sh b/setenv-ios.sh index 2920e92c..309caf50 100755 --- a/setenv-ios.sh +++ b/setenv-ios.sh @@ -281,7 +281,7 @@ fi echo echo "*******************************************************************************" -echo "It looks the the environemnt is set correcty. Your next step is" +echo "It looks the the environment is set correctly. Your next step is" echo "build the library with 'make -f GNUmakefile-cross'" echo "*******************************************************************************" echo From b9232e01b28cef2657bb09a83357f86154872aed Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Mon, 11 Jul 2016 19:41:55 -0400 Subject: [PATCH 3/3] Add tests for SunCC and GCC defines (__SSE2__, __SSE3__, __AES__, __PCLMUL__, __RDRND__, etc) --- cryptest.sh | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/cryptest.sh b/cryptest.sh index 82724e63..3b1e83a5 100755 --- a/cryptest.sh +++ b/cryptest.sh @@ -167,6 +167,7 @@ fi GCC_60_OR_ABOVE=$("$CXX" -v 2>&1 | "$EGREP" -i -c 'gcc version (6\.[0-9]|[7-9])') GCC_51_OR_ABOVE=$("$CXX" -v 2>&1 | "$EGREP" -i -c 'gcc version (5\.[1-9]|[6-9])') GCC_48_COMPILER=$("$CXX" -v 2>&1 | "$EGREP" -i -c 'gcc version 4\.8') +SUNCC_121_OR_ABOVE=$("$CXX" -V 2>&1 | "$EGREP" -c "CC: (Sun|Studio) .* (5\.1[0-9]|5\.[2-9]|[6-9]\.)") # Fixup if [[ ("$IS_OPENBSD" -ne "0" || "$IS_NETBSD" -ne "0") ]]; then @@ -2842,6 +2843,93 @@ if [[ "$IS_SOLARIS" -ne "0" ]]; then fi fi + ############################################ + # SunCC with GCC defines + + if [[ ("$SUNCC_121_OR_ABOVE" -ne "0") ]]; then + + ISAINFO=$(isainfo -v 2>/dev/null) + SUN_SSE2=$(echo "$ISAINFO" | "$GREP" -c "sse2") + SUN_SSE3=$(echo "$ISAINFO" | "$GREP" -c "sse3") + SUN_SSSE3=$(echo "$ISAINFO" | "$GREP" -c "ssse3") + SUN_SSE41=$(echo "$ISAINFO" | "$GREP" -c "sse4.1") + SUN_SSE42=$(echo "$ISAINFO" | "$GREP" -c "sse4.2") + SUN_AES=$(echo "$ISAINFO" | "$GREP" -c "aes") + SUN_PCLMUL=$(echo "$ISAINFO" | "$GREP" -c "pclmulqdq") + SUN_RDRAND=$(echo "$ISAINFO" | "$GREP" -c "rdrand") + SUN_RDSEED=$(echo "$ISAINFO" | "$GREP" -c "rdseed") + SUN_BMI=$(echo "$ISAINFO" | "$GREP" -c "bmi") + SUN_BMI2=$(echo "$ISAINFO" | "$GREP" -c "bmi2") + + SUNCC_CXXFLAGS=() + if [[ ("$SUN_SSE2" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__SSE2__ "; fi + if [[ ("$SUN_SSE3" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__SSE3__ "; fi + if [[ ("$SUN_SSSE3" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__SSSE3__ "; fi + if [[ ("$SUN_SSE41" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__SSE4_1__ "; fi + if [[ ("$SUN_SSE42" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__SSE4_2__ "; fi + # if [[ ("$SUN_AES" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__AES__ "; fi + if [[ ("$SUN_PCLMUL" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__PCLMUL__ "; fi + if [[ ("$SUN_RDRAND" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__RDRND__ "; fi + if [[ ("$SUN_RDSEED" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__RDSEED__ "; fi + if [[ ("$SUN_BMI" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__BMI__ "; fi + if [[ ("$SUN_BMI2" -ne "0") ]]; then SUNCC_CXXFLAGS+="-D__BMI2__ "; fi + + + ############################################ + # Debug build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: SunCC with GCC defines, debug CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="-DDEBUG -g3 -O0 ${SUNCC_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + fi + ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi + + ############################################ + # Release build + echo + echo "************************************" | tee -a "$TEST_RESULTS" + echo "Testing: SunCC with GCC defines, release CXXFLAGS" | tee -a "$TEST_RESULTS" + echo + + unset CXXFLAGS + "$MAKE" clean > /dev/null 2>&1 + rm -f adhoc.cpp > /dev/null 2>&1 + + export CXXFLAGS="-DNDEBUG -g2 -O2 ${SUNCC_CXXFLAGS[@]}" + "$MAKE" "${MAKEARGS[@]}" CXX="$CXX" static dynamic cryptest.exe 2>&1 | tee -a "$TEST_RESULTS" + + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to make cryptest.exe" | tee -a "$TEST_RESULTS" + else + ./cryptest.exe v 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute validation suite" | tee -a "$TEST_RESULTS" + fi + ./cryptest.exe tv all 2>&1 | tee -a "$TEST_RESULTS" + if [[ ("${PIPESTATUS[0]}" -ne "0") ]]; then + echo "ERROR: failed to execute test vectors" | tee -a "$TEST_RESULTS" + fi + fi + fi + ############################################ # GCC on Solaris if [[ (-e "/bin/g++") ]]; then