diff options
author | Jack Lloyd <[email protected]> | 2018-11-10 13:42:31 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2018-11-10 13:43:34 -0500 |
commit | 82324d3993aa40ac7a24db6b2d40d7edf129276e (patch) | |
tree | 78a34d1454b67415f1aee1f75996e1ea6c8e3c4d /src/lib/utils/simd | |
parent | b1e1e618eac3ca317414a57269b1b4b28cc10098 (diff) |
Use vzeroupper/vzeroall to transition between AVX and SSE states.
Otherwise some CPUs suffer serious stalls. Using vzeroall on exit
also has the nice effect that we don't have to worry about register
contents leaking.
HT to @noloader for doing the background research on this.
Diffstat (limited to 'src/lib/utils/simd')
-rw-r--r-- | src/lib/utils/simd/simd_avx2/simd_avx2.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/utils/simd/simd_avx2/simd_avx2.h b/src/lib/utils/simd/simd_avx2/simd_avx2.h index 6e8c04f4b..fde086e53 100644 --- a/src/lib/utils/simd/simd_avx2/simd_avx2.h +++ b/src/lib/utils/simd/simd_avx2/simd_avx2.h @@ -227,6 +227,18 @@ class SIMD_8x32 final B3.m_avx2 = _mm256_unpackhi_epi64(T2, T3); } + BOTAN_FUNC_ISA("avx2") + static void reset_registers() + { + _mm256_zeroupper(); + } + + BOTAN_FUNC_ISA("avx2") + static void zero_registers() + { + _mm256_zeroall(); + } + __m256i handle() const { return m_avx2; } private: |