minimap2 0.2.25.0 → 0.2.25.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/ext/minimap2/Makefile +6 -2
- data/ext/minimap2/NEWS.md +38 -0
- data/ext/minimap2/README.md +9 -3
- data/ext/minimap2/align.c +5 -3
- data/ext/minimap2/cookbook.md +2 -2
- data/ext/minimap2/format.c +7 -4
- data/ext/minimap2/kalloc.c +20 -1
- data/ext/minimap2/kalloc.h +13 -2
- data/ext/minimap2/ksw2.h +1 -0
- data/ext/minimap2/ksw2_extd2_sse.c +1 -1
- data/ext/minimap2/ksw2_exts2_sse.c +79 -40
- data/ext/minimap2/ksw2_extz2_sse.c +1 -1
- data/ext/minimap2/lchain.c +15 -16
- data/ext/minimap2/lib/simde/CONTRIBUTING.md +114 -0
- data/ext/minimap2/lib/simde/COPYING +20 -0
- data/ext/minimap2/lib/simde/README.md +333 -0
- data/ext/minimap2/lib/simde/amalgamate.py +58 -0
- data/ext/minimap2/lib/simde/meson.build +33 -0
- data/ext/minimap2/lib/simde/netlify.toml +20 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/float32x2.h +140 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/float32x4.h +137 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/float64x1.h +142 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/float64x2.h +145 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int16x4.h +140 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int16x8.h +145 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int32x2.h +140 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int32x4.h +143 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int64x1.h +137 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int64x2.h +141 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int8x16.h +147 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/int8x8.h +141 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint16x4.h +134 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint16x8.h +138 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint32x2.h +134 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint32x4.h +137 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint64x1.h +131 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint64x2.h +135 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint8x16.h +141 -0
- data/ext/minimap2/lib/simde/simde/arm/neon/uint8x8.h +135 -0
- data/ext/minimap2/lib/simde/simde/arm/neon.h +97 -0
- data/ext/minimap2/lib/simde/simde/check.h +267 -0
- data/ext/minimap2/lib/simde/simde/debug-trap.h +83 -0
- data/ext/minimap2/lib/simde/simde/hedley.h +1899 -0
- data/ext/minimap2/lib/simde/simde/simde-arch.h +445 -0
- data/ext/minimap2/lib/simde/simde/simde-common.h +697 -0
- data/ext/minimap2/lib/simde/simde/x86/avx.h +5385 -0
- data/ext/minimap2/lib/simde/simde/x86/avx2.h +2402 -0
- data/ext/minimap2/lib/simde/simde/x86/avx512bw.h +391 -0
- data/ext/minimap2/lib/simde/simde/x86/avx512f.h +3389 -0
- data/ext/minimap2/lib/simde/simde/x86/avx512vl.h +112 -0
- data/ext/minimap2/lib/simde/simde/x86/fma.h +659 -0
- data/ext/minimap2/lib/simde/simde/x86/mmx.h +2210 -0
- data/ext/minimap2/lib/simde/simde/x86/sse.h +3696 -0
- data/ext/minimap2/lib/simde/simde/x86/sse2.h +5991 -0
- data/ext/minimap2/lib/simde/simde/x86/sse3.h +343 -0
- data/ext/minimap2/lib/simde/simde/x86/sse4.1.h +1783 -0
- data/ext/minimap2/lib/simde/simde/x86/sse4.2.h +105 -0
- data/ext/minimap2/lib/simde/simde/x86/ssse3.h +1053 -0
- data/ext/minimap2/lib/simde/simde/x86/svml.h +543 -0
- data/ext/minimap2/lib/simde/test/CMakeLists.txt +166 -0
- data/ext/minimap2/lib/simde/test/arm/meson.build +4 -0
- data/ext/minimap2/lib/simde/test/arm/neon/meson.build +23 -0
- data/ext/minimap2/lib/simde/test/arm/neon/skel.c +871 -0
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon-internal.h +134 -0
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon.c +39 -0
- data/ext/minimap2/lib/simde/test/arm/neon/test-neon.h +10 -0
- data/ext/minimap2/lib/simde/test/arm/neon/vadd.c +1260 -0
- data/ext/minimap2/lib/simde/test/arm/neon/vdup_n.c +873 -0
- data/ext/minimap2/lib/simde/test/arm/neon/vmul.c +1084 -0
- data/ext/minimap2/lib/simde/test/arm/neon/vsub.c +1260 -0
- data/ext/minimap2/lib/simde/test/arm/test-arm-internal.h +18 -0
- data/ext/minimap2/lib/simde/test/arm/test-arm.c +20 -0
- data/ext/minimap2/lib/simde/test/arm/test-arm.h +8 -0
- data/ext/minimap2/lib/simde/test/cmake/AddCompilerFlags.cmake +171 -0
- data/ext/minimap2/lib/simde/test/cmake/ExtraWarningFlags.cmake +68 -0
- data/ext/minimap2/lib/simde/test/meson.build +64 -0
- data/ext/minimap2/lib/simde/test/munit/COPYING +21 -0
- data/ext/minimap2/lib/simde/test/munit/Makefile +55 -0
- data/ext/minimap2/lib/simde/test/munit/README.md +54 -0
- data/ext/minimap2/lib/simde/test/munit/example.c +351 -0
- data/ext/minimap2/lib/simde/test/munit/meson.build +37 -0
- data/ext/minimap2/lib/simde/test/munit/munit.c +2055 -0
- data/ext/minimap2/lib/simde/test/munit/munit.h +535 -0
- data/ext/minimap2/lib/simde/test/run-tests.c +20 -0
- data/ext/minimap2/lib/simde/test/run-tests.h +260 -0
- data/ext/minimap2/lib/simde/test/x86/avx.c +13752 -0
- data/ext/minimap2/lib/simde/test/x86/avx2.c +9977 -0
- data/ext/minimap2/lib/simde/test/x86/avx512bw.c +2664 -0
- data/ext/minimap2/lib/simde/test/x86/avx512f.c +10416 -0
- data/ext/minimap2/lib/simde/test/x86/avx512vl.c +210 -0
- data/ext/minimap2/lib/simde/test/x86/fma.c +2557 -0
- data/ext/minimap2/lib/simde/test/x86/meson.build +33 -0
- data/ext/minimap2/lib/simde/test/x86/mmx.c +2878 -0
- data/ext/minimap2/lib/simde/test/x86/skel.c +2984 -0
- data/ext/minimap2/lib/simde/test/x86/sse.c +5121 -0
- data/ext/minimap2/lib/simde/test/x86/sse2.c +9860 -0
- data/ext/minimap2/lib/simde/test/x86/sse3.c +486 -0
- data/ext/minimap2/lib/simde/test/x86/sse4.1.c +3446 -0
- data/ext/minimap2/lib/simde/test/x86/sse4.2.c +101 -0
- data/ext/minimap2/lib/simde/test/x86/ssse3.c +2084 -0
- data/ext/minimap2/lib/simde/test/x86/svml.c +1545 -0
- data/ext/minimap2/lib/simde/test/x86/test-avx.h +16 -0
- data/ext/minimap2/lib/simde/test/x86/test-avx512.h +25 -0
- data/ext/minimap2/lib/simde/test/x86/test-mmx.h +13 -0
- data/ext/minimap2/lib/simde/test/x86/test-sse.h +13 -0
- data/ext/minimap2/lib/simde/test/x86/test-sse2.h +13 -0
- data/ext/minimap2/lib/simde/test/x86/test-x86-internal.h +196 -0
- data/ext/minimap2/lib/simde/test/x86/test-x86.c +48 -0
- data/ext/minimap2/lib/simde/test/x86/test-x86.h +8 -0
- data/ext/minimap2/main.c +13 -6
- data/ext/minimap2/map.c +0 -5
- data/ext/minimap2/minimap.h +40 -31
- data/ext/minimap2/minimap2.1 +19 -5
- data/ext/minimap2/misc/paftools.js +545 -24
- data/ext/minimap2/options.c +1 -1
- data/ext/minimap2/pyproject.toml +2 -0
- data/ext/minimap2/python/mappy.pyx +3 -1
- data/ext/minimap2/seed.c +1 -1
- data/ext/minimap2/setup.py +32 -22
- data/lib/minimap2/version.rb +1 -1
- metadata +100 -3
@@ -0,0 +1,697 @@
|
|
1
|
+
/* Copyright (c) 2017-2019 Evan Nemerson <evan@nemerson.com>
|
2
|
+
*
|
3
|
+
* Permission is hereby granted, free of charge, to any person
|
4
|
+
* obtaining a copy of this software and associated documentation
|
5
|
+
* files (the "Software"), to deal in the Software without
|
6
|
+
* restriction, including without limitation the rights to use, copy,
|
7
|
+
* modify, merge, publish, distribute, sublicense, and/or sell copies
|
8
|
+
* of the Software, and to permit persons to whom the Software is
|
9
|
+
* furnished to do so, subject to the following conditions:
|
10
|
+
*
|
11
|
+
* The above copyright notice and this permission notice shall be
|
12
|
+
* included in all copies or substantial portions of the Software.
|
13
|
+
*
|
14
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
18
|
+
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
19
|
+
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
* SOFTWARE.
|
22
|
+
*/
|
23
|
+
|
24
|
+
#if !defined(SIMDE_COMMON_H)
|
25
|
+
#define SIMDE_COMMON_H
|
26
|
+
|
27
|
+
#include "hedley.h"
|
28
|
+
|
29
|
+
#define SIMDE_VERSION_MAJOR 0
|
30
|
+
#define SIMDE_VERSION_MINOR 5
|
31
|
+
#define SIMDE_VERSION_MICRO 0
|
32
|
+
#define SIMDE_VERSION HEDLEY_VERSION_ENCODE(SIMDE_VERSION_MAJOR, SIMDE_VERSION_MINOR, SIMDE_VERSION_MICRO)
|
33
|
+
|
34
|
+
#include "simde-arch.h"
|
35
|
+
|
36
|
+
#include <stddef.h>
|
37
|
+
|
38
|
+
#if \
|
39
|
+
HEDLEY_HAS_ATTRIBUTE(aligned) || \
|
40
|
+
HEDLEY_GCC_VERSION_CHECK(2,95,0) || \
|
41
|
+
HEDLEY_CRAY_VERSION_CHECK(8,4,0) || \
|
42
|
+
HEDLEY_IBM_VERSION_CHECK(11,1,0) || \
|
43
|
+
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
44
|
+
HEDLEY_PGI_VERSION_CHECK(19,4,0) || \
|
45
|
+
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
46
|
+
HEDLEY_TINYC_VERSION_CHECK(0,9,24) || \
|
47
|
+
HEDLEY_TI_VERSION_CHECK(8,1,0)
|
48
|
+
# define SIMDE_ALIGN(alignment) __attribute__((aligned(alignment)))
|
49
|
+
#elif defined(_MSC_VER) && !(defined(_M_ARM) && !defined(_M_ARM64))
|
50
|
+
# define SIMDE_ALIGN(alignment) __declspec(align(alignment))
|
51
|
+
#elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
|
52
|
+
# define SIMDE_ALIGN(alignment) _Alignas(alignment)
|
53
|
+
#elif defined(__cplusplus) && (__cplusplus >= 201103L)
|
54
|
+
# define SIMDE_ALIGN(alignment) alignas(alignment)
|
55
|
+
#else
|
56
|
+
# define SIMDE_ALIGN(alignment)
|
57
|
+
#endif
|
58
|
+
|
59
|
+
#if \
|
60
|
+
(defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \
|
61
|
+
HEDLEY_HAS_FEATURE(c11_alignof)
|
62
|
+
# define SIMDE_ALIGN_OF(T) (_Alignof(T))
|
63
|
+
#elif \
|
64
|
+
(defined(__cplusplus) && (__cplusplus >= 201103L)) || \
|
65
|
+
HEDLEY_HAS_FEATURE(cxx_alignof)
|
66
|
+
# define SIMDE_ALIGN_OF(T) (alignof(T))
|
67
|
+
#elif HEDLEY_GCC_VERSION_CHECK(2,95,0) || \
|
68
|
+
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
69
|
+
HEDLEY_IBM_VERSION_CHECK(11,1,0)
|
70
|
+
# define SIMDE_ALIGN_OF(T) (__alignof__(T))
|
71
|
+
#endif
|
72
|
+
|
73
|
+
#if defined(SIMDE_ALIGN_OF)
|
74
|
+
# define SIMDE_ALIGN_AS(N, T) SIMDE_ALIGN(SIMDE_ALIGN_OF(T))
|
75
|
+
#else
|
76
|
+
# define SIMDE_ALIGN_AS(N, T) SIMDE_ALIGN(N)
|
77
|
+
#endif
|
78
|
+
|
79
|
+
#define simde_assert_aligned(alignment, val) \
|
80
|
+
simde_assert_int(HEDLEY_REINTERPRET_CAST(uintptr_t, HEDLEY_REINTERPRET_CAST(const void*, (val))) % (alignment), ==, 0)
|
81
|
+
|
82
|
+
/* TODO: this should really do something like
|
83
|
+
HEDLEY_STATIC_CAST(T, (simde_assert_int(alignment, v), v))
|
84
|
+
but I need to think about how to handle it in all compilers...
|
85
|
+
may end up moving to Hedley, too. */
|
86
|
+
#if HEDLEY_HAS_BUILTIN(__builtin_assume_aligned)
|
87
|
+
# define SIMDE_CAST_ALIGN(alignment, T, v) HEDLEY_REINTERPRET_CAST(T, __builtin_assume_aligned(v, alignment))
|
88
|
+
#elif HEDLEY_HAS_WARNING("-Wcast-align")
|
89
|
+
# define SIMDE_CAST_ALIGN(alignment, T, v) \
|
90
|
+
HEDLEY_DIAGNOSTIC_PUSH \
|
91
|
+
_Pragma("clang diagnostic ignored \"-Wcast-align\"") \
|
92
|
+
HEDLEY_REINTERPRET_CAST(T, (v)) \
|
93
|
+
HEDLEY_DIAGNOSTIC_POP
|
94
|
+
#else
|
95
|
+
# define SIMDE_CAST_ALIGN(alignment, T, v) HEDLEY_REINTERPRET_CAST(T, (v))
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#if \
|
99
|
+
(HEDLEY_HAS_ATTRIBUTE(may_alias) && !defined(HEDLEY_SUNPRO_VERSION)) || \
|
100
|
+
HEDLEY_GCC_VERSION_CHECK(3,3,0) || \
|
101
|
+
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
102
|
+
HEDLEY_IBM_VERSION_CHECK(13,1,0)
|
103
|
+
# define SIMDE_MAY_ALIAS __attribute__((__may_alias__))
|
104
|
+
#else
|
105
|
+
# define SIMDE_MAY_ALIAS
|
106
|
+
#endif
|
107
|
+
|
108
|
+
/* Lots of compilers support GCC-style vector extensions, but many
|
109
|
+
don't support all the features. Define different macros depending
|
110
|
+
on support for
|
111
|
+
|
112
|
+
* SIMDE_VECTOR - Declaring a vector.
|
113
|
+
* SIMDE_VECTOR_OPS - basic operations (binary and unary).
|
114
|
+
* SIMDE_VECTOR_SCALAR - For binary operators, the second argument
|
115
|
+
can be a scalar, in which case the result is as if that scalar
|
116
|
+
had been broadcast to all lanes of a vector.
|
117
|
+
* SIMDE_VECTOR_SUBSCRIPT - Supports array subscript notation for
|
118
|
+
extracting/inserting a single element.=
|
119
|
+
|
120
|
+
SIMDE_VECTOR can be assumed if any others are defined, the
|
121
|
+
others are independent. */
|
122
|
+
#if !defined(SIMDE_NO_VECTOR)
|
123
|
+
# if \
|
124
|
+
HEDLEY_GCC_VERSION_CHECK(4,8,0)
|
125
|
+
# define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
|
126
|
+
# define SIMDE_VECTOR_OPS
|
127
|
+
# define SIMDE_VECTOR_SCALAR
|
128
|
+
# define SIMDE_VECTOR_SUBSCRIPT
|
129
|
+
# elif HEDLEY_INTEL_VERSION_CHECK(16,0,0)
|
130
|
+
# define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
|
131
|
+
# define SIMDE_VECTOR_OPS
|
132
|
+
/* ICC only supports SIMDE_VECTOR_SCALAR for constants */
|
133
|
+
# define SIMDE_VECTOR_SUBSCRIPT
|
134
|
+
# elif \
|
135
|
+
HEDLEY_GCC_VERSION_CHECK(4,1,0) || \
|
136
|
+
HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
137
|
+
# define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
|
138
|
+
# define SIMDE_VECTOR_OPS
|
139
|
+
# elif HEDLEY_SUNPRO_VERSION_CHECK(5,12,0)
|
140
|
+
# define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
|
141
|
+
# elif HEDLEY_HAS_ATTRIBUTE(vector_size)
|
142
|
+
# define SIMDE_VECTOR(size) __attribute__((__vector_size__(size)))
|
143
|
+
# define SIMDE_VECTOR_OPS
|
144
|
+
# define SIMDE_VECTOR_SUBSCRIPT
|
145
|
+
# if HEDLEY_HAS_ATTRIBUTE(diagnose_if) /* clang 4.0 */
|
146
|
+
# define SIMDE_VECTOR_SCALAR
|
147
|
+
# endif
|
148
|
+
# endif
|
149
|
+
|
150
|
+
/* GCC and clang have built-in functions to handle shuffling and
|
151
|
+
converting of vectors, but the implementations are slightly
|
152
|
+
different. This macro is just an abstraction over them. Note that
|
153
|
+
elem_size is in bits but vec_size is in bytes. */
|
154
|
+
# if !defined(SIMDE_NO_SHUFFLE_VECTOR) && defined(SIMDE_VECTOR_SUBSCRIPT)
|
155
|
+
# if HEDLEY_HAS_BUILTIN(__builtin_shufflevector)
|
156
|
+
# define SIMDE__SHUFFLE_VECTOR(elem_size, vec_size, a, b, ...) __builtin_shufflevector(a, b, __VA_ARGS__)
|
157
|
+
# elif HEDLEY_GCC_HAS_BUILTIN(__builtin_shuffle,4,7,0) && !defined(__INTEL_COMPILER)
|
158
|
+
# define SIMDE__SHUFFLE_VECTOR(elem_size, vec_size, a, b, ...) (__extension__ ({ \
|
159
|
+
int##elem_size##_t SIMDE_VECTOR(vec_size) simde_shuffle_ = { __VA_ARGS__ }; \
|
160
|
+
__builtin_shuffle(a, b, simde_shuffle_); \
|
161
|
+
}))
|
162
|
+
# endif
|
163
|
+
# endif
|
164
|
+
|
165
|
+
/* TODO: this actually works on XL C/C++ without SIMDE_VECTOR_SUBSCRIPT
|
166
|
+
but the code needs to be refactored a bit to take advantage. */
|
167
|
+
# if !defined(SIMDE_NO_CONVERT_VECTOR) && defined(SIMDE_VECTOR_SUBSCRIPT)
|
168
|
+
# if HEDLEY_HAS_BUILTIN(__builtin_convertvector) || HEDLEY_GCC_VERSION_CHECK(9,0,0)
|
169
|
+
# if HEDLEY_GCC_VERSION_CHECK(9,0,0) && !HEDLEY_GCC_VERSION_CHECK(9,3,0)
|
170
|
+
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93557 */
|
171
|
+
# define SIMDE__CONVERT_VECTOR(to, from) ((to) = (__extension__({ \
|
172
|
+
__typeof__(from) from_ = (from); \
|
173
|
+
((void) from_); \
|
174
|
+
__builtin_convertvector(from_, __typeof__(to)); \
|
175
|
+
})))
|
176
|
+
# else
|
177
|
+
# define SIMDE__CONVERT_VECTOR(to, from) ((to) = __builtin_convertvector((from), __typeof__(to)))
|
178
|
+
# endif
|
179
|
+
# endif
|
180
|
+
# endif
|
181
|
+
#endif
|
182
|
+
|
183
|
+
/* Since we currently require SUBSCRIPT before using a vector in a
|
184
|
+
union, we define these as dependencies of SUBSCRIPT. They are
|
185
|
+
likely to disappear in the future, once SIMDe learns how to make
|
186
|
+
use of vectors without using the union members. Do not use them
|
187
|
+
in your code unless you're okay with it breaking when SIMDe
|
188
|
+
changes. */
|
189
|
+
#if defined(SIMDE_VECTOR_SUBSCRIPT)
|
190
|
+
# if defined(SIMDE_VECTOR_OPS)
|
191
|
+
# define SIMDE_VECTOR_SUBSCRIPT_OPS
|
192
|
+
# endif
|
193
|
+
# if defined(SIMDE_VECTOR_SCALAR)
|
194
|
+
# define SIMDE_VECTOR_SUBSCRIPT_SCALAR
|
195
|
+
# endif
|
196
|
+
#endif
|
197
|
+
|
198
|
+
#if !defined(SIMDE_ENABLE_OPENMP) && ((defined(_OPENMP) && (_OPENMP >= 201307L)) || (defined(_OPENMP_SIMD) && (_OPENMP_SIMD >= 201307L)))
|
199
|
+
# define SIMDE_ENABLE_OPENMP
|
200
|
+
#endif
|
201
|
+
|
202
|
+
#if !defined(SIMDE_ENABLE_CILKPLUS) && (defined(__cilk) || defined(HEDLEY_INTEL_VERSION))
|
203
|
+
# define SIMDE_ENABLE_CILKPLUS
|
204
|
+
#endif
|
205
|
+
|
206
|
+
#if defined(SIMDE_ENABLE_OPENMP)
|
207
|
+
# define SIMDE__VECTORIZE _Pragma("omp simd")
|
208
|
+
# define SIMDE__VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(omp simd safelen(l))
|
209
|
+
# define SIMDE__VECTORIZE_REDUCTION(r) HEDLEY_PRAGMA(omp simd reduction(r))
|
210
|
+
# define SIMDE__VECTORIZE_ALIGNED(a) HEDLEY_PRAGMA(omp simd aligned(a))
|
211
|
+
#elif defined(SIMDE_ENABLE_CILKPLUS)
|
212
|
+
# define SIMDE__VECTORIZE _Pragma("simd")
|
213
|
+
# define SIMDE__VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(simd vectorlength(l))
|
214
|
+
# define SIMDE__VECTORIZE_REDUCTION(r) HEDLEY_PRAGMA(simd reduction(r))
|
215
|
+
# define SIMDE__VECTORIZE_ALIGNED(a) HEDLEY_PRAGMA(simd aligned(a))
|
216
|
+
#elif defined(__clang__)
|
217
|
+
# define SIMDE__VECTORIZE _Pragma("clang loop vectorize(enable)")
|
218
|
+
# define SIMDE__VECTORIZE_SAFELEN(l) HEDLEY_PRAGMA(clang loop vectorize_width(l))
|
219
|
+
# define SIMDE__VECTORIZE_REDUCTION(r) SIMDE__VECTORIZE
|
220
|
+
# define SIMDE__VECTORIZE_ALIGNED(a)
|
221
|
+
#elif HEDLEY_GCC_VERSION_CHECK(4,9,0)
|
222
|
+
# define SIMDE__VECTORIZE _Pragma("GCC ivdep")
|
223
|
+
# define SIMDE__VECTORIZE_SAFELEN(l) SIMDE__VECTORIZE
|
224
|
+
# define SIMDE__VECTORIZE_REDUCTION(r) SIMDE__VECTORIZE
|
225
|
+
# define SIMDE__VECTORIZE_ALIGNED(a)
|
226
|
+
#elif HEDLEY_CRAY_VERSION_CHECK(5,0,0)
|
227
|
+
# define SIMDE__VECTORIZE _Pragma("_CRI ivdep")
|
228
|
+
# define SIMDE__VECTORIZE_SAFELEN(l) SIMDE__VECTORIZE
|
229
|
+
# define SIMDE__VECTORIZE_REDUCTION(r) SIMDE__VECTORIZE
|
230
|
+
# define SIMDE__VECTORIZE_ALIGNED(a)
|
231
|
+
#else
|
232
|
+
# define SIMDE__VECTORIZE
|
233
|
+
# define SIMDE__VECTORIZE_SAFELEN(l)
|
234
|
+
# define SIMDE__VECTORIZE_REDUCTION(r)
|
235
|
+
# define SIMDE__VECTORIZE_ALIGNED(a)
|
236
|
+
#endif
|
237
|
+
|
238
|
+
#define SIMDE__MASK_NZ(v, mask) (((v) & (mask)) | !((v) & (mask)))
|
239
|
+
|
240
|
+
/* Intended for checking coverage, you should never use this in
|
241
|
+
production. */
|
242
|
+
#if defined(SIMDE_NO_INLINE)
|
243
|
+
# define SIMDE__FUNCTION_ATTRIBUTES HEDLEY_NEVER_INLINE static
|
244
|
+
#else
|
245
|
+
# define SIMDE__FUNCTION_ATTRIBUTES HEDLEY_ALWAYS_INLINE static
|
246
|
+
#endif
|
247
|
+
|
248
|
+
#if \
|
249
|
+
HEDLEY_HAS_ATTRIBUTE(unused) || \
|
250
|
+
HEDLEY_GCC_VERSION_CHECK(2,95,0)
|
251
|
+
# define SIMDE__FUNCTION_POSSIBLY_UNUSED __attribute__((__unused__))
|
252
|
+
#else
|
253
|
+
# define SIMDE__FUNCTION_POSSIBLY_UNUSED
|
254
|
+
#endif
|
255
|
+
|
256
|
+
#if HEDLEY_HAS_WARNING("-Wused-but-marked-unused")
|
257
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED _Pragma("clang diagnostic ignored \"-Wused-but-marked-unused\"")
|
258
|
+
#else
|
259
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED
|
260
|
+
#endif
|
261
|
+
|
262
|
+
#if defined(_MSC_VER)
|
263
|
+
# define SIMDE__BEGIN_DECLS HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(disable:4996 4204)) HEDLEY_BEGIN_C_DECLS
|
264
|
+
# define SIMDE__END_DECLS HEDLEY_DIAGNOSTIC_POP HEDLEY_END_C_DECLS
|
265
|
+
#else
|
266
|
+
# define SIMDE__BEGIN_DECLS \
|
267
|
+
HEDLEY_DIAGNOSTIC_PUSH \
|
268
|
+
SIMDE_DIAGNOSTIC_DISABLE_USED_BUT_MARKED_UNUSED \
|
269
|
+
HEDLEY_BEGIN_C_DECLS
|
270
|
+
# define SIMDE__END_DECLS \
|
271
|
+
HEDLEY_END_C_DECLS \
|
272
|
+
HEDLEY_DIAGNOSTIC_POP
|
273
|
+
#endif
|
274
|
+
|
275
|
+
#if HEDLEY_HAS_WARNING("-Wpedantic")
|
276
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_INT128 _Pragma("clang diagnostic ignored \"-Wpedantic\"")
|
277
|
+
#elif defined(HEDLEY_GCC_VERSION)
|
278
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_INT128 _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
|
279
|
+
#else
|
280
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_INT128
|
281
|
+
#endif
|
282
|
+
|
283
|
+
#if defined(__SIZEOF_INT128__)
|
284
|
+
# define SIMDE__HAVE_INT128
|
285
|
+
HEDLEY_DIAGNOSTIC_PUSH
|
286
|
+
SIMDE_DIAGNOSTIC_DISABLE_INT128
|
287
|
+
typedef __int128 simde_int128;
|
288
|
+
typedef unsigned __int128 simde_uint128;
|
289
|
+
HEDLEY_DIAGNOSTIC_POP
|
290
|
+
#endif
|
291
|
+
|
292
|
+
#if defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__)
|
293
|
+
# if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
294
|
+
# define SIMDE_BYTE_ORDER_LE
|
295
|
+
# else
|
296
|
+
# define SIMDE_BYTE_ORDER_BE
|
297
|
+
# endif
|
298
|
+
#endif
|
299
|
+
|
300
|
+
/* TODO: we should at least make an attempt to detect the correct
|
301
|
+
types for simde_float32/float64 instead of just assuming float and
|
302
|
+
double. */
|
303
|
+
|
304
|
+
#if !defined(SIMDE_FLOAT32_TYPE)
|
305
|
+
# define SIMDE_FLOAT32_TYPE float
|
306
|
+
# define SIMDE_FLOAT32_C(value) value##f
|
307
|
+
#else
|
308
|
+
# define SIMDE_FLOAT32_C(value) ((SIMDE_FLOAT32_TYPE) value)
|
309
|
+
#endif
|
310
|
+
typedef SIMDE_FLOAT32_TYPE simde_float32;
|
311
|
+
HEDLEY_STATIC_ASSERT(sizeof(simde_float32) == 4, "Unable to find 32-bit floating-point type.");
|
312
|
+
|
313
|
+
#if !defined(SIMDE_FLOAT64_TYPE)
|
314
|
+
# define SIMDE_FLOAT64_TYPE double
|
315
|
+
# define SIMDE_FLOAT64_C(value) value
|
316
|
+
#else
|
317
|
+
# define SIMDE_FLOAT32_C(value) ((SIMDE_FLOAT64_TYPE) value)
|
318
|
+
#endif
|
319
|
+
typedef SIMDE_FLOAT64_TYPE simde_float64;
|
320
|
+
HEDLEY_STATIC_ASSERT(sizeof(simde_float64) == 8, "Unable to find 64-bit floating-point type.");
|
321
|
+
|
322
|
+
/* Whether to assume that the compiler can auto-vectorize reasonably
|
323
|
+
well. This will cause SIMDe to attempt to compose vector
|
324
|
+
operations using more simple vector operations instead of minimize
|
325
|
+
serial work.
|
326
|
+
|
327
|
+
As an example, consider the _mm_add_ss(a, b) function from SSE,
|
328
|
+
which returns { a0 + b0, a1, a2, a3 }. This pattern is repeated
|
329
|
+
for other operations (sub, mul, etc.).
|
330
|
+
|
331
|
+
The naïve implementation would result in loading a0 and b0, adding
|
332
|
+
them into a temporary variable, then splicing that value into a new
|
333
|
+
vector with the remaining elements from a.
|
334
|
+
|
335
|
+
On platforms which support vectorization, it's generally faster to
|
336
|
+
simply perform the operation on the entire vector to avoid having
|
337
|
+
to move data between SIMD registers and non-SIMD registers.
|
338
|
+
Basically, instead of the temporary variable being (a0 + b0) it
|
339
|
+
would be a vector of (a + b), which is then combined with a to form
|
340
|
+
the result.
|
341
|
+
|
342
|
+
By default, SIMDe will prefer the pure-vector versions if we detect
|
343
|
+
a vector ISA extension, but this can be overridden by defining
|
344
|
+
SIMDE_NO_ASSUME_VECTORIZATION. You can also define
|
345
|
+
SIMDE_ASSUME_VECTORIZATION if you want to force SIMDe to use the
|
346
|
+
vectorized version. */
|
347
|
+
#if !defined(SIMDE_NO_ASSUME_VECTORIZATION) && !defined(SIMDE_ASSUME_VECTORIZATION)
|
348
|
+
# if defined(__SSE__) || defined(__ARM_NEON) || defined(__mips_msa) || defined(__ALTIVEC__)
|
349
|
+
# define SIMDE_ASSUME_VECTORIZATION
|
350
|
+
# endif
|
351
|
+
#endif
|
352
|
+
|
353
|
+
#if HEDLEY_HAS_WARNING("-Wbad-function-cast")
|
354
|
+
# define SIMDE_CONVERT_FTOI(T,v) \
|
355
|
+
HEDLEY_DIAGNOSTIC_PUSH \
|
356
|
+
_Pragma("clang diagnostic ignored \"-Wbad-function-cast\"") \
|
357
|
+
HEDLEY_STATIC_CAST(T, (v)) \
|
358
|
+
HEDLEY_DIAGNOSTIC_POP
|
359
|
+
#else
|
360
|
+
# define SIMDE_CONVERT_FTOI(T,v) ((T) (v))
|
361
|
+
#endif
|
362
|
+
|
363
|
+
|
364
|
+
#if HEDLEY_HAS_WARNING("-Wfloat-equal")
|
365
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL _Pragma("clang diagnostic ignored \"-Wfloat-equal\"")
|
366
|
+
#elif HEDLEY_GCC_VERSION_CHECK(3,0,0)
|
367
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL _Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
|
368
|
+
#else
|
369
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL
|
370
|
+
#endif
|
371
|
+
|
372
|
+
/* Some algorithms are iterative, and fewer iterations means less
|
373
|
+
accuracy. Lower values here will result in faster, but less
|
374
|
+
accurate, calculations for some functions. */
|
375
|
+
#if !defined(SIMDE_ACCURACY_ITERS)
|
376
|
+
# define SIMDE_ACCURACY_ITERS 2
|
377
|
+
#endif
|
378
|
+
|
379
|
+
#if defined(SIMDE__ASSUME_ALIGNED)
|
380
|
+
# undef SIMDE__ASSUME_ALIGNED
|
381
|
+
#endif
|
382
|
+
#if HEDLEY_INTEL_VERSION_CHECK(9,0,0)
|
383
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align) __assume_aligned(ptr, align)
|
384
|
+
#elif HEDLEY_MSVC_VERSION_CHECK(13,10,0)
|
385
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align) __assume((((char*) ptr) - ((char*) 0)) % (align) == 0)
|
386
|
+
#elif HEDLEY_GCC_HAS_BUILTIN(__builtin_assume_aligned,4,7,0)
|
387
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align) (ptr = (__typeof__(ptr)) __builtin_assume_aligned((ptr), align))
|
388
|
+
#elif HEDLEY_CLANG_HAS_BUILTIN(__builtin_assume)
|
389
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align) __builtin_assume((((char*) ptr) - ((char*) 0)) % (align) == 0)
|
390
|
+
#elif HEDLEY_GCC_HAS_BUILTIN(__builtin_unreachable,4,5,0)
|
391
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align) ((((char*) ptr) - ((char*) 0)) % (align) == 0) ? (1) : (__builtin_unreachable(), 0)
|
392
|
+
#else
|
393
|
+
# define SIMDE__ASSUME_ALIGNED(ptr, align)
|
394
|
+
#endif
|
395
|
+
|
396
|
+
/* This is only to help us implement functions like _mm_undefined_ps. */
|
397
|
+
#if defined(SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_)
|
398
|
+
# undef SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_
|
399
|
+
#endif
|
400
|
+
#if HEDLEY_HAS_WARNING("-Wuninitialized")
|
401
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("clang diagnostic ignored \"-Wuninitialized\"")
|
402
|
+
#elif HEDLEY_GCC_VERSION_CHECK(4,2,0)
|
403
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("GCC diagnostic ignored \"-Wuninitialized\"")
|
404
|
+
#elif HEDLEY_PGI_VERSION_CHECK(19,10,0)
|
405
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 549")
|
406
|
+
#elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)
|
407
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE,unassigned)")
|
408
|
+
#elif HEDLEY_SUNPRO_VERSION_CHECK(5,14,0)
|
409
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,SEC_UNINITIALIZED_MEM_READ,SEC_UNDEFINED_RETURN_VALUE)")
|
410
|
+
#elif HEDLEY_SUNPRO_VERSION_CHECK(5,12,0) && defined(__cplusplus)
|
411
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("error_messages(off,unassigned)")
|
412
|
+
/* #elif \
|
413
|
+
HEDLEY_TI_VERSION_CHECK(16,9,9) || \
|
414
|
+
HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \
|
415
|
+
HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \
|
416
|
+
HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,2)
|
417
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("diag_suppress 551") */
|
418
|
+
#elif HEDLEY_INTEL_VERSION_CHECK(13,0,0)
|
419
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ _Pragma("warning(disable:592)")
|
420
|
+
#elif HEDLEY_MSVC_VERSION_CHECK(19,0,0) && !defined(__MSVC_RUNTIME_CHECKS)
|
421
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_UNINITIALIZED_ __pragma(warning(disable:4700))
|
422
|
+
#endif
|
423
|
+
|
424
|
+
#if HEDLEY_GCC_VERSION_CHECK(8,0,0)
|
425
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_PSABI_ _Pragma("GCC diagnostic ignored \"-Wpsabi\"")
|
426
|
+
#else
|
427
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_PSABI_
|
428
|
+
#endif
|
429
|
+
|
430
|
+
#if HEDLEY_INTEL_VERSION_CHECK(19,0,0)
|
431
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ _Pragma("warning(disable:13200 13203)")
|
432
|
+
#elif defined(HEDLEY_MSVC_VERSION)
|
433
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ __pragma(warning(disable:4799))
|
434
|
+
#else
|
435
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_
|
436
|
+
#endif
|
437
|
+
|
438
|
+
#if HEDLEY_INTEL_VERSION_CHECK(18,0,0)
|
439
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ _Pragma("warning(disable:3948)")
|
440
|
+
#else
|
441
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_
|
442
|
+
#endif
|
443
|
+
|
444
|
+
#if \
|
445
|
+
HEDLEY_HAS_WARNING("-Wtautological-compare") || \
|
446
|
+
HEDLEY_GCC_VERSION_CHECK(7,0,0)
|
447
|
+
# if defined(__cplusplus)
|
448
|
+
# if (__cplusplus >= 201402L)
|
449
|
+
# define SIMDE_TAUTOLOGICAL_COMPARE_(expr) \
|
450
|
+
(([](auto expr_){ \
|
451
|
+
HEDLEY_DIAGNOSTIC_PUSH \
|
452
|
+
_Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \
|
453
|
+
return (expr_); \
|
454
|
+
HEDLEY_DIAGNOSTIC_POP \
|
455
|
+
})(expr))
|
456
|
+
# endif
|
457
|
+
# else
|
458
|
+
# define SIMDE_TAUTOLOGICAL_COMPARE_(expr) \
|
459
|
+
(__extension__ ({ \
|
460
|
+
HEDLEY_DIAGNOSTIC_PUSH \
|
461
|
+
_Pragma("GCC diagnostic ignored \"-Wtautological-compare\"") \
|
462
|
+
(expr); \
|
463
|
+
HEDLEY_DIAGNOSTIC_POP \
|
464
|
+
}))
|
465
|
+
# endif
|
466
|
+
#endif
|
467
|
+
#if !defined(SIMDE_TAUTOLOGICAL_COMPARE_)
|
468
|
+
# define SIMDE_TAUTOLOGICAL_COMPARE_(expr) (expr)
|
469
|
+
#endif
|
470
|
+
|
471
|
+
#if \
|
472
|
+
defined(HEDLEY_MSVC_VERSION)
|
473
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_ __pragma(warning(disable:4204))
|
474
|
+
#else
|
475
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_
|
476
|
+
#endif
|
477
|
+
|
478
|
+
#if \
|
479
|
+
HEDLEY_HAS_WARNING("-Wconditional-uninitialized")
|
480
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ _Pragma("clang diagnostic ignored \"-Wconditional-uninitialized\"")
|
481
|
+
#else
|
482
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_
|
483
|
+
#endif
|
484
|
+
|
485
|
+
#if \
|
486
|
+
HEDLEY_HAS_WARNING("-Wfloat-equal") || \
|
487
|
+
HEDLEY_GCC_VERSION_CHECK(3,0,0)
|
488
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ _Pragma("GCC diagnostic ignored \"-Wfloat-equal\"")
|
489
|
+
#else
|
490
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_
|
491
|
+
#endif
|
492
|
+
|
493
|
+
#if HEDLEY_HAS_WARNING("-Wcast-align")
|
494
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_CAST_ALIGN_ _Pragma("clang diagnostic ignored \"-Wcast-align\"")
|
495
|
+
#else
|
496
|
+
# define SIMDE_DIAGNOSTIC_DISABLE_CAST_ALIGN_
|
497
|
+
#endif
|
498
|
+
|
499
|
+
#define SIMDE_DISABLE_UNWANTED_DIAGNOSTICS \
|
500
|
+
SIMDE_DIAGNOSTIC_DISABLE_PSABI_ \
|
501
|
+
SIMDE_DIAGNOSTIC_DISABLE_NO_EMMS_INSTRUCTION_ \
|
502
|
+
SIMDE_DIAGNOSTIC_DISABLE_SIMD_PRAGMA_DEPRECATED_ \
|
503
|
+
SIMDE_DIAGNOSTIC_DISABLE_CONDITIONAL_UNINITIALIZED_ \
|
504
|
+
SIMDE_DIAGNOSTIC_DISABLE_FLOAT_EQUAL_ \
|
505
|
+
SIMDE_DIAGNOSTIC_DISABLE_NON_CONSTANT_AGGREGATE_INITIALIZER_
|
506
|
+
|
507
|
+
#if defined(__STDC_HOSTED__)
|
508
|
+
# define SIMDE_STDC_HOSTED __STDC_HOSTED__
|
509
|
+
#else
|
510
|
+
# if \
|
511
|
+
defined(HEDLEY_PGI_VERSION_CHECK) || \
|
512
|
+
defined(HEDLEY_MSVC_VERSION_CHECK)
|
513
|
+
# define SIMDE_STDC_HOSTED 1
|
514
|
+
# else
|
515
|
+
# define SIMDE_STDC_HOSTED 0
|
516
|
+
# endif
|
517
|
+
#endif
|
518
|
+
|
519
|
+
/* Try to deal with environments without a standard library. */
|
520
|
+
#if !defined(simde_memcpy) || !defined(simde_memset)
|
521
|
+
#if !defined(SIMDE_NO_STRING_H) && defined(__has_include)
|
522
|
+
#if __has_include(<string.h>)
|
523
|
+
#include <string.h>
|
524
|
+
#if !defined(simde_memcpy)
|
525
|
+
#define simde_memcpy(dest, src, n) memcpy(dest, src, n)
|
526
|
+
#endif
|
527
|
+
#if !defined(simde_memset)
|
528
|
+
#define simde_memset(s, c, n) memset(s, c, n)
|
529
|
+
#endif
|
530
|
+
#else
|
531
|
+
#define SIMDE_NO_STRING_H
|
532
|
+
#endif
|
533
|
+
#endif
|
534
|
+
#endif
|
535
|
+
#if !defined(simde_memcpy) || !defined(simde_memset)
|
536
|
+
#if !defined(SIMDE_NO_STRING_H) && (SIMDE_STDC_HOSTED == 1)
|
537
|
+
#include <string.h>
|
538
|
+
#if !defined(simde_memcpy)
|
539
|
+
#define simde_memcpy(dest, src, n) memcpy(dest, src, n)
|
540
|
+
#endif
|
541
|
+
#if !defined(simde_memset)
|
542
|
+
#define simde_memset(s, c, n) memset(s, c, n)
|
543
|
+
#endif
|
544
|
+
#elif (HEDLEY_HAS_BUILTIN(__builtin_memcpy) && HEDLEY_HAS_BUILTIN(__builtin_memset)) || HEDLEY_GCC_VERSION_CHECK(4,2,0)
|
545
|
+
#if !defined(simde_memcpy)
|
546
|
+
#define simde_memcpy(dest, src, n) __builtin_memcpy(dest, src, n)
|
547
|
+
#endif
|
548
|
+
#if !defined(simde_memset)
|
549
|
+
#define simde_memset(s, c, n) __builtin_memset(s, c, n)
|
550
|
+
#endif
|
551
|
+
#else
|
552
|
+
/* These are meant to be portable, not fast. If you're hitting them you
|
553
|
+
* should think about providing your own (by defining the simde_memcpy
|
554
|
+
* macro prior to including any SIMDe files) or submitting a patch to
|
555
|
+
* SIMDe so we can detect your system-provided memcpy/memset, like by
|
556
|
+
* adding your compiler to the checks for __builtin_memcpy and/or
|
557
|
+
* __builtin_memset. */
|
558
|
+
#if !defined(simde_memcpy)
|
559
|
+
SIMDE__FUNCTION_ATTRIBUTES
|
560
|
+
void
|
561
|
+
simde_memcpy_(void* dest, const void* src, size_t len) {
|
562
|
+
char* dest_ = HEDLEY_STATIC_CAST(char*, dest);
|
563
|
+
char* src_ = HEDLEY_STATIC_CAST(const char*, src);
|
564
|
+
for (size_t i = 0 ; i < len ; i++) {
|
565
|
+
dest_[i] = src_[i];
|
566
|
+
}
|
567
|
+
}
|
568
|
+
#define simde_memcpy(dest, src, n) simde_memcpy_(dest, src, n)
|
569
|
+
#endif
|
570
|
+
|
571
|
+
#if !defined(simde_memset)
|
572
|
+
SIMDE__FUNCTION_ATTRIBUTES
|
573
|
+
void
|
574
|
+
simde_memset_(void* s, int c, size_t len) {
|
575
|
+
char* s_ = HEDLEY_STATIC_CAST(char*, s);
|
576
|
+
char c_ = HEDLEY_STATIC_CAST(char, c);
|
577
|
+
for (size_t i = 0 ; i < len ; i++) {
|
578
|
+
s_[i] = c_[i];
|
579
|
+
}
|
580
|
+
}
|
581
|
+
#define simde_memset(s, c, n) simde_memset_(s, c, n)
|
582
|
+
#endif
|
583
|
+
#endif /* !defined(SIMDE_NO_STRING_H) && (SIMDE_STDC_HOSTED == 1) */
|
584
|
+
#endif /* !defined(simde_memcpy) || !defined(simde_memset) */
|
585
|
+
|
586
|
+
#if !defined(SIMDE_NO_MATH_H)
|
587
|
+
#if defined(HUGE_VAL)
|
588
|
+
/* <math.h> has already been included */
|
589
|
+
#elif defined(__has_include)
|
590
|
+
#if !__has_include(<math.h>)
|
591
|
+
#define SIMDE_NO_MATH_H
|
592
|
+
#endif
|
593
|
+
#elif SIMDE_STDC_HOSTED == 0
|
594
|
+
#define SIMDE_NO_MATH_H
|
595
|
+
#endif
|
596
|
+
#endif
|
597
|
+
|
598
|
+
#if !defined(SIMDE_NO_MATH_H)
|
599
|
+
#define SIMDE_HAVE_MATH_H
|
600
|
+
#include <math.h>
|
601
|
+
#endif
|
602
|
+
|
603
|
+
#if !defined(simde_isnan)
|
604
|
+
#if !defined(SIMDE_NO_MATH_H)
|
605
|
+
#define simde_isnan(v) isnan(v)
|
606
|
+
#elif \
|
607
|
+
HEDLEY_HAS_BUILTIN(__builtin_isnan) || \
|
608
|
+
HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
|
609
|
+
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
610
|
+
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
611
|
+
HEDLEY_IBM_VERSION_CHECK(13,1,0)
|
612
|
+
#define simde_isnan(v) __builtin_isnan(v)
|
613
|
+
#endif
|
614
|
+
#endif
|
615
|
+
|
616
|
+
#if !defined(simde_isnanf)
|
617
|
+
#if !defined(SIMDE_NO_MATH_H)
|
618
|
+
#define simde_isnanf(v) isnan(v)
|
619
|
+
#elif \
|
620
|
+
HEDLEY_HAS_BUILTIN(__builtin_isnanf) || \
|
621
|
+
HEDLEY_GCC_VERSION_CHECK(4,4,0) || \
|
622
|
+
HEDLEY_ARM_VERSION_CHECK(4,1,0) || \
|
623
|
+
HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \
|
624
|
+
HEDLEY_IBM_VERSION_CHECK(13,1,0)
|
625
|
+
#define simde_isnanf(v) __builtin_isnanf(v)
|
626
|
+
#endif
|
627
|
+
#endif
|
628
|
+
|
629
|
+
#if defined(__has_include)
|
630
|
+
# if __has_include(<fenv.h>)
|
631
|
+
# include <fenv.h>
|
632
|
+
# endif
|
633
|
+
# if __has_include(<stdlib.h>)
|
634
|
+
# include <stdlib.h>
|
635
|
+
# endif
|
636
|
+
#elif SIMDE_STDC_HOSTED == 1
|
637
|
+
# include <stdlib.h>
|
638
|
+
# include <fenv.h>
|
639
|
+
#endif
|
640
|
+
|
641
|
+
#if defined(SIMDE_HAVE_FENV_H)
|
642
|
+
# include <fenv.h>
|
643
|
+
#endif
|
644
|
+
#if defined(SIMDE_HAVE_STDLIB_H)
|
645
|
+
# include <stdlib.h>
|
646
|
+
#endif
|
647
|
+
|
648
|
+
#if !defined(SIMDE_HAVE_FENV_H) && defined(FE_DIVBYZERO)
|
649
|
+
# define SIMDE_HAVE_FENV_H
|
650
|
+
#endif
|
651
|
+
#if !defined(SIMDE_HAVE_STDLIB_H) && defined(EXIT_SUCCESS)
|
652
|
+
# define SIMDE_HAVE_STDLIB_H
|
653
|
+
#endif
|
654
|
+
|
655
|
+
#include "check.h"
|
656
|
+
|
657
|
+
/* Sometimes we run into problems with specific versions of compilers
|
658
|
+
which make the native versions unusable for us. Often this is due
|
659
|
+
to missing functions, sometimes buggy implementations, etc. These
|
660
|
+
macros are how we check for specific bugs. As they are fixed we'll
|
661
|
+
start only defining them for problematic compiler versions. */
|
662
|
+
|
663
|
+
#if !defined(SIMDE_IGNORE_COMPILER_BUGS)
|
664
|
+
# if defined(HEDLEY_GCC_VERSION)
|
665
|
+
# if !HEDLEY_GCC_VERSION_CHECK(4,9,0)
|
666
|
+
# define SIMDE_BUG_GCC_REV_208793
|
667
|
+
# endif
|
668
|
+
# if !HEDLEY_GCC_VERSION_CHECK(5,0,0)
|
669
|
+
# define SIMDE_BUG_GCC_BAD_MM_SRA_EPI32 /* TODO: find relevant bug or commit */
|
670
|
+
# endif
|
671
|
+
# if !HEDLEY_GCC_VERSION_CHECK(4,6,0)
|
672
|
+
# define SIMDE_BUG_GCC_BAD_MM_EXTRACT_EPI8 /* TODO: find relevant bug or commit */
|
673
|
+
# endif
|
674
|
+
# if !HEDLEY_GCC_VERSION_CHECK(10,0,0)
|
675
|
+
# define SIMDE_BUG_GCC_REV_274313
|
676
|
+
# endif
|
677
|
+
# if !HEDLEY_GCC_VERSION_CHECK(9,0,0) && defined(SIMDE_ARCH_AARCH64)
|
678
|
+
# define SIMDE_BUG_GCC_ARM_SHIFT_SCALAR
|
679
|
+
# endif
|
680
|
+
# if defined(SIMDE_ARCH_X86) && !defined(SIMDE_ARCH_AMD64)
|
681
|
+
# define SIMDE_BUG_GCC_94482
|
682
|
+
# endif
|
683
|
+
# if defined(SIMDE_ARCH_AARCH64)
|
684
|
+
# define SIMDE_BUG_GCC_94488
|
685
|
+
# endif
|
686
|
+
# elif defined(__clang__)
|
687
|
+
# if defined(SIMDE_ARCH_AARCH64)
|
688
|
+
# define SIMDE_BUG_CLANG_45541
|
689
|
+
# endif
|
690
|
+
# endif
|
691
|
+
# if defined(HEDLEY_EMSCRIPTEN_VERSION)
|
692
|
+
# define SIMDE_BUG_EMSCRIPTEN_MISSING_IMPL /* Placeholder for (as yet) unfiled issues. */
|
693
|
+
# define SIMDE_BUG_EMSCRIPTEN_5242
|
694
|
+
# endif
|
695
|
+
#endif
|
696
|
+
|
697
|
+
#endif /* !defined(SIMDE_COMMON_H) */
|