diff options
author | lloyd <[email protected]> | 2009-10-29 07:06:08 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-10-29 07:06:08 +0000 |
commit | 1419961fbc1ef832940d0f5184c3d71797270ef9 (patch) | |
tree | 8927e640dc08a07d861d480191a8a52a7dfda563 /src/hash | |
parent | ee39df482cb0e5ec9e5d1c1bf349ebdcc2a157c2 (diff) |
Clean up prep00_15 - same speed on Core2
Diffstat (limited to 'src/hash')
-rw-r--r-- | src/hash/sha1_sse2/sha1_sse2.cpp | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/src/hash/sha1_sse2/sha1_sse2.cpp b/src/hash/sha1_sse2/sha1_sse2.cpp index cd1b7e97b..fc6466dd0 100644 --- a/src/hash/sha1_sse2/sha1_sse2.cpp +++ b/src/hash/sha1_sse2/sha1_sse2.cpp @@ -17,23 +17,17 @@ namespace Botan { namespace { /* -the first 16 bytes only need byte swapping - -prepared points to 4x u32bit, 16-byte aligned - -W points to the 4 dwords which need preparing -- -and is overwritten with the swapped bytes +First 16 bytes just need byte swapping. Preparing just means +adding in the round constants. */ -#define prep00_15(prep, W) \ - do { \ - __m128i r1 = (W); \ - r1 = _mm_shufflehi_epi16(r1, _MM_SHUFFLE(2, 3, 0, 1)); \ - r1 = _mm_shufflelo_epi16(r1, _MM_SHUFFLE(2, 3, 0, 1)); \ - __m128i r2 = _mm_slli_epi16(r1, 8); \ - r1 = _mm_srli_epi16(r1, 8); \ - r1 = _mm_or_si128(r1, r2); \ - (W) = r1; \ - (prep).u128 = _mm_add_epi32(K00_19, r1); \ + +#define prep00_15(P, W) \ + do { \ + W = _mm_shufflehi_epi16(W, _MM_SHUFFLE(2, 3, 0, 1)); \ + W = _mm_shufflelo_epi16(W, _MM_SHUFFLE(2, 3, 0, 1)); \ + W = _mm_or_si128(_mm_slli_epi16(W, 8), \ + _mm_srli_epi16(W, 8)); \ + P.u128 = _mm_add_epi32(W, K00_19); \ } while(0) /* |