Skip to content

Commit 9b74a4d

Browse files
committed
CP_ALGO_DISABLE_AVX2 knob
1 parent 07a0710 commit 9b74a4d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cp-algo/util/simd.hpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,16 @@
44
#include <cstdint>
55
#include <cstddef>
66
#include <memory>
7+
#if defined(__x86_64__) && !defined(CP_ALGO_DISABLE_AVX2)
8+
#define CP_ALGO_SIMD_AVX2_TARGET _Pragma("GCC target(\"avx2\")")
9+
#else
10+
#define CP_ALGO_SIMD_AVX2_TARGET
11+
#endif
12+
713
#define CP_ALGO_SIMD_PRAGMA_PUSH \
814
_Pragma("GCC push_options") \
915
_Pragma("GCC optimize(\"O3,unroll-loops\")") \
10-
_Pragma("GCC target(\"avx2\")")
16+
CP_ALGO_SIMD_AVX2_TARGET
1117
CP_ALGO_SIMD_PRAGMA_PUSH
1218
namespace cp_algo {
1319
template<typename T, size_t len>

0 commit comments

Comments
 (0)