1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#ifndef BMSIMD__H__INCLUDED__
#define BMSIMD__H__INCLUDED__
/*
Copyright(c) 2002-2017 Anatoliy Kuznetsov(anatoliy_kuznetsov at yahoo.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
For more information please visit: http://bitmagic.io
*/
/*! \file bmsimd.h
\brief SIMD target version definitions
*/
#ifdef BMWASMSIMDOPT
#include <wasm_simd128.h>
#define BMSSE42OPT
#endif
#ifdef BMAVX512OPT
# undef BMAVX2OPT
# undef BMSSE42OPT
# undef BMSSE2OPT
# define BMVECTOPT
# include "bmavx512.h"
#endif
#ifdef BMAVX2OPT
# undef BMSSE42OPT
# undef BMSSE2OPT
# define BMVECTOPT
# include "bmavx2.h"
#endif
#ifdef BMSSE42OPT
# define BMVECTOPT
# include "bmsse4.h"
#endif
#ifdef BMSSE2OPT
# undef BM64OPT
# define BMVECTOPT
# include "bmsse2.h"
#endif
namespace bm
{
/**
@brief return SIMD optimization used for building BitMagic
@return SIMD code
@ingroup bmagic
*/
inline int simd_version()
{
#ifdef BMWASMSIMDOPT
return bm::simd_wasm128;
#endif
#ifdef BMAVX512OPT
return bm::simd_avx512;
#endif
#ifdef BMAVX2OPT
return bm::simd_avx2;
#endif
#ifdef BMSSE42OPT
return bm::simd_sse42;
#endif
#ifdef BMSSE2OPT
return bm::simd_sse2;
#else
return bm::simd_none;
#endif
}
} // namespace
#endif