Skip to content

Commit

Permalink
security/nflib: Improve handling of SIMD instructions
Browse files Browse the repository at this point in the history
PR:		272702
  • Loading branch information
Daniel Engberg authored and yurivict committed Aug 7, 2023
1 parent 4091219 commit dbe826b
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion security/nflib/Makefile
Expand Up @@ -2,7 +2,7 @@ PORTNAME= nflib
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.0-23
DISTVERSIONSUFFIX= -g5cf40ed
PORTREVISION= 3
PORTREVISION= 4
CATEGORIES= security math

MAINTAINER= yuri@FreeBSD.org
Expand Down
19 changes: 19 additions & 0 deletions security/nflib/files/patch-include_nfl_arch.hpp
@@ -0,0 +1,19 @@
--- include/nfl/arch.hpp.orig 2023-07-24 21:28:33 UTC
+++ include/nfl/arch.hpp
@@ -3,14 +3,10 @@

#include "nfl/arch/common.hpp"

-#ifdef NFL_OPTIMIZED
-
-#if defined __AVX2__ && defined NTT_AVX2
+#if defined __AVX2__ && defined __SSE4_2__
#define CC_SIMD nfl::simd::avx2
-#elif defined __SSE4_2__ && defined NTT_SSE
+#elif defined __SSE4_2__ && !defined __AVX2__
#define CC_SIMD nfl::simd::sse
-#endif
-
#endif

#ifndef CC_SIMD
23 changes: 23 additions & 0 deletions security/nflib/files/patch-include_nfl_ops.hpp
@@ -0,0 +1,23 @@
--- include/nfl/ops.hpp.orig 2023-07-24 21:30:23 UTC
+++ include/nfl/ops.hpp
@@ -281,18 +281,14 @@ struct _make_op<shoup<type, tag0>, expr<mulmod<type, t

} // nfl

-#ifdef NFL_OPTIMIZED
-
#include "nfl/opt/ops.hpp"

-#if defined __SSE4_2__ && defined NTT_SSE
+#if defined __SSE4_2__ && !defined __AVX2__
#include "nfl/opt/arch/sse.hpp"
#endif

-#if defined __AVX2__ && defined NTT_AVX2
+#if defined __AVX2__ && defined __SSE4_2__
#include "nfl/opt/arch/avx2.hpp"
-#endif
-
#endif

#endif

0 comments on commit dbe826b

Please sign in to comment.