From 3b827f9f3832ca8b53618ff18b5a7e0a95749986 Mon Sep 17 00:00:00 2001 From: Vitaly Chikunov Date: Thu, 6 Feb 2020 16:53:01 +0300 Subject: [PATCH] gosthash2012: Issue EMMS on 32-bit SIMD implementation `_mm_empty' is not needed on x86_64, because we only using SSE2. But, I didn't notice that EXTRACT32 (32-bit version of EXTRACT) is using MMX registers and intrinsics, so complete removing of `_mm_empty' (EMMS) was mistake. Make it presence conditional only for IA-32. Fixes: 211489f ("gosthash2012: Improve SIMD implementation") --- gosthash2012.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gosthash2012.c b/gosthash2012.c index 5a4c64e..c4307e7 100644 --- a/gosthash2012.c +++ b/gosthash2012.c @@ -135,6 +135,11 @@ static void g(union uint512_u *h, const union uint512_u * RESTRICT N, X128R(xmm0, xmm2, xmm4, xmm6, xmm1, xmm3, xmm5, xmm7); STORE(h, xmm0, xmm2, xmm4, xmm6); +# ifndef __x86_64__ + /* Restore the Floating-point status on the CPU */ + /* This is only required on MMX, but EXTRACT32 is using MMX */ + _mm_empty(); +# endif #else union uint512_u Ki, data; unsigned int i; -- 2.39.2