diff options
author | Jack Lloyd <[email protected]> | 2016-10-14 12:03:22 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2016-10-14 12:03:22 -0400 |
commit | 8b3bda479efecef760f052cc055d3d6d98bf0637 (patch) | |
tree | 77cd13fe2e62085c2f04bf437c1e845a20bf6a01 /src/lib/block/threefish_avx2 | |
parent | 60fc0ebf44e746b17d46a9d53054064808476495 (diff) |
Add ISA annotations to functions using SIMD, AES, etc
Also emit `#pragma GCC target` in the ISA specific amalgamation files.
This allows compiling without any special compiler flags, at least
with GCC 6.2 and Clang 3.8. The ISA annotations are ignored in MSVC,
which just emits whatever instruction the intrinsic requires.
Diffstat (limited to 'src/lib/block/threefish_avx2')
-rw-r--r-- | src/lib/block/threefish_avx2/threefish_avx2.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/block/threefish_avx2/threefish_avx2.cpp b/src/lib/block/threefish_avx2/threefish_avx2.cpp index e0321812a..e4a46e3de 100644 --- a/src/lib/block/threefish_avx2/threefish_avx2.cpp +++ b/src/lib/block/threefish_avx2/threefish_avx2.cpp @@ -12,6 +12,7 @@ namespace Botan { namespace { +BOTAN_FUNC_ISA("avx2") inline void interleave_epi64(__m256i& X0, __m256i& X1) { // interleave X0 and X1 qwords @@ -24,6 +25,7 @@ inline void interleave_epi64(__m256i& X0, __m256i& X1) X1 = _mm256_permute4x64_epi64(T1, _MM_SHUFFLE(3,1,2,0)); } +BOTAN_FUNC_ISA("avx2") inline void deinterleave_epi64(__m256i& X0, __m256i& X1) { const __m256i T0 = _mm256_permute4x64_epi64(X0, _MM_SHUFFLE(3,1,2,0)); @@ -33,6 +35,7 @@ inline void deinterleave_epi64(__m256i& X0, __m256i& X1) X1 = _mm256_unpackhi_epi64(T0, T1); } +BOTAN_FUNC_ISA("avx2") inline void rotate_keys(__m256i& R0, __m256i& R1, __m256i R2) { /* @@ -71,6 +74,7 @@ inline void rotate_keys(__m256i& R0, __m256i& R1, __m256i R2) } +BOTAN_FUNC_ISA("avx2") void Threefish_512::avx2_encrypt_n(const byte in[], byte out[], size_t blocks) const { const u64bit* K = &get_K()[0]; @@ -245,6 +249,7 @@ void Threefish_512::avx2_encrypt_n(const byte in[], byte out[], size_t blocks) c #undef THREEFISH_INJECT_KEY_2 } +BOTAN_FUNC_ISA("avx2") void Threefish_512::avx2_decrypt_n(const byte in[], byte out[], size_t blocks) const { const u64bit* K = &get_K()[0]; |