NCBI C++ ToolKit
bmsimd.h
Go to the documentation of this file.

Go to the SVN repository for 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 BMNEONOPT
25 #pragma GCC diagnostic push
26 #pragma GCC diagnostic ignored "-Wstrict-aliasing"
27 #include "sse2neon.h"
28 #pragma GCC diagnostic pop
29 #define BMSSE2OPT
30 #endif
31 
32 
33 #ifdef BMWASMSIMDOPT
34 #include <wasm_simd128.h>
35 #define BMSSE42OPT
36 #endif
37 
38 #ifdef BMAVX512OPT
39 # undef BMAVX2OPT
40 # undef BMSSE42OPT
41 # undef BMSSE2OPT
42 # define BMVECTOPT
43 # include "bmavx512.h"
44 #endif
45 
46 
47 #ifdef BMAVX2OPT
48 # undef BMSSE42OPT
49 # undef BMSSE2OPT
50 # define BMVECTOPT
51 # include "bmavx2.h"
52 #endif
53 
54 
55 #ifdef BMSSE42OPT
56 # define BMVECTOPT
57 # include "bmsse4.h"
58 #endif
59 
60 #ifdef BMSSE2OPT
61 # undef BM64OPT
62 # define BMVECTOPT
63 # include "bmsse2.h"
64 #endif
65 
66 namespace bm
67 {
68 
69 /**
70  @brief return SIMD optimization used for building BitMagic
71  @return SIMD code
72 
73  @ingroup bmagic
74 */
75 inline int simd_version()
76 {
77 #if defined(BMWASMSIMDOPT)
78  return bm::simd_wasm128;
79 #elif defined(BMNEONOPT)
80  return bm::simd_neon;
81 #elif defined(BMAVX512OPT)
82  return bm::simd_avx512;
83 #elif defined(BMAVX2OPT)
84  return bm::simd_avx2;
85 #elif defined(BMSSE42OPT)
86  return bm::simd_sse42;
87 #elif defined(BMSSE2OPT)
88  return bm::simd_sse2;
89 #else
90  return bm::simd_none;
91 #endif
92 }
93 
94 
95 } // namespace
96 
97 #endif
Compute functions for SSE2 SIMD instruction set (internal)
Compute functions for SSE4.2 SIMD instruction set (internal)
int simd_version()
return SIMD optimization used for building BitMagic
Definition: bmsimd.h:75
#include<zmmintrin.h>
Definition: bm.h:78
@ simd_sse42
!< Intel SSE2
Definition: bmconst.h:439
@ simd_sse2
!< No SIMD or any other optimization
Definition: bmconst.h:438
@ simd_none
Definition: bmconst.h:437
@ simd_avx512
!< Intel AVX2
Definition: bmconst.h:441
@ simd_neon
! WASM SIMD 128
Definition: bmconst.h:443
@ simd_avx2
!< Intel SSE4.2
Definition: bmconst.h:440
@ simd_wasm128
!< Intel AVX512
Definition: bmconst.h:442
Modified on Sun May 19 04:47:50 2024 by modify_doxy.py rev. 669887