minimap2 0.2.25.0 → 0.2.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,97 @@
|
|
|
1
|
+
/* Copyright (c) 2017-2020 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__NEON_H)
|
|
25
|
+
# define SIMDE__INSIDE_NEON_H
|
|
26
|
+
# if !defined(SIMDE__NEON_H)
|
|
27
|
+
# define SIMDE__NEON_H
|
|
28
|
+
# endif
|
|
29
|
+
# include "../simde-common.h"
|
|
30
|
+
|
|
31
|
+
# if defined(SIMDE_NEON_FORCE_NATIVE)
|
|
32
|
+
# define SIMDE_NEON_NATIVE
|
|
33
|
+
# elif defined(__ARM_NEON) && !defined(SIMDE_NEON_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
|
|
34
|
+
# define SIMDE_NEON_NATIVE
|
|
35
|
+
# endif
|
|
36
|
+
|
|
37
|
+
# if defined(SIMDE_NEON64_FORCE_NATIVE)
|
|
38
|
+
# define SIMDE_NEON64_NATIVE
|
|
39
|
+
# elif defined(SIMDE_ARCH_AARCH64) && !defined(SIMDE_NEON64_NO_NATIVE) && !defined(SIMDE_NO_NATIVE)
|
|
40
|
+
# define SIMDE_NEON64_NATIVE
|
|
41
|
+
# endif
|
|
42
|
+
|
|
43
|
+
# if defined(__MMX__) && !defined(SIMDE_NEON_NO_MMX) && !defined(SIMDE_NO_MMX)
|
|
44
|
+
# define SIMDE_NEON_MMX
|
|
45
|
+
# include <mmintrin.h>
|
|
46
|
+
# endif
|
|
47
|
+
# if defined(__SSE__) && !defined(SIMDE_NEON_NO_SSE) && !defined(SIMDE_NO_SSE)
|
|
48
|
+
# define SIMDE_NEON_SSE
|
|
49
|
+
# include <xmmintrin.h>
|
|
50
|
+
# endif
|
|
51
|
+
# if defined(__SSE2__) && !defined(SIMDE_NEON_NO_SSE2) && !defined(SIMDE_NO_SSE2)
|
|
52
|
+
# define SIMDE_NEON_SSE2
|
|
53
|
+
# include <emmintrin.h>
|
|
54
|
+
# endif
|
|
55
|
+
|
|
56
|
+
# if defined(SIMDE_NEON_NATIVE)
|
|
57
|
+
# include <arm_neon.h>
|
|
58
|
+
# endif
|
|
59
|
+
# include <stdint.h>
|
|
60
|
+
|
|
61
|
+
SIMDE__BEGIN_DECLS
|
|
62
|
+
|
|
63
|
+
#include "neon/int8x8.h"
|
|
64
|
+
#include "neon/int16x4.h"
|
|
65
|
+
#include "neon/int32x2.h"
|
|
66
|
+
#include "neon/int64x1.h"
|
|
67
|
+
#include "neon/uint8x8.h"
|
|
68
|
+
#include "neon/uint16x4.h"
|
|
69
|
+
#include "neon/uint32x2.h"
|
|
70
|
+
#include "neon/uint64x1.h"
|
|
71
|
+
#include "neon/float32x2.h"
|
|
72
|
+
#include "neon/float64x1.h"
|
|
73
|
+
|
|
74
|
+
#include "neon/int8x16.h"
|
|
75
|
+
#include "neon/int16x8.h"
|
|
76
|
+
#include "neon/int32x4.h"
|
|
77
|
+
#include "neon/int64x2.h"
|
|
78
|
+
#include "neon/uint8x16.h"
|
|
79
|
+
#include "neon/uint16x8.h"
|
|
80
|
+
#include "neon/uint32x4.h"
|
|
81
|
+
#include "neon/uint64x2.h"
|
|
82
|
+
#include "neon/float32x4.h"
|
|
83
|
+
#include "neon/float64x2.h"
|
|
84
|
+
|
|
85
|
+
SIMDE__FUNCTION_ATTRIBUTES
|
|
86
|
+
int8_t
|
|
87
|
+
simde_vget_lane_s8(simde_int8x8_t v, const int lane) {
|
|
88
|
+
return v.i8[lane];
|
|
89
|
+
}
|
|
90
|
+
#if defined(SIMDE_NEON_NATIVE)
|
|
91
|
+
# define simde_vget_lane_s8(v, lane) vget_lane_s8(v.n, lane)
|
|
92
|
+
#endif
|
|
93
|
+
|
|
94
|
+
SIMDE__END_DECLS
|
|
95
|
+
|
|
96
|
+
#undef SIMDE__INSIDE_NEON_H
|
|
97
|
+
#endif /* !defined(SIMDE__NEON_H) */
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/* Check (assertions)
|
|
2
|
+
* Portable Snippets - https://gitub.com/nemequ/portable-snippets
|
|
3
|
+
* Created by Evan Nemerson <evan@nemerson.com>
|
|
4
|
+
*
|
|
5
|
+
* To the extent possible under law, the authors have waived all
|
|
6
|
+
* copyright and related or neighboring rights to this code. For
|
|
7
|
+
* details, see the Creative Commons Zero 1.0 Universal license at
|
|
8
|
+
* https://creativecommons.org/publicdomain/zero/1.0/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#if !defined(SIMDE_CHECK_H)
|
|
12
|
+
#define SIMDE_CHECK_H
|
|
13
|
+
|
|
14
|
+
#if !defined(SIMDE_NDEBUG) && !defined(SIMDE_DEBUG)
|
|
15
|
+
# define SIMDE_NDEBUG 1
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#include <stdint.h>
|
|
19
|
+
|
|
20
|
+
#if !defined(_WIN32)
|
|
21
|
+
# define SIMDE_SIZE_MODIFIER "z"
|
|
22
|
+
# define SIMDE_CHAR_MODIFIER "hh"
|
|
23
|
+
# define SIMDE_SHORT_MODIFIER "h"
|
|
24
|
+
#else
|
|
25
|
+
# if defined(_M_X64) || defined(__amd64__)
|
|
26
|
+
# define SIMDE_SIZE_MODIFIER "I64"
|
|
27
|
+
# else
|
|
28
|
+
# define SIMDE_SIZE_MODIFIER ""
|
|
29
|
+
# endif
|
|
30
|
+
# define SIMDE_CHAR_MODIFIER ""
|
|
31
|
+
# define SIMDE_SHORT_MODIFIER ""
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
|
35
|
+
# define SIMDE__PUSH_DISABLE_MSVC_C4127 __pragma(warning(push)) __pragma(warning(disable:4127))
|
|
36
|
+
# define SIMDE__POP_DISABLE_MSVC_C4127 __pragma(warning(pop))
|
|
37
|
+
#else
|
|
38
|
+
# define SIMDE__PUSH_DISABLE_MSVC_C4127
|
|
39
|
+
# define SIMDE__POP_DISABLE_MSVC_C4127
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
#if !defined(simde_errorf)
|
|
43
|
+
# if defined(__has_include)
|
|
44
|
+
# if __has_include(<stdio.h>)
|
|
45
|
+
# include <stdio.h>
|
|
46
|
+
# endif
|
|
47
|
+
# elif defined(SIMDE_STDC_HOSTED)
|
|
48
|
+
# if SIMDE_STDC_HOSTED == 1
|
|
49
|
+
# include <stdio.h>
|
|
50
|
+
# endif
|
|
51
|
+
# elif defined(__STDC_HOSTED__)
|
|
52
|
+
# if __STDC_HOSTETD__ == 1
|
|
53
|
+
# include <stdio.h>
|
|
54
|
+
# endif
|
|
55
|
+
# endif
|
|
56
|
+
|
|
57
|
+
# include "debug-trap.h"
|
|
58
|
+
|
|
59
|
+
# if defined(EOF)
|
|
60
|
+
# define simde_errorf(format, ...) (fprintf(stderr, format, __VA_ARGS__), abort())
|
|
61
|
+
# else
|
|
62
|
+
# define simde_errorf(format, ...) (simde_trap())
|
|
63
|
+
# endif
|
|
64
|
+
#endif
|
|
65
|
+
|
|
66
|
+
#define simde_error(msg) simde_errorf("%s", msg)
|
|
67
|
+
|
|
68
|
+
#if defined(SIMDE_NDEBUG)
|
|
69
|
+
# if defined(SIMDE_CHECK_FAIL_DEFINED)
|
|
70
|
+
# define simde_assert(expr)
|
|
71
|
+
# else
|
|
72
|
+
# if defined(HEDLEY_ASSUME)
|
|
73
|
+
# define simde_assert(expr) HEDLEY_ASSUME(expr)
|
|
74
|
+
# elif HEDLEY_GCC_VERSION_CHECK(4,5,0)
|
|
75
|
+
# define simde_assert(expr) ((void) (!!(expr) ? 1 : (__builtin_unreachable(), 1)))
|
|
76
|
+
# elif HEDLEY_MSVC_VERSION_CHECK(13,10,0)
|
|
77
|
+
# define simde_assert(expr) __assume(expr)
|
|
78
|
+
# else
|
|
79
|
+
# define simde_assert(expr)
|
|
80
|
+
# endif
|
|
81
|
+
# endif
|
|
82
|
+
# define simde_assert_true(expr) simde_assert(expr)
|
|
83
|
+
# define simde_assert_false(expr) simde_assert(!(expr))
|
|
84
|
+
# define simde_assert_type_full(prefix, suffix, T, fmt, a, op, b) simde_assert(((a) op (b)))
|
|
85
|
+
# define simde_assert_double_equal(a, b, precision)
|
|
86
|
+
# define simde_assert_string_equal(a, b)
|
|
87
|
+
# define simde_assert_string_not_equal(a, b)
|
|
88
|
+
# define simde_assert_memory_equal(size, a, b)
|
|
89
|
+
# define simde_assert_memory_not_equal(size, a, b)
|
|
90
|
+
#else
|
|
91
|
+
# define simde_assert(expr) \
|
|
92
|
+
do { \
|
|
93
|
+
if (!HEDLEY_LIKELY(expr)) { \
|
|
94
|
+
simde_error("assertion failed: " #expr "\n"); \
|
|
95
|
+
} \
|
|
96
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
97
|
+
} while (0) \
|
|
98
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
99
|
+
|
|
100
|
+
# define simde_assert_true(expr) \
|
|
101
|
+
do { \
|
|
102
|
+
if (!HEDLEY_LIKELY(expr)) { \
|
|
103
|
+
simde_error("assertion failed: " #expr " is not true\n"); \
|
|
104
|
+
} \
|
|
105
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
106
|
+
} while (0) \
|
|
107
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
108
|
+
|
|
109
|
+
# define simde_assert_false(expr) \
|
|
110
|
+
do { \
|
|
111
|
+
if (!HEDLEY_LIKELY(!(expr))) { \
|
|
112
|
+
simde_error("assertion failed: " #expr " is not false\n"); \
|
|
113
|
+
} \
|
|
114
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
115
|
+
} while (0) \
|
|
116
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
117
|
+
|
|
118
|
+
# define simde_assert_type_full(prefix, suffix, T, fmt, a, op, b) \
|
|
119
|
+
do { \
|
|
120
|
+
T simde_tmp_a_ = (a); \
|
|
121
|
+
T simde_tmp_b_ = (b); \
|
|
122
|
+
if (!(simde_tmp_a_ op simde_tmp_b_)) { \
|
|
123
|
+
simde_errorf("assertion failed: %s %s %s (" prefix "%" fmt suffix " %s " prefix "%" fmt suffix ")\n", \
|
|
124
|
+
#a, #op, #b, simde_tmp_a_, #op, simde_tmp_b_); \
|
|
125
|
+
} \
|
|
126
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
127
|
+
} while (0) \
|
|
128
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
129
|
+
|
|
130
|
+
# define simde_assert_double_equal(a, b, precision) \
|
|
131
|
+
do { \
|
|
132
|
+
const double simde_tmp_a_ = (a); \
|
|
133
|
+
const double simde_tmp_b_ = (b); \
|
|
134
|
+
const double simde_tmp_diff_ = ((simde_tmp_a_ - simde_tmp_b_) < 0) ? \
|
|
135
|
+
-(simde_tmp_a_ - simde_tmp_b_) : \
|
|
136
|
+
(simde_tmp_a_ - simde_tmp_b_); \
|
|
137
|
+
if (HEDLEY_UNLIKELY(simde_tmp_diff_ > 1e-##precision)) { \
|
|
138
|
+
simde_errorf("assertion failed: %s == %s (%0." #precision "g == %0." #precision "g)\n", \
|
|
139
|
+
#a, #b, simde_tmp_a_, simde_tmp_b_); \
|
|
140
|
+
} \
|
|
141
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
142
|
+
} while (0) \
|
|
143
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
144
|
+
|
|
145
|
+
# include <string.h>
|
|
146
|
+
# define simde_assert_string_equal(a, b) \
|
|
147
|
+
do { \
|
|
148
|
+
const char* simde_tmp_a_ = a; \
|
|
149
|
+
const char* simde_tmp_b_ = b; \
|
|
150
|
+
if (HEDLEY_UNLIKELY(strcmp(simde_tmp_a_, simde_tmp_b_) != 0)) { \
|
|
151
|
+
simde_errorf("assertion failed: string %s == %s (\"%s\" == \"%s\")\n", \
|
|
152
|
+
#a, #b, simde_tmp_a_, simde_tmp_b_); \
|
|
153
|
+
} \
|
|
154
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
155
|
+
} while (0) \
|
|
156
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
157
|
+
|
|
158
|
+
# define simde_assert_string_not_equal(a, b) \
|
|
159
|
+
do { \
|
|
160
|
+
const char* simde_tmp_a_ = a; \
|
|
161
|
+
const char* simde_tmp_b_ = b; \
|
|
162
|
+
if (HEDLEY_UNLIKELY(strcmp(simde_tmp_a_, simde_tmp_b_) == 0)) { \
|
|
163
|
+
simde_errorf("assertion failed: string %s != %s (\"%s\" == \"%s\")\n", \
|
|
164
|
+
#a, #b, simde_tmp_a_, simde_tmp_b_); \
|
|
165
|
+
} \
|
|
166
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
167
|
+
} while (0) \
|
|
168
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
169
|
+
|
|
170
|
+
# define simde_assert_memory_equal(size, a, b) \
|
|
171
|
+
do { \
|
|
172
|
+
const unsigned char* simde_tmp_a_ = (const unsigned char*) (a); \
|
|
173
|
+
const unsigned char* simde_tmp_b_ = (const unsigned char*) (b); \
|
|
174
|
+
const size_t simde_tmp_size_ = (size); \
|
|
175
|
+
if (HEDLEY_UNLIKELY(memcmp(simde_tmp_a_, simde_tmp_b_, simde_tmp_size_)) != 0) { \
|
|
176
|
+
size_t simde_tmp_pos_; \
|
|
177
|
+
for (simde_tmp_pos_ = 0 ; simde_tmp_pos_ < simde_tmp_size_ ; simde_tmp_pos_++) { \
|
|
178
|
+
if (simde_tmp_a_[simde_tmp_pos_] != simde_tmp_b_[simde_tmp_pos_]) { \
|
|
179
|
+
simde_errorf("assertion failed: memory %s == %s, at offset %" SIMDE_SIZE_MODIFIER "u\n", \
|
|
180
|
+
#a, #b, simde_tmp_pos_); \
|
|
181
|
+
break; \
|
|
182
|
+
} \
|
|
183
|
+
} \
|
|
184
|
+
} \
|
|
185
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
186
|
+
} while (0) \
|
|
187
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
188
|
+
|
|
189
|
+
# define simde_assert_memory_not_equal(size, a, b) \
|
|
190
|
+
do { \
|
|
191
|
+
const unsigned char* simde_tmp_a_ = (const unsigned char*) (a); \
|
|
192
|
+
const unsigned char* simde_tmp_b_ = (const unsigned char*) (b); \
|
|
193
|
+
const size_t simde_tmp_size_ = (size); \
|
|
194
|
+
if (HEDLEY_UNLIKELY(memcmp(simde_tmp_a_, simde_tmp_b_, simde_tmp_size_)) == 0) { \
|
|
195
|
+
simde_errorf("assertion failed: memory %s != %s (%" SIMDE_SIZE_MODIFIER "u bytes)\n", \
|
|
196
|
+
#a, #b, simde_tmp_size_); \
|
|
197
|
+
} \
|
|
198
|
+
SIMDE__PUSH_DISABLE_MSVC_C4127 \
|
|
199
|
+
} while (0) \
|
|
200
|
+
SIMDE__POP_DISABLE_MSVC_C4127
|
|
201
|
+
#endif
|
|
202
|
+
|
|
203
|
+
#define simde_assert_type(T, fmt, a, op, b) \
|
|
204
|
+
simde_assert_type_full("", "", T, fmt, a, op, b)
|
|
205
|
+
|
|
206
|
+
#define simde_assert_char(a, op, b) \
|
|
207
|
+
simde_assert_type_full("'\\x", "'", char, "02" SIMDE_CHAR_MODIFIER "x", a, op, b)
|
|
208
|
+
#define simde_assert_uchar(a, op, b) \
|
|
209
|
+
simde_assert_type_full("'\\x", "'", unsigned char, "02" SIMDE_CHAR_MODIFIER "x", a, op, b)
|
|
210
|
+
#define simde_assert_short(a, op, b) \
|
|
211
|
+
simde_assert_type(short, SIMDE_SHORT_MODIFIER "d", a, op, b)
|
|
212
|
+
#define simde_assert_ushort(a, op, b) \
|
|
213
|
+
simde_assert_type(unsigned short, SIMDE_SHORT_MODIFIER "u", a, op, b)
|
|
214
|
+
#define simde_assert_int(a, op, b) \
|
|
215
|
+
simde_assert_type(int, "d", a, op, b)
|
|
216
|
+
#define simde_assert_uint(a, op, b) \
|
|
217
|
+
simde_assert_type(unsigned int, "u", a, op, b)
|
|
218
|
+
#define simde_assert_long(a, op, b) \
|
|
219
|
+
simde_assert_type(long int, "ld", a, op, b)
|
|
220
|
+
#define simde_assert_ulong(a, op, b) \
|
|
221
|
+
simde_assert_type(unsigned long int, "lu", a, op, b)
|
|
222
|
+
#define simde_assert_llong(a, op, b) \
|
|
223
|
+
simde_assert_type(long long int, "lld", a, op, b)
|
|
224
|
+
#define simde_assert_ullong(a, op, b) \
|
|
225
|
+
simde_assert_type(unsigned long long int, "llu", a, op, b)
|
|
226
|
+
|
|
227
|
+
#define simde_assert_size(a, op, b) \
|
|
228
|
+
simde_assert_type(size_t, SIMDE_SIZE_MODIFIER "u", a, op, b)
|
|
229
|
+
|
|
230
|
+
#define simde_assert_float(a, op, b) \
|
|
231
|
+
simde_assert_type(float, "f", a, op, b)
|
|
232
|
+
#define simde_assert_double(a, op, b) \
|
|
233
|
+
simde_assert_type(double, "g", a, op, b)
|
|
234
|
+
#define simde_assert_ptr(a, op, b) \
|
|
235
|
+
simde_assert_type(const void*, "p", a, op, b)
|
|
236
|
+
|
|
237
|
+
#define simde_assert_int8(a, op, b) \
|
|
238
|
+
simde_assert_type(int8_t, PRIi8, a, op, b)
|
|
239
|
+
#define simde_assert_uint8(a, op, b) \
|
|
240
|
+
simde_assert_type(uint8_t, PRIu8, a, op, b)
|
|
241
|
+
#define simde_assert_int16(a, op, b) \
|
|
242
|
+
simde_assert_type(int16_t, PRIi16, a, op, b)
|
|
243
|
+
#define simde_assert_uint16(a, op, b) \
|
|
244
|
+
simde_assert_type(uint16_t, PRIu16, a, op, b)
|
|
245
|
+
#define simde_assert_int32(a, op, b) \
|
|
246
|
+
simde_assert_type(int32_t, PRIi32, a, op, b)
|
|
247
|
+
#define simde_assert_uint32(a, op, b) \
|
|
248
|
+
simde_assert_type(uint32_t, PRIu32, a, op, b)
|
|
249
|
+
#define simde_assert_int64(a, op, b) \
|
|
250
|
+
simde_assert_type(int64_t, PRIi64, a, op, b)
|
|
251
|
+
#define simde_assert_uint64(a, op, b) \
|
|
252
|
+
simde_assert_type(uint64_t, PRIu64, a, op, b)
|
|
253
|
+
|
|
254
|
+
#define simde_assert_ptr_equal(a, b) \
|
|
255
|
+
simde_assert_ptr(a, ==, b)
|
|
256
|
+
#define simde_assert_ptr_not_equal(a, b) \
|
|
257
|
+
simde_assert_ptr(a, !=, b)
|
|
258
|
+
#define simde_assert_null(ptr) \
|
|
259
|
+
simde_assert_ptr(ptr, ==, NULL)
|
|
260
|
+
#define simde_assert_not_null(ptr) \
|
|
261
|
+
simde_assert_ptr(ptr, !=, NULL)
|
|
262
|
+
#define simde_assert_ptr_null(ptr) \
|
|
263
|
+
simde_assert_ptr(ptr, ==, NULL)
|
|
264
|
+
#define simde_assert_ptr_not_null(ptr) \
|
|
265
|
+
simde_assert_ptr(ptr, !=, NULL)
|
|
266
|
+
|
|
267
|
+
#endif /* !defined(SIMDE_CHECK_H) */
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/* Debugging assertions and traps
|
|
2
|
+
* Portable Snippets - https://gitub.com/nemequ/portable-snippets
|
|
3
|
+
* Created by Evan Nemerson <evan@nemerson.com>
|
|
4
|
+
*
|
|
5
|
+
* To the extent possible under law, the authors have waived all
|
|
6
|
+
* copyright and related or neighboring rights to this code. For
|
|
7
|
+
* details, see the Creative Commons Zero 1.0 Universal license at
|
|
8
|
+
* https://creativecommons.org/publicdomain/zero/1.0/
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#if !defined(SIMDE_DEBUG_TRAP_H)
|
|
12
|
+
#define SIMDE_DEBUG_TRAP_H
|
|
13
|
+
|
|
14
|
+
#if !defined(SIMDE_NDEBUG) && defined(NDEBUG) && !defined(SIMDE_DEBUG)
|
|
15
|
+
# define SIMDE_NDEBUG 1
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if defined(__has_builtin) && !defined(__ibmxl__)
|
|
19
|
+
# if __has_builtin(__builtin_debugtrap)
|
|
20
|
+
# define simde_trap() __builtin_debugtrap()
|
|
21
|
+
# elif __has_builtin(__debugbreak)
|
|
22
|
+
# define simde_trap() __debugbreak()
|
|
23
|
+
# endif
|
|
24
|
+
#endif
|
|
25
|
+
#if !defined(simde_trap)
|
|
26
|
+
# if defined(_MSC_VER) || defined(__INTEL_COMPILER)
|
|
27
|
+
# define simde_trap() __debugbreak()
|
|
28
|
+
# elif defined(__ARMCC_VERSION)
|
|
29
|
+
# define simde_trap() __breakpoint(42)
|
|
30
|
+
# elif defined(__ibmxl__) || defined(__xlC__)
|
|
31
|
+
# include <builtins.h>
|
|
32
|
+
# define simde_trap() __trap(42)
|
|
33
|
+
# elif defined(__DMC__) && defined(_M_IX86)
|
|
34
|
+
static inline void simde_trap(void) { __asm int 3h; }
|
|
35
|
+
# elif defined(__i386__) || defined(__x86_64__)
|
|
36
|
+
static inline void simde_trap(void) { __asm__ __volatile__("int $03"); }
|
|
37
|
+
# elif defined(__thumb__)
|
|
38
|
+
static inline void simde_trap(void) { __asm__ __volatile__(".inst 0xde01"); }
|
|
39
|
+
# elif defined(__aarch64__)
|
|
40
|
+
static inline void simde_trap(void) { __asm__ __volatile__(".inst 0xd4200000"); }
|
|
41
|
+
# elif defined(__arm__)
|
|
42
|
+
static inline void simde_trap(void) { __asm__ __volatile__(".inst 0xe7f001f0"); }
|
|
43
|
+
# elif defined (__alpha__) && !defined(__osf__)
|
|
44
|
+
static inline void simde_trap(void) { __asm__ __volatile__("bpt"); }
|
|
45
|
+
# elif defined(_54_)
|
|
46
|
+
static inline void simde_trap(void) { __asm__ __volatile__("ESTOP"); }
|
|
47
|
+
# elif defined(_55_)
|
|
48
|
+
static inline void simde_trap(void) { __asm__ __volatile__(";\n .if (.MNEMONIC)\n ESTOP_1\n .else\n ESTOP_1()\n .endif\n NOP"); }
|
|
49
|
+
# elif defined(_64P_)
|
|
50
|
+
static inline void simde_trap(void) { __asm__ __volatile__("SWBP 0"); }
|
|
51
|
+
# elif defined(_6x_)
|
|
52
|
+
static inline void simde_trap(void) { __asm__ __volatile__("NOP\n .word 0x10000000"); }
|
|
53
|
+
# elif defined(__STDC_HOSTED__) && (__STDC_HOSTED__ == 0) && defined(__GNUC__)
|
|
54
|
+
# define simde_trap() __builtin_trap()
|
|
55
|
+
# else
|
|
56
|
+
# include <signal.h>
|
|
57
|
+
# if defined(SIGTRAP)
|
|
58
|
+
# define simde_trap() raise(SIGTRAP)
|
|
59
|
+
# else
|
|
60
|
+
# define simde_trap() raise(SIGABRT)
|
|
61
|
+
# endif
|
|
62
|
+
# endif
|
|
63
|
+
#endif
|
|
64
|
+
|
|
65
|
+
#if defined(HEDLEY_LIKELY)
|
|
66
|
+
# define SIMDE_DBG_LIKELY(expr) HEDLEY_LIKELY(expr)
|
|
67
|
+
#elif defined(__GNUC__) && (__GNUC__ >= 3)
|
|
68
|
+
# define SIMDE_DBG_LIKELY(expr) __builtin_expect(!!(expr), 1)
|
|
69
|
+
#else
|
|
70
|
+
# define SIMDE_DBG_LIKELY(expr) (!!(expr))
|
|
71
|
+
#endif
|
|
72
|
+
|
|
73
|
+
#if !defined(SIMDE_NDEBUG) || (SIMDE_NDEBUG == 0)
|
|
74
|
+
# define simde_dbg_assert(expr) do { \
|
|
75
|
+
if (!SIMDE_DBG_LIKELY(expr)) { \
|
|
76
|
+
simde_trap(); \
|
|
77
|
+
} \
|
|
78
|
+
} while (0)
|
|
79
|
+
#else
|
|
80
|
+
# define simde_dbg_assert(expr)
|
|
81
|
+
#endif
|
|
82
|
+
|
|
83
|
+
#endif /* !defined(SIMDE_DEBUG_TRAP_H) */
|