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