diff options
author | e-sidorov <e-sidorov@yandex-team.ru> | 2022-02-10 16:46:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:06 +0300 |
commit | ce2ad6f6a6f6025e37fb7f8debe7cefd3aa2307c (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /library/cpp/digest/argonish/internal/rotations/rotations_avx2.h | |
parent | 1ec091f8998d76a211c6015ba6865a73b29d676a (diff) | |
download | ydb-ce2ad6f6a6f6025e37fb7f8debe7cefd3aa2307c.tar.gz |
Restoring authorship annotation for <e-sidorov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/digest/argonish/internal/rotations/rotations_avx2.h')
-rw-r--r-- | library/cpp/digest/argonish/internal/rotations/rotations_avx2.h | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/library/cpp/digest/argonish/internal/rotations/rotations_avx2.h b/library/cpp/digest/argonish/internal/rotations/rotations_avx2.h index 6d1910d34c..81cd171f59 100644 --- a/library/cpp/digest/argonish/internal/rotations/rotations_avx2.h +++ b/library/cpp/digest/argonish/internal/rotations/rotations_avx2.h @@ -1,30 +1,30 @@ -#pragma once - -#include <immintrin.h> - -namespace NArgonish { - static inline void XorValues(__m256i* result, const __m256i* val1, const __m256i* val2) { - _mm256_storeu_si256(result, _mm256_xor_si256( - _mm256_loadu_si256(val1), _mm256_loadu_si256(val2))); - } - - static inline __m256i Rotr32(__m256i x) { - return _mm256_shuffle_epi32(x, _MM_SHUFFLE(2, 3, 0, 1)); - } - - static inline __m256i Rotr24(__m256i x) { - return _mm256_shuffle_epi8(x, _mm256_setr_epi8( - 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, - 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10)); - } - - static inline __m256i Rotr16(__m256i x) { - return _mm256_shuffle_epi8(x, _mm256_setr_epi8( - 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, - 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9)); - } - - static inline __m256i Rotr63(__m256i x) { - return _mm256_xor_si256(_mm256_srli_epi64(x, 63), _mm256_add_epi64(x, x)); - } -} +#pragma once + +#include <immintrin.h> + +namespace NArgonish { + static inline void XorValues(__m256i* result, const __m256i* val1, const __m256i* val2) { + _mm256_storeu_si256(result, _mm256_xor_si256( + _mm256_loadu_si256(val1), _mm256_loadu_si256(val2))); + } + + static inline __m256i Rotr32(__m256i x) { + return _mm256_shuffle_epi32(x, _MM_SHUFFLE(2, 3, 0, 1)); + } + + static inline __m256i Rotr24(__m256i x) { + return _mm256_shuffle_epi8(x, _mm256_setr_epi8( + 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10, + 3, 4, 5, 6, 7, 0, 1, 2, 11, 12, 13, 14, 15, 8, 9, 10)); + } + + static inline __m256i Rotr16(__m256i x) { + return _mm256_shuffle_epi8(x, _mm256_setr_epi8( + 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9, + 2, 3, 4, 5, 6, 7, 0, 1, 10, 11, 12, 13, 14, 15, 8, 9)); + } + + static inline __m256i Rotr63(__m256i x) { + return _mm256_xor_si256(_mm256_srli_epi64(x, 63), _mm256_add_epi64(x, x)); + } +} |