From f839e5093caba1579488d3348a76bf98e44052d9 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Fri, 9 Nov 2018 20:35:27 -0500 Subject: [PATCH] Enable SSE2 intrinsics for SunCC --- chacha-simd.cpp | 4 ++-- config.h | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/chacha-simd.cpp b/chacha-simd.cpp index 280ae490..f30ecb27 100644 --- a/chacha-simd.cpp +++ b/chacha-simd.cpp @@ -30,12 +30,12 @@ #include "chacha.h" #include "misc.h" -#if defined(__SSE2__) || defined(_MSC_VER) +#if (CRYPTOPP_SSE2_INTRIN_AVAILABLE || CRYPTOPP_SSE2_ASM_AVAILABLE) # include # include #endif -#if defined(__SSSE3__) || defined(_MSC_VER) +#if defined(__SSSE3__) # include #endif diff --git a/config.h b/config.h index 2d47cf5c..c4748136 100644 --- a/config.h +++ b/config.h @@ -484,17 +484,12 @@ NAMESPACE_END # define CRYPTOPP_DISABLE_ASM 1 #endif -// SunCC prior to 5.10 cannot handle some SSE intrinsics -#if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5100) +// Sun Studio 12.1 provides GCC inline assembly +// http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support +#if !defined(CRYPTOPP_DISABLE_ASM) && defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5100) # define CRYPTOPP_DISABLE_ASM 1 #endif -// Sun Studio 12 provides GCC inline assembly, http://blogs.oracle.com/x86be/entry/gcc_style_asm_inlining_support -// We can enable SSE2 for Sun Studio in the makefile with -D__SSE2__, but users may not compile with it. -#if !defined(CRYPTOPP_DISABLE_ASM) && !defined(__SSE2__) && defined(__x86_64__) && (__SUNPRO_CC >= 0x5100) -# define __SSE2__ 1 -#endif - #if !defined(CRYPTOPP_DISABLE_ASM) && ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))) // C++Builder 2010 does not allow "call label" where label is defined within inline assembly #define CRYPTOPP_X86_ASM_AVAILABLE 1 @@ -517,7 +512,7 @@ NAMESPACE_END #endif // 32-bit SunCC does not enable SSE2 by default. -#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__)) +#if !defined(CRYPTOPP_DISABLE_ASM) && (defined(_MSC_VER) || CRYPTOPP_GCC_VERSION >= 30300 || defined(__SSE2__) || (__SUNPRO_CC >= 0x5100)) #define CRYPTOPP_SSE2_INTRIN_AVAILABLE 1 #endif