ycpp 0.1.0__cp315-cp315t-win_amd64.whl
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.
- ycpp/__init__.py +110 -0
- ycpp/_array.py +318 -0
- ycpp/_awareness.py +268 -0
- ycpp/_doc.py +718 -0
- ycpp/_event.py +188 -0
- ycpp/_id_map.py +620 -0
- ycpp/_map.py +267 -0
- ycpp/_provider.py +180 -0
- ycpp/_snapshot.py +28 -0
- ycpp/_sticky_index.py +59 -0
- ycpp/_stream.py +91 -0
- ycpp/_sync.py +192 -0
- ycpp/_text.py +239 -0
- ycpp/_transaction.py +287 -0
- ycpp/_typed.py +122 -0
- ycpp/_undo.py +201 -0
- ycpp/_update.py +18 -0
- ycpp/_xml.py +452 -0
- ycpp/_ycpp.cp315t-win_amd64.lib +0 -0
- ycpp/_ycpp.cp315t-win_amd64.pyd +0 -0
- ycpp-0.1.0.data/headers/fast_float/ascii_number.h +766 -0
- ycpp-0.1.0.data/headers/fast_float/bigint.h +638 -0
- ycpp-0.1.0.data/headers/fast_float/constexpr_feature_detect.h +53 -0
- ycpp-0.1.0.data/headers/fast_float/decimal_to_binary.h +212 -0
- ycpp-0.1.0.data/headers/fast_float/digit_comparison.h +455 -0
- ycpp-0.1.0.data/headers/fast_float/fast_float.h +91 -0
- ycpp-0.1.0.data/headers/fast_float/fast_table.h +708 -0
- ycpp-0.1.0.data/headers/fast_float/float_common.h +1432 -0
- ycpp-0.1.0.data/headers/fast_float/parse_number.h +488 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_bit.hpp +230 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_details.hpp +386 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
- ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
- ycpp-0.1.0.data/headers/xsimd/arch/utils/shifts.hpp +82 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx.hpp +2111 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx2.hpp +1591 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512bw.hpp +724 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512cd.hpp +28 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512dq.hpp +270 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512er.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512f.hpp +2919 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512pf.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avxvnni.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common.hpp +26 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common_fwd.hpp +127 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_constants.hpp +393 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_emulated.hpp +787 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma4.hpp +92 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_isa.hpp +146 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon.hpp +3580 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon64.hpp +1614 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_rvv.hpp +1515 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_scalar.hpp +1210 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse2.hpp +2333 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse3.hpp +66 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_1.hpp +510 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_2.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_ssse3.hpp +186 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sve.hpp +1186 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vsx.hpp +916 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vxe.hpp +787 -0
- ycpp-0.1.0.data/headers/xsimd/arch/xsimd_wasm.hpp +1819 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_arch.hpp +242 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_config.hpp +620 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_x86.hpp +1044 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpuid.hpp +144 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_getauxval.hpp +159 -0
- ycpp-0.1.0.data/headers/xsimd/config/xsimd_macros.hpp +76 -0
- ycpp-0.1.0.data/headers/xsimd/math/xsimd_rem_pio2.hpp +707 -0
- ycpp-0.1.0.data/headers/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
- ycpp-0.1.0.data/headers/xsimd/memory/xsimd_alignment.hpp +102 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_all_registers.hpp +57 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_api.hpp +3106 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx2_register.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512er_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512f_register.hpp +77 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx_register.hpp +64 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch.hpp +1665 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_constant.hpp +571 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_fwd.hpp +41 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_common_arch.hpp +49 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_emulated_register.hpp +80 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma4_register.hpp +50 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon64_register.hpp +55 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon_register.hpp +130 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_register.hpp +96 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_rvv_register.hpp +491 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse2_register.hpp +59 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse3_register.hpp +49 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_ssse3_register.hpp +48 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_sve_register.hpp +216 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_traits.hpp +408 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_utils.hpp +462 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_vsx_register.hpp +77 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_vxe_register.hpp +86 -0
- ycpp-0.1.0.data/headers/xsimd/types/xsimd_wasm_register.hpp +59 -0
- ycpp-0.1.0.data/headers/xsimd/utils/bits.hpp +122 -0
- ycpp-0.1.0.data/headers/xsimd/utils/xsimd_type_traits.hpp +145 -0
- ycpp-0.1.0.data/headers/xsimd/xsimd.hpp +43 -0
- ycpp-0.1.0.dist-info/DELVEWHEEL +2 -0
- ycpp-0.1.0.dist-info/METADATA +15 -0
- ycpp-0.1.0.dist-info/RECORD +142 -0
- ycpp-0.1.0.dist-info/WHEEL +4 -0
- ycpp.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- ycpp.libs/msvcp140_1-226498d4bfcb4f07974757b596ebec45.dll +0 -0
|
@@ -0,0 +1,787 @@
|
|
|
1
|
+
/***************************************************************************
|
|
2
|
+
* Copyright (c) Andreas Krebbel *
|
|
3
|
+
* Based on xsimd_vsx.hpp *
|
|
4
|
+
* Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
|
|
5
|
+
* Martin Renou *
|
|
6
|
+
* Copyright (c) QuantStack *
|
|
7
|
+
* Copyright (c) Serge Guelton *
|
|
8
|
+
* *
|
|
9
|
+
* Distributed under the terms of the BSD 3-Clause License. *
|
|
10
|
+
* *
|
|
11
|
+
* The full license is in the file LICENSE, distributed with this software. *
|
|
12
|
+
****************************************************************************/
|
|
13
|
+
|
|
14
|
+
#ifndef XSIMD_VXE_HPP
|
|
15
|
+
#define XSIMD_VXE_HPP
|
|
16
|
+
|
|
17
|
+
#include <type_traits>
|
|
18
|
+
|
|
19
|
+
#include "../types/xsimd_vxe_register.hpp"
|
|
20
|
+
|
|
21
|
+
namespace xsimd
|
|
22
|
+
{
|
|
23
|
+
namespace kernel
|
|
24
|
+
{
|
|
25
|
+
using namespace types;
|
|
26
|
+
using v1ti = __int128 __attribute__((vector_size(16)));
|
|
27
|
+
using v4sf = float __attribute__((vector_size(16)));
|
|
28
|
+
using v2df = double __attribute__((vector_size(16)));
|
|
29
|
+
using uv2di = unsigned long long int __attribute__((vector_size(16)));
|
|
30
|
+
using v2di = long long int __attribute__((vector_size(16)));
|
|
31
|
+
using uv4si = unsigned int __attribute__((vector_size(16)));
|
|
32
|
+
using v4si = int __attribute__((vector_size(16)));
|
|
33
|
+
using uv8hi = unsigned short int __attribute__((vector_size(16)));
|
|
34
|
+
using v8hi = short int __attribute__((vector_size(16)));
|
|
35
|
+
using uv16qi = unsigned char __attribute__((vector_size(16)));
|
|
36
|
+
using v16qi = signed char __attribute__((vector_size(16)));
|
|
37
|
+
|
|
38
|
+
// builtin_t<T> - the scalar type as it would be used for a vector intrinsic
|
|
39
|
+
// VXE vector intrinsics do not support long, unsigned long, and char
|
|
40
|
+
// The builtin<T> definition can be used to map the incoming
|
|
41
|
+
// type to the right one to be used with the intrinsics.
|
|
42
|
+
template <typename T>
|
|
43
|
+
struct builtin_scalar
|
|
44
|
+
{
|
|
45
|
+
using type = T;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
template <>
|
|
49
|
+
struct builtin_scalar<unsigned long>
|
|
50
|
+
{
|
|
51
|
+
using type = unsigned long long;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
template <>
|
|
55
|
+
struct builtin_scalar<long>
|
|
56
|
+
{
|
|
57
|
+
using type = long long;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
template <>
|
|
61
|
+
struct builtin_scalar<char>
|
|
62
|
+
{
|
|
63
|
+
using type = typename std::conditional<std::is_signed<char>::value, signed char, unsigned char>::type;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
template <typename T>
|
|
67
|
+
using builtin_t = typename builtin_scalar<T>::type;
|
|
68
|
+
|
|
69
|
+
// bitwise_cast
|
|
70
|
+
template <class A, class T_in, class T_out>
|
|
71
|
+
XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<vxe>) noexcept
|
|
72
|
+
{
|
|
73
|
+
return (typename batch<T_out, A>::register_type)(self.data);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// batch_bool_cast
|
|
77
|
+
template <class A, class T_out, class T_in>
|
|
78
|
+
XSIMD_INLINE batch_bool<T_out, A> batch_bool_cast(batch_bool<T_in, A> const& self, batch_bool<T_out, A> const&, requires_arch<vxe>) noexcept
|
|
79
|
+
{
|
|
80
|
+
return (typename batch_bool<T_out, A>::register_type)self.data;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// load
|
|
84
|
+
|
|
85
|
+
// load_unaligned
|
|
86
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
87
|
+
XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<vxe>) noexcept
|
|
88
|
+
{
|
|
89
|
+
return (typename batch<T, A>::register_type)vec_xl(0, (builtin_t<T>*)mem);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// load_aligned
|
|
93
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
94
|
+
XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<vxe>) noexcept
|
|
95
|
+
{
|
|
96
|
+
return load_unaligned<A>(mem, kernel::convert<T> {}, vxe {});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// load_complex
|
|
100
|
+
namespace detail
|
|
101
|
+
{
|
|
102
|
+
template <class A>
|
|
103
|
+
XSIMD_INLINE batch<std::complex<float>, A> load_complex(batch<float, A> const& hi, batch<float, A> const& lo, requires_arch<vxe>) noexcept
|
|
104
|
+
{
|
|
105
|
+
// Interleave real and imaginary parts
|
|
106
|
+
// hi = [r0, i0, r1, i1], lo = [r2, i2, r3, i3]
|
|
107
|
+
// We need: real = [r0, r1, r2, r3], imag = [i0, i1, i2, i3]
|
|
108
|
+
using v4sf = float __attribute__((vector_size(16)));
|
|
109
|
+
uv16qi perm_real = (uv16qi) { 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27 };
|
|
110
|
+
uv16qi perm_imag = (uv16qi) { 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 };
|
|
111
|
+
v4sf real = vec_perm((v4sf)hi.data, (v4sf)lo.data, perm_real);
|
|
112
|
+
v4sf imag = vec_perm((v4sf)hi.data, (v4sf)lo.data, perm_imag);
|
|
113
|
+
return { batch<float, A>(real), batch<float, A>(imag) };
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
template <class A>
|
|
117
|
+
XSIMD_INLINE batch<std::complex<double>, A> load_complex(batch<double, A> const& hi, batch<double, A> const& lo, requires_arch<vxe>) noexcept
|
|
118
|
+
{
|
|
119
|
+
// hi = [r0, i0], lo = [r1, i1]
|
|
120
|
+
// We need: real = [r0, r1], imag = [i0, i1]
|
|
121
|
+
using v2df = double __attribute__((vector_size(16)));
|
|
122
|
+
uv16qi perm_real = (uv16qi) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 };
|
|
123
|
+
uv16qi perm_imag = (uv16qi) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 };
|
|
124
|
+
v2df real = vec_perm((v2df)hi.data, (v2df)lo.data, perm_real);
|
|
125
|
+
v2df imag = vec_perm((v2df)hi.data, (v2df)lo.data, perm_imag);
|
|
126
|
+
return { batch<double, A>(real), batch<double, A>(imag) };
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
template <class A>
|
|
130
|
+
XSIMD_INLINE batch<float, A> complex_low(batch<std::complex<float>, A> const& self, requires_arch<vxe>) noexcept
|
|
131
|
+
{
|
|
132
|
+
uv16qi perm = (uv16qi) { 0, 1, 2, 3, 16, 17, 18, 19, 4, 5, 6, 7, 20, 21, 22, 23 };
|
|
133
|
+
return batch<float, A>(vec_perm((v4sf)self.real().data, (v4sf)self.imag().data, perm));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
template <class A>
|
|
137
|
+
XSIMD_INLINE batch<float, A> complex_high(batch<std::complex<float>, A> const& self, requires_arch<vxe>) noexcept
|
|
138
|
+
{
|
|
139
|
+
uv16qi perm = (uv16qi) { 8, 9, 10, 11, 24, 25, 26, 27, 12, 13, 14, 15, 28, 29, 30, 31 };
|
|
140
|
+
return batch<float, A>(vec_perm((v4sf)self.real().data, (v4sf)self.imag().data, perm));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
template <class A>
|
|
144
|
+
XSIMD_INLINE batch<double, A> complex_low(batch<std::complex<double>, A> const& self, requires_arch<vxe>) noexcept
|
|
145
|
+
{
|
|
146
|
+
uv16qi perm = (uv16qi) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 };
|
|
147
|
+
return batch<double, A>(vec_perm((v2df)self.real().data, (v2df)self.imag().data, perm));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
template <class A>
|
|
151
|
+
XSIMD_INLINE batch<double, A> complex_high(batch<std::complex<double>, A> const& self, requires_arch<vxe>) noexcept
|
|
152
|
+
{
|
|
153
|
+
uv16qi perm = (uv16qi) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 };
|
|
154
|
+
return batch<double, A>(vec_perm((v2df)self.real().data, (v2df)self.imag().data, perm));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// store
|
|
159
|
+
template <class A, class T>
|
|
160
|
+
XSIMD_INLINE void store_aligned(T* dst, batch<T, A> const& src, requires_arch<vxe>) noexcept
|
|
161
|
+
{
|
|
162
|
+
vec_xst(src.data, 0, (builtin_t<T>*)dst);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
template <class A, class T>
|
|
166
|
+
XSIMD_INLINE void store_unaligned(T* dst, batch<T, A> const& src, requires_arch<vxe>) noexcept
|
|
167
|
+
{
|
|
168
|
+
store_aligned<A>(dst, src, vxe {});
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// set
|
|
172
|
+
template <class A, class T, class... Values>
|
|
173
|
+
XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<vxe>, Values... values) noexcept
|
|
174
|
+
{
|
|
175
|
+
static_assert(sizeof...(Values) == batch<T, A>::size, "consistent init");
|
|
176
|
+
return typename batch<T, A>::register_type { values... };
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
template <class A, class T, class... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
180
|
+
XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<vxe>, Values... values) noexcept
|
|
181
|
+
{
|
|
182
|
+
static_assert(sizeof...(Values) == batch_bool<T, A>::size, "consistent init");
|
|
183
|
+
return typename batch_bool<T, A>::register_type { static_cast<decltype(std::declval<typename batch_bool<T, A>::register_type>()[0])>(values ? -1LL : 0LL)... };
|
|
184
|
+
}
|
|
185
|
+
// first
|
|
186
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
187
|
+
XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
188
|
+
{
|
|
189
|
+
return self.data[0];
|
|
190
|
+
}
|
|
191
|
+
// insert
|
|
192
|
+
template <class A, class T, size_t I, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
193
|
+
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<vxe>) noexcept
|
|
194
|
+
{
|
|
195
|
+
// vec_insert on float is broken with clang
|
|
196
|
+
batch<T, A> out(self);
|
|
197
|
+
out.data[I] = val;
|
|
198
|
+
return out;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// eq
|
|
202
|
+
template <class A, class T>
|
|
203
|
+
XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
204
|
+
{
|
|
205
|
+
return self.data == other.data;
|
|
206
|
+
}
|
|
207
|
+
template <class A, class T>
|
|
208
|
+
XSIMD_INLINE batch_bool<T, A> eq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
209
|
+
{
|
|
210
|
+
return self.data == other.data;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
template <class A, class T>
|
|
214
|
+
XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
215
|
+
{
|
|
216
|
+
return self.data < other.data;
|
|
217
|
+
}
|
|
218
|
+
template <class A, class T>
|
|
219
|
+
XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
220
|
+
{
|
|
221
|
+
return self.data <= other.data;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// neq
|
|
225
|
+
template <class A, class T>
|
|
226
|
+
XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
227
|
+
{
|
|
228
|
+
return ~(self.data == other.data);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
template <class A, class T>
|
|
232
|
+
XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
233
|
+
{
|
|
234
|
+
return bitwise_xor(self, other);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// sub
|
|
238
|
+
template <class A, class T>
|
|
239
|
+
XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
240
|
+
{
|
|
241
|
+
return self.data - other.data;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// broadcast
|
|
245
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
246
|
+
XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<vxe>) noexcept
|
|
247
|
+
{
|
|
248
|
+
return vec_splats(static_cast<builtin_t<T>>(val));
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// abs
|
|
252
|
+
template <class A, class T, class = typename std::enable_if<std::is_signed<T>::value, void>::type>
|
|
253
|
+
XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
254
|
+
{
|
|
255
|
+
return vec_abs(self.data);
|
|
256
|
+
}
|
|
257
|
+
// bitwise_and
|
|
258
|
+
template <class A, class T>
|
|
259
|
+
XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
260
|
+
{
|
|
261
|
+
return (typename batch<T, A>::register_type)((v4si)self.data & (v4si)other.data);
|
|
262
|
+
}
|
|
263
|
+
template <class A, class T>
|
|
264
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
265
|
+
{
|
|
266
|
+
return self.data & other.data;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// bitwise_or
|
|
270
|
+
template <class A, class T>
|
|
271
|
+
XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
272
|
+
{
|
|
273
|
+
return (typename batch<T, A>::register_type)((v4si)self.data | (v4si)other.data);
|
|
274
|
+
}
|
|
275
|
+
template <class A, class T>
|
|
276
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
277
|
+
{
|
|
278
|
+
return self.data | other.data;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// bitwise_xor
|
|
282
|
+
template <class A, class T>
|
|
283
|
+
XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
284
|
+
{
|
|
285
|
+
return (typename batch<T, A>::register_type)((v4si)self.data ^ (v4si)other.data);
|
|
286
|
+
}
|
|
287
|
+
template <class A, class T>
|
|
288
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
289
|
+
{
|
|
290
|
+
return self.data ^ other.data;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// bitwise_not
|
|
294
|
+
template <class A, class T>
|
|
295
|
+
XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
296
|
+
{
|
|
297
|
+
// ~ operator does not work on floating point vectors
|
|
298
|
+
return (typename batch<T, A>::register_type)(~(v4si)self.data);
|
|
299
|
+
}
|
|
300
|
+
template <class A, class T>
|
|
301
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
|
|
302
|
+
{
|
|
303
|
+
return ~self.data;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// bitwise_andnot
|
|
307
|
+
template <class A, class T>
|
|
308
|
+
XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
309
|
+
{
|
|
310
|
+
return (typename batch<T, A>::register_type)((v4si)self.data & ~(v4si)other.data);
|
|
311
|
+
}
|
|
312
|
+
template <class A, class T>
|
|
313
|
+
XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vxe>) noexcept
|
|
314
|
+
{
|
|
315
|
+
return self.data & ~other.data;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// div
|
|
319
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
320
|
+
XSIMD_INLINE batch<T, A> div(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
321
|
+
{
|
|
322
|
+
return self.data / other.data;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// neg
|
|
326
|
+
template <class A, class T>
|
|
327
|
+
XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
328
|
+
{
|
|
329
|
+
return (typename batch<T, A>::register_type) { 0 } - self.data;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// add
|
|
333
|
+
template <class A, class T>
|
|
334
|
+
XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
335
|
+
{
|
|
336
|
+
return self.data + other.data;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// all
|
|
340
|
+
template <class A, class T>
|
|
341
|
+
XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
|
|
342
|
+
{
|
|
343
|
+
return ((v1ti)self.data)[0] == -1;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// any
|
|
347
|
+
template <class A, class T>
|
|
348
|
+
XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<vxe>) noexcept
|
|
349
|
+
{
|
|
350
|
+
return ((v1ti)self.data)[0] != 0;
|
|
351
|
+
}
|
|
352
|
+
// avgr
|
|
353
|
+
template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
|
|
354
|
+
XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
355
|
+
{
|
|
356
|
+
return vec_avg(self.data, other.data);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
// max
|
|
360
|
+
template <class A, class T>
|
|
361
|
+
XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
362
|
+
{
|
|
363
|
+
return vec_max(self.data, other.data);
|
|
364
|
+
}
|
|
365
|
+
// min
|
|
366
|
+
template <class A, class T>
|
|
367
|
+
XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
368
|
+
{
|
|
369
|
+
return vec_min(self.data, other.data);
|
|
370
|
+
}
|
|
371
|
+
// fma
|
|
372
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
373
|
+
XSIMD_INLINE batch<T, A> fma(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<vxe>) noexcept
|
|
374
|
+
{
|
|
375
|
+
return vec_madd(x.data, y.data, z.data);
|
|
376
|
+
}
|
|
377
|
+
// fms
|
|
378
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
379
|
+
XSIMD_INLINE batch<T, A> fms(batch<T, A> const& x, batch<T, A> const& y, batch<T, A> const& z, requires_arch<vxe>) noexcept
|
|
380
|
+
{
|
|
381
|
+
return vec_msub(x.data, y.data, z.data);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// mul
|
|
385
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
386
|
+
XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
387
|
+
{
|
|
388
|
+
return self.data * other.data;
|
|
389
|
+
}
|
|
390
|
+
// haddp
|
|
391
|
+
template <class A>
|
|
392
|
+
XSIMD_INLINE batch<float, A> haddp(batch<float, A> const* r, requires_arch<vxe>) noexcept
|
|
393
|
+
{
|
|
394
|
+
v4sf lo01, hi01, lo23, hi23, sum01, sum23, sumeven, sumodd;
|
|
395
|
+
lo01 = vec_mergel(r[0].data, r[1].data); // { r[0][2], r[1][2], r[0][3], r[1][3] }
|
|
396
|
+
hi01 = vec_mergeh(r[0].data, r[1].data); // { r[0][0], r[1][0], r[0][1], r[1][1] }
|
|
397
|
+
lo23 = vec_mergel(r[2].data, r[3].data); // { r[2][2], r[2][2], r[3][3], r[3][3] }
|
|
398
|
+
hi23 = vec_mergeh(r[2].data, r[3].data); // { r[2][0], r[2][0], r[3][1], r[3][1] }
|
|
399
|
+
sum01 = lo01 + hi01; // { r[0][0] + r[0][2], r[1][0] + r[1][2], r[0][1] + r[0][3], r[1][1] + r[1][3] }
|
|
400
|
+
sum23 = lo23 + hi23; // { r[2][0] + r[2][2], r[3][0] + r[3][2], r[2][1] + r[2][3], r[3][1] + r[3][3] }
|
|
401
|
+
sumeven = (v4sf)vec_mergeh((v2di)sum01, (v2di)sum23); // { r[0][0] + r[0][2], r[1][0] + r[1][2], r[2][0] + r[2][2], r[3][0] + r[3][2] }
|
|
402
|
+
sumodd = (v4sf)vec_mergel((v2di)sum01, (v2di)sum23); // { r[0][1] + r[0][3], r[1][1] + r[1][3], r[2][1] + r[2][3], r[3][1] + r[3][3] }
|
|
403
|
+
return sumeven + sumodd;
|
|
404
|
+
}
|
|
405
|
+
template <class A>
|
|
406
|
+
XSIMD_INLINE batch<double, A> haddp(batch<double, A> const* row, requires_arch<vxe>) noexcept
|
|
407
|
+
{
|
|
408
|
+
return vec_mergeh(row[0].data, row[1].data) + vec_mergel(row[0].data, row[1].data);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
// reduce_add
|
|
412
|
+
template <class A>
|
|
413
|
+
XSIMD_INLINE float reduce_add(batch<float, A> const& self, requires_arch<vxe>) noexcept
|
|
414
|
+
{
|
|
415
|
+
v4sf shifted_64 = vec_sld(self.data, self.data, 8);
|
|
416
|
+
v4sf added_1 = self.data + shifted_64;
|
|
417
|
+
v4sf shifted_32 = vec_sld(added_1, added_1, 4);
|
|
418
|
+
return (added_1 + shifted_32)[0];
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
template <class A>
|
|
422
|
+
XSIMD_INLINE double reduce_add(batch<double, A> const& self, requires_arch<vxe>) noexcept
|
|
423
|
+
{
|
|
424
|
+
return (self.data + vec_sld(self.data, self.data, 8))[0];
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
template <class A>
|
|
428
|
+
XSIMD_INLINE uint64_t reduce_add(batch<uint64_t, A> const& self, requires_arch<vxe>) noexcept
|
|
429
|
+
{
|
|
430
|
+
uv2di shifted = vec_sld((uv2di)self.data, (uv2di)self.data, 8);
|
|
431
|
+
uv2di sum = (uv2di)self.data + shifted;
|
|
432
|
+
return (uint64_t)sum[0];
|
|
433
|
+
}
|
|
434
|
+
template <class A>
|
|
435
|
+
XSIMD_INLINE int64_t reduce_add(batch<int64_t, A> const& self, requires_arch<vxe>) noexcept
|
|
436
|
+
{
|
|
437
|
+
v2di shifted = vec_sld((v2di)self.data, (v2di)self.data, 8);
|
|
438
|
+
v2di sum = (v2di)self.data + shifted;
|
|
439
|
+
return (int64_t)sum[0];
|
|
440
|
+
}
|
|
441
|
+
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
|
|
442
|
+
XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
443
|
+
{
|
|
444
|
+
XSIMD_IF_CONSTEXPR(sizeof(T) == 4)
|
|
445
|
+
{
|
|
446
|
+
using t = typename batch<T, A>::register_type;
|
|
447
|
+
t shifted_64 = vec_sld(self.data, self.data, 8);
|
|
448
|
+
t added_1 = self.data + shifted_64;
|
|
449
|
+
t shifted_32 = vec_sld(added_1, added_1, 4);
|
|
450
|
+
return (added_1 + shifted_32)[0];
|
|
451
|
+
}
|
|
452
|
+
else XSIMD_IF_CONSTEXPR(sizeof(T) == 2)
|
|
453
|
+
{
|
|
454
|
+
using t = typename batch<T, A>::register_type;
|
|
455
|
+
t shifted_64 = vec_sld(self.data, self.data, 8);
|
|
456
|
+
t added_1 = self.data + shifted_64;
|
|
457
|
+
t shifted_32 = vec_sld(added_1, added_1, 4);
|
|
458
|
+
t added_2 = added_1 + shifted_32;
|
|
459
|
+
t shifted_16 = vec_sld(added_2, added_2, 2);
|
|
460
|
+
return (added_2 + shifted_16)[0];
|
|
461
|
+
}
|
|
462
|
+
else
|
|
463
|
+
{
|
|
464
|
+
using t = typename batch<T, A>::register_type;
|
|
465
|
+
t shifted_64 = vec_sld(self.data, self.data, 8);
|
|
466
|
+
t added_1 = self.data + shifted_64;
|
|
467
|
+
t shifted_32 = vec_sld(added_1, added_1, 4);
|
|
468
|
+
t added_2 = added_1 + shifted_32;
|
|
469
|
+
t shifted_16 = vec_sld(added_2, added_2, 2);
|
|
470
|
+
t added_3 = added_2 + shifted_16;
|
|
471
|
+
t shifted_8 = vec_sld(added_3, added_3, 1);
|
|
472
|
+
return (added_3 + shifted_8)[0];
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
// select
|
|
477
|
+
template <class A, class T>
|
|
478
|
+
XSIMD_INLINE batch<T, A> select(batch_bool<T, A> const& cond, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<vxe>) noexcept
|
|
479
|
+
{
|
|
480
|
+
return vec_sel(false_br.data, true_br.data, cond.data);
|
|
481
|
+
}
|
|
482
|
+
template <class A, class T, bool... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
483
|
+
XSIMD_INLINE batch<T, A> select(batch_bool_constant<T, A, Values...> const&, batch<T, A> const& true_br, batch<T, A> const& false_br, requires_arch<vxe>) noexcept
|
|
484
|
+
{
|
|
485
|
+
return select(batch_bool<T, A> { Values... }, true_br, false_br, vxe {});
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// slide_left
|
|
489
|
+
template <size_t N, class A, class T>
|
|
490
|
+
XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<vxe>) noexcept
|
|
491
|
+
{
|
|
492
|
+
XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
|
|
493
|
+
{
|
|
494
|
+
return batch<T, A>(0);
|
|
495
|
+
}
|
|
496
|
+
else
|
|
497
|
+
{
|
|
498
|
+
auto shift_count = vec_splats((uint8_t)(8 * N));
|
|
499
|
+
return vec_sll(x.data, shift_count);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// slide_right
|
|
504
|
+
template <size_t N, class A, class T>
|
|
505
|
+
XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<vxe>) noexcept
|
|
506
|
+
{
|
|
507
|
+
XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
|
|
508
|
+
{
|
|
509
|
+
return batch<T, A>(0);
|
|
510
|
+
}
|
|
511
|
+
else
|
|
512
|
+
{
|
|
513
|
+
auto shift_count = vec_splats((uint8_t)(8 * N));
|
|
514
|
+
return vec_srl(x.data, shift_count);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
// sqrt
|
|
519
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
520
|
+
XSIMD_INLINE batch<T, A> sqrt(batch<T, A> const& val, requires_arch<vxe>) noexcept
|
|
521
|
+
{
|
|
522
|
+
return vec_sqrt(val.data);
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// rsqrt
|
|
526
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
527
|
+
XSIMD_INLINE batch<T, A> rsqrt(batch<T, A> const& val, requires_arch<vxe>) noexcept
|
|
528
|
+
{
|
|
529
|
+
return batch<T, A>(T(1)) / sqrt(val, vxe {});
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
// shuffle
|
|
533
|
+
template <class A, class ITy, ITy I0, ITy I1, ITy I2, ITy I3>
|
|
534
|
+
XSIMD_INLINE batch<float, A> shuffle(batch<float, A> const& x, batch<float, A> const& y, batch_constant<ITy, A, I0, I1, I2, I3>, requires_arch<vxe>) noexcept
|
|
535
|
+
{
|
|
536
|
+
return vec_perm(x.data, y.data,
|
|
537
|
+
(__vector unsigned char) {
|
|
538
|
+
4 * I0 + 0, 4 * I0 + 1, 4 * I0 + 2, 4 * I0 + 3,
|
|
539
|
+
4 * I1 + 0, 4 * I1 + 1, 4 * I1 + 2, 4 * I1 + 3,
|
|
540
|
+
4 * I2 + 0, 4 * I2 + 1, 4 * I2 + 2, 4 * I2 + 3,
|
|
541
|
+
4 * I3 + 0, 4 * I3 + 1, 4 * I3 + 2, 4 * I3 + 3 });
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
template <class A, class ITy, ITy I0, ITy I1>
|
|
545
|
+
XSIMD_INLINE batch<double, A> shuffle(batch<double, A> const& x, batch<double, A> const& y, batch_constant<ITy, A, I0, I1>, requires_arch<vxe>) noexcept
|
|
546
|
+
{
|
|
547
|
+
return vec_perm(x.data, y.data,
|
|
548
|
+
(__vector unsigned char) {
|
|
549
|
+
8 * I0 + 0,
|
|
550
|
+
8 * I0 + 1,
|
|
551
|
+
8 * I0 + 2,
|
|
552
|
+
8 * I0 + 3,
|
|
553
|
+
8 * I0 + 4,
|
|
554
|
+
8 * I0 + 5,
|
|
555
|
+
8 * I0 + 6,
|
|
556
|
+
8 * I0 + 7,
|
|
557
|
+
8 * I1 + 0,
|
|
558
|
+
8 * I1 + 1,
|
|
559
|
+
8 * I1 + 2,
|
|
560
|
+
8 * I1 + 3,
|
|
561
|
+
8 * I1 + 4,
|
|
562
|
+
8 * I1 + 5,
|
|
563
|
+
8 * I1 + 6,
|
|
564
|
+
8 * I1 + 7,
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
// swizzle
|
|
569
|
+
// 16 x 8bit
|
|
570
|
+
template <class A, uint8_t... Values>
|
|
571
|
+
XSIMD_INLINE batch<uint8_t, A> swizzle(batch<uint8_t, A> const& self, batch_constant<uint8_t, A, Values...>, requires_arch<vxe>) noexcept
|
|
572
|
+
{
|
|
573
|
+
static_assert(sizeof...(Values) == batch<uint8_t, A>::size, "consistent init");
|
|
574
|
+
uv16qi perm = (uv16qi) { Values... };
|
|
575
|
+
return vec_perm(self.data, self.data, perm);
|
|
576
|
+
}
|
|
577
|
+
template <class A, uint8_t... Values>
|
|
578
|
+
XSIMD_INLINE batch<int8_t, A> swizzle(batch<int8_t, A> const& self, batch_constant<uint8_t, A, Values...>, requires_arch<vxe>) noexcept
|
|
579
|
+
{
|
|
580
|
+
static_assert(sizeof...(Values) == batch<int8_t, A>::size, "consistent init");
|
|
581
|
+
uv16qi perm = (uv16qi) { Values... };
|
|
582
|
+
return vec_perm(self.data, self.data, perm);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
// 8 x 16 bit
|
|
586
|
+
template <class A, uint16_t V0, uint16_t V1, uint16_t V2, uint16_t V3, uint16_t V4, uint16_t V5, uint16_t V6, uint16_t V7>
|
|
587
|
+
XSIMD_INLINE batch<uint16_t, A> swizzle(batch<uint16_t, A> const& self, batch_constant<uint16_t, A, V0, V1, V2, V3, V4, V5, V6, V7>, requires_arch<vxe>) noexcept
|
|
588
|
+
{
|
|
589
|
+
uv16qi perm = (uv16qi) {
|
|
590
|
+
2 * V0, 2 * V0 + 1,
|
|
591
|
+
2 * V1, 2 * V1 + 1,
|
|
592
|
+
2 * V2, 2 * V2 + 1,
|
|
593
|
+
2 * V3, 2 * V3 + 1,
|
|
594
|
+
2 * V4, 2 * V4 + 1,
|
|
595
|
+
2 * V5, 2 * V5 + 1,
|
|
596
|
+
2 * V6, 2 * V6 + 1,
|
|
597
|
+
2 * V7, 2 * V7 + 1
|
|
598
|
+
};
|
|
599
|
+
return vec_perm(self.data, self.data, perm);
|
|
600
|
+
}
|
|
601
|
+
template <class A, uint16_t V0, uint16_t V1, uint16_t V2, uint16_t V3, uint16_t V4, uint16_t V5, uint16_t V6, uint16_t V7>
|
|
602
|
+
XSIMD_INLINE batch<int16_t, A> swizzle(batch<int16_t, A> const& self, batch_constant<uint16_t, A, V0, V1, V2, V3, V4, V5, V6, V7>, requires_arch<vxe>) noexcept
|
|
603
|
+
{
|
|
604
|
+
uv16qi perm = (uv16qi) {
|
|
605
|
+
2 * V0, 2 * V0 + 1,
|
|
606
|
+
2 * V1, 2 * V1 + 1,
|
|
607
|
+
2 * V2, 2 * V2 + 1,
|
|
608
|
+
2 * V3, 2 * V3 + 1,
|
|
609
|
+
2 * V4, 2 * V4 + 1,
|
|
610
|
+
2 * V5, 2 * V5 + 1,
|
|
611
|
+
2 * V6, 2 * V6 + 1,
|
|
612
|
+
2 * V7, 2 * V7 + 1
|
|
613
|
+
};
|
|
614
|
+
return vec_perm(self.data, self.data, perm);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// 4 x 32 bit
|
|
618
|
+
template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
|
|
619
|
+
XSIMD_INLINE batch<uint32_t, A> swizzle(batch<uint32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
|
|
620
|
+
{
|
|
621
|
+
uv16qi perm = (uv16qi) {
|
|
622
|
+
4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
|
|
623
|
+
4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
|
|
624
|
+
4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
|
|
625
|
+
4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
|
|
626
|
+
};
|
|
627
|
+
return vec_perm(self.data, self.data, perm);
|
|
628
|
+
}
|
|
629
|
+
template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
|
|
630
|
+
XSIMD_INLINE batch<int32_t, A> swizzle(batch<int32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
|
|
631
|
+
{
|
|
632
|
+
uv16qi perm = (uv16qi) {
|
|
633
|
+
4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
|
|
634
|
+
4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
|
|
635
|
+
4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
|
|
636
|
+
4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
|
|
637
|
+
};
|
|
638
|
+
return vec_perm(self.data, self.data, perm);
|
|
639
|
+
}
|
|
640
|
+
template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
|
|
641
|
+
XSIMD_INLINE batch<float, A> swizzle(batch<float, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vxe>) noexcept
|
|
642
|
+
{
|
|
643
|
+
uv16qi perm = (uv16qi) {
|
|
644
|
+
4 * V0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
|
|
645
|
+
4 * V1, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
|
|
646
|
+
4 * V2, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
|
|
647
|
+
4 * V3, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3
|
|
648
|
+
};
|
|
649
|
+
return vec_perm(self.data, self.data, perm);
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
// 2 x 64 bit
|
|
653
|
+
template <class A, uint64_t V0, uint64_t V1>
|
|
654
|
+
XSIMD_INLINE batch<uint64_t, A> swizzle(batch<uint64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
|
|
655
|
+
{
|
|
656
|
+
using out = typename batch<uint64_t, A>::register_type;
|
|
657
|
+
uv16qi perm = (uv16qi) {
|
|
658
|
+
8 * V0 + 0,
|
|
659
|
+
8 * V0 + 1,
|
|
660
|
+
8 * V0 + 2,
|
|
661
|
+
8 * V0 + 3,
|
|
662
|
+
8 * V0 + 4,
|
|
663
|
+
8 * V0 + 5,
|
|
664
|
+
8 * V0 + 6,
|
|
665
|
+
8 * V0 + 7,
|
|
666
|
+
8 * V1 + 0,
|
|
667
|
+
8 * V1 + 1,
|
|
668
|
+
8 * V1 + 2,
|
|
669
|
+
8 * V1 + 3,
|
|
670
|
+
8 * V1 + 4,
|
|
671
|
+
8 * V1 + 5,
|
|
672
|
+
8 * V1 + 6,
|
|
673
|
+
8 * V1 + 7,
|
|
674
|
+
};
|
|
675
|
+
return (out)vec_perm((uv2di)self.data, (uv2di)self.data, perm);
|
|
676
|
+
}
|
|
677
|
+
template <class A, uint64_t V0, uint64_t V1>
|
|
678
|
+
XSIMD_INLINE batch<int64_t, A> swizzle(batch<int64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
|
|
679
|
+
{
|
|
680
|
+
using out = typename batch<int64_t, A>::register_type;
|
|
681
|
+
uv16qi perm = (uv16qi) {
|
|
682
|
+
8 * V0 + 0,
|
|
683
|
+
8 * V0 + 1,
|
|
684
|
+
8 * V0 + 2,
|
|
685
|
+
8 * V0 + 3,
|
|
686
|
+
8 * V0 + 4,
|
|
687
|
+
8 * V0 + 5,
|
|
688
|
+
8 * V0 + 6,
|
|
689
|
+
8 * V0 + 7,
|
|
690
|
+
8 * V1 + 0,
|
|
691
|
+
8 * V1 + 1,
|
|
692
|
+
8 * V1 + 2,
|
|
693
|
+
8 * V1 + 3,
|
|
694
|
+
8 * V1 + 4,
|
|
695
|
+
8 * V1 + 5,
|
|
696
|
+
8 * V1 + 6,
|
|
697
|
+
8 * V1 + 7,
|
|
698
|
+
};
|
|
699
|
+
return (out)vec_perm((v2di)self.data, (v2di)self.data, perm);
|
|
700
|
+
}
|
|
701
|
+
template <class A, uint64_t V0, uint64_t V1>
|
|
702
|
+
XSIMD_INLINE batch<double, A> swizzle(batch<double, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vxe>) noexcept
|
|
703
|
+
{
|
|
704
|
+
uv16qi perm = (uv16qi) {
|
|
705
|
+
8 * V0 + 0,
|
|
706
|
+
8 * V0 + 1,
|
|
707
|
+
8 * V0 + 2,
|
|
708
|
+
8 * V0 + 3,
|
|
709
|
+
8 * V0 + 4,
|
|
710
|
+
8 * V0 + 5,
|
|
711
|
+
8 * V0 + 6,
|
|
712
|
+
8 * V0 + 7,
|
|
713
|
+
8 * V1 + 0,
|
|
714
|
+
8 * V1 + 1,
|
|
715
|
+
8 * V1 + 2,
|
|
716
|
+
8 * V1 + 3,
|
|
717
|
+
8 * V1 + 4,
|
|
718
|
+
8 * V1 + 5,
|
|
719
|
+
8 * V1 + 6,
|
|
720
|
+
8 * V1 + 7,
|
|
721
|
+
};
|
|
722
|
+
return vec_perm(self.data, self.data, perm);
|
|
723
|
+
}
|
|
724
|
+
// zip_hi
|
|
725
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
726
|
+
XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
727
|
+
{
|
|
728
|
+
return vec_mergel(self.data, other.data);
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
// zip_lo
|
|
732
|
+
template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
|
|
733
|
+
XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vxe>) noexcept
|
|
734
|
+
{
|
|
735
|
+
return vec_mergeh(self.data, other.data);
|
|
736
|
+
}
|
|
737
|
+
// bitwise_rshift
|
|
738
|
+
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
|
|
739
|
+
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<vxe>) noexcept
|
|
740
|
+
{
|
|
741
|
+
return self.data >> other;
|
|
742
|
+
}
|
|
743
|
+
// bitwise_lshift
|
|
744
|
+
template <class A, class T, class = typename std::enable_if<std::is_integral<T>::value, void>::type>
|
|
745
|
+
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<vxe>) noexcept
|
|
746
|
+
{
|
|
747
|
+
return self.data << other;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// isnan
|
|
751
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
752
|
+
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
753
|
+
{
|
|
754
|
+
return ~vec_cmpeq(self.data, self.data);
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
// ceil
|
|
758
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
759
|
+
XSIMD_INLINE batch<T, A> ceil(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
760
|
+
{
|
|
761
|
+
return vec_ceil(self.data);
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// floor
|
|
765
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
766
|
+
XSIMD_INLINE batch<T, A> floor(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
767
|
+
{
|
|
768
|
+
return vec_floor(self.data);
|
|
769
|
+
}
|
|
770
|
+
// round
|
|
771
|
+
// vec_round rounds ties to even instead of zero
|
|
772
|
+
#if defined __has_builtin && __has_builtin(__builtin_s390_vfi)
|
|
773
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
774
|
+
XSIMD_INLINE batch<T, A> round(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
775
|
+
{
|
|
776
|
+
return __builtin_s390_vfi(self.data, 4, 1);
|
|
777
|
+
}
|
|
778
|
+
#endif
|
|
779
|
+
// trunc
|
|
780
|
+
template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
|
|
781
|
+
XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<vxe>) noexcept
|
|
782
|
+
{
|
|
783
|
+
return vec_trunc(self.data);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
#endif
|