diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-09-30 15:31:13 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-10-03 21:02:48 +0400 |
commit | f765df54f07a945f38bc31a59a90b8c7be5487d6 (patch) | |
tree | b3317b2256dd842d5617143c7882aebc4d4b60c6 /src/thirdparty/unrar/blake2s_sse.cpp | |
parent | 6322d201ba9112791142fac705478f127327a932 (diff) |
Update Unrar to unrarsrc-5.0.12.tar.gz.
Diffstat (limited to 'src/thirdparty/unrar/blake2s_sse.cpp')
-rw-r--r-- | src/thirdparty/unrar/blake2s_sse.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/src/thirdparty/unrar/blake2s_sse.cpp b/src/thirdparty/unrar/blake2s_sse.cpp index 93b28b07d..a44fb62f1 100644 --- a/src/thirdparty/unrar/blake2s_sse.cpp +++ b/src/thirdparty/unrar/blake2s_sse.cpp @@ -11,9 +11,6 @@ extern const byte blake2s_sigma[10][16]; #define mm_rotr_epi32(r, c) ( \ _mm_xor_si128(_mm_srli_epi32( (r), c ),_mm_slli_epi32( (r), 32-c )) ) #else -// Constants for cyclic rotation. -static const __m128i crotr8 = _mm_set_epi8( 12, 15, 14, 13, 8, 11, 10, 9, 4, 7, 6, 5, 0, 3, 2, 1 ); -static const __m128i crotr16 = _mm_set_epi8( 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2 ); #define mm_rotr_epi32(r, c) ( \ c==8 ? _mm_shuffle_epi8(r,crotr8) \ : c==16 ? _mm_shuffle_epi8(r,crotr16) \ @@ -73,12 +70,23 @@ static const __m128i crotr16 = _mm_set_epi8( 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, } -// Initialization vector. -static const __m128i blake2s_IV_0_3 = _mm_setr_epi32( 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A ); -static const __m128i blake2s_IV_4_7 = _mm_setr_epi32( 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ); - static int blake2s_compress_sse( blake2s_state *S, const byte block[BLAKE2S_BLOCKBYTES] ) { + // Initialization vector. Moving them outside of function would provide + // ~5% speed gain in 32-bit mode, but would make code incompatible + // with older non-SSE2 compatible CPUs. Global static initialization + // is performed before our SSE check. + static const __m128i blake2s_IV_0_3 = _mm_setr_epi32( 0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A ); + static const __m128i blake2s_IV_4_7 = _mm_setr_epi32( 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19 ); + +#ifdef _WIN_64 + // Constants for cyclic rotation. We use them in 64-bit mode + // in mm_rotr_epi32 macro above. We must not define in global scope + // to be compatible with non-SSE CPU. + static const __m128i crotr8 = _mm_set_epi8( 12, 15, 14, 13, 8, 11, 10, 9, 4, 7, 6, 5, 0, 3, 2, 1 ); + static const __m128i crotr16 = _mm_set_epi8( 13, 12, 15, 14, 9, 8, 11, 10, 5, 4, 7, 6, 1, 0, 3, 2 ); +#endif + __m128i row[4]; __m128i ff0, ff1; |