Skip to content

Commit

Permalink
gosthash2012: Fix compiling sse41 on Clang
Browse files Browse the repository at this point in the history
Cannot detect presence of __SSE4_1__ anymore, since Clang applies target
only to a function.

Link: https://clang.llvm.org/docs/LanguageExtensions.html#subject-match-rules
Signed-off-by: Vitaly Chikunov <[email protected]>
  • Loading branch information
vt-alt committed Nov 27, 2021
1 parent 564f36a commit 55bb508
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
14 changes: 11 additions & 3 deletions gosthash2012_dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,19 @@
/* Construct SSE4.1 implementation. */
# define g g_sse41
# define __GOST3411_USE_SSE41__
# pragma GCC push_options
# pragma GCC target("sse4")
# if defined(__clang__)
# pragma clang attribute push (__attribute__((target("sse4.1"))), apply_to = function)
# elif defined(__GNUC__)
# pragma GCC push_options
# pragma GCC target("sse4.1")
# endif
# include "gosthash2012_sse41.h"
# include "gosthash2012_g.h"
# pragma GCC pop_options
# if defined(__clang__)
# pragma clang attribute pop
# elif defined(__GNUC__)
# pragma GCC pop_options
# endif
# undef LOAD
# undef UNLOAD
# undef X128R
Expand Down
4 changes: 0 additions & 4 deletions gosthash2012_sse41.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0+
*/

#ifndef __SSE4_1__
#error "GOST R 34.11-2012: SSE4.1 not enabled"
#endif

#include <mmintrin.h>
#include <emmintrin.h>
#include <smmintrin.h>
Expand Down

0 comments on commit 55bb508

Please sign in to comment.