From f532b02a96edb154ba7edcc3684f6175cea009bf Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sat, 23 Jul 2016 21:39:18 -0400 Subject: [PATCH] Add replacement for _mm_set_epi64x under Sun Studio 12.3 and below --- blake2.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/blake2.cpp b/blake2.cpp index 1fa6ef44..e44d99ef 100644 --- a/blake2.cpp +++ b/blake2.cpp @@ -34,10 +34,20 @@ NAMESPACE_BEGIN(CryptoPP) # undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE #endif -// SunCC needs 12.4 for _mm_set_epi64x, _mm_blend_epi16, _mm_shuffle_epi16, etc +// Sun Studio 12.3 and earlier lack SSE2's _mm_set_epi64x. +// Also see http://stackoverflow.com/a/38547909/608639 #if defined(__SUNPRO_CC) && (__SUNPRO_CC < 0x5130) -# undef CRYPTOPP_BOOL_SSE2_INTRINSICS_AVAILABLE -# undef CRYPTOPP_BOOL_SSE4_INTRINSICS_AVAILABLE +inline __m128i _mm_set_epi64x(const uint64_t a, const uint64_t b) +{ + union INT_128_64 { + __m128i v128; + uint64_t v64[2]; + }; + + INT_128_64 v; + v.v64[0] = a; v.v64[1] = b; + return v.v128; +} #endif // C/C++ implementation