]> www.wagner.pp.ru Git - openssl-gost/engine.git/commitdiff
gosthash2012: Issue EMMS on 32-bit SIMD implementation
authorVitaly Chikunov <vt@altlinux.org>
Thu, 6 Feb 2020 13:53:01 +0000 (16:53 +0300)
committerDmitry Belyavskiy <beldmit@users.noreply.github.com>
Thu, 6 Feb 2020 14:59:56 +0000 (17:59 +0300)
`_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

index 5a4c64e488d0830beefa34c36c7192114d8ba99f..c4307e7213972e99d4f9aaa1991134b639ea19ba 100644 (file)
@@ -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;