ycpp 0.1.0__cp315-cp315-win_arm64.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.
Files changed (142) hide show
  1. ycpp/__init__.py +110 -0
  2. ycpp/_array.py +318 -0
  3. ycpp/_awareness.py +268 -0
  4. ycpp/_doc.py +718 -0
  5. ycpp/_event.py +188 -0
  6. ycpp/_id_map.py +620 -0
  7. ycpp/_map.py +267 -0
  8. ycpp/_provider.py +180 -0
  9. ycpp/_snapshot.py +28 -0
  10. ycpp/_sticky_index.py +59 -0
  11. ycpp/_stream.py +91 -0
  12. ycpp/_sync.py +192 -0
  13. ycpp/_text.py +239 -0
  14. ycpp/_transaction.py +287 -0
  15. ycpp/_typed.py +122 -0
  16. ycpp/_undo.py +201 -0
  17. ycpp/_update.py +18 -0
  18. ycpp/_xml.py +452 -0
  19. ycpp/_ycpp.cp315-win_arm64.lib +0 -0
  20. ycpp/_ycpp.cp315-win_arm64.pyd +0 -0
  21. ycpp-0.1.0.data/headers/fast_float/ascii_number.h +766 -0
  22. ycpp-0.1.0.data/headers/fast_float/bigint.h +638 -0
  23. ycpp-0.1.0.data/headers/fast_float/constexpr_feature_detect.h +53 -0
  24. ycpp-0.1.0.data/headers/fast_float/decimal_to_binary.h +212 -0
  25. ycpp-0.1.0.data/headers/fast_float/digit_comparison.h +455 -0
  26. ycpp-0.1.0.data/headers/fast_float/fast_float.h +91 -0
  27. ycpp-0.1.0.data/headers/fast_float/fast_table.h +708 -0
  28. ycpp-0.1.0.data/headers/fast_float/float_common.h +1432 -0
  29. ycpp-0.1.0.data/headers/fast_float/parse_number.h +488 -0
  30. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  31. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_bit.hpp +230 -0
  32. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  33. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  34. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  35. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  36. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  37. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  38. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  39. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  40. ycpp-0.1.0.data/headers/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  41. ycpp-0.1.0.data/headers/xsimd/arch/utils/shifts.hpp +82 -0
  42. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx.hpp +2111 -0
  43. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx2.hpp +1591 -0
  44. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  45. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  46. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  47. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512er.hpp +17 -0
  48. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  49. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  50. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  51. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  52. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  53. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  54. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  55. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  56. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common.hpp +26 -0
  57. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  58. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_constants.hpp +393 -0
  59. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_emulated.hpp +787 -0
  60. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  61. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  62. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  63. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_fma4.hpp +92 -0
  64. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  65. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_isa.hpp +146 -0
  66. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon.hpp +3580 -0
  67. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_neon64.hpp +1614 -0
  68. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_rvv.hpp +1515 -0
  69. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_scalar.hpp +1210 -0
  70. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse2.hpp +2333 -0
  71. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse3.hpp +66 -0
  72. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  73. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  74. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_ssse3.hpp +186 -0
  75. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_sve.hpp +1186 -0
  76. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vsx.hpp +916 -0
  77. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_vxe.hpp +787 -0
  78. ycpp-0.1.0.data/headers/xsimd/arch/xsimd_wasm.hpp +1819 -0
  79. ycpp-0.1.0.data/headers/xsimd/config/xsimd_arch.hpp +242 -0
  80. ycpp-0.1.0.data/headers/xsimd/config/xsimd_config.hpp +620 -0
  81. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features.hpp +50 -0
  82. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  83. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  84. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  85. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  86. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpu_features_x86.hpp +1044 -0
  87. ycpp-0.1.0.data/headers/xsimd/config/xsimd_cpuid.hpp +144 -0
  88. ycpp-0.1.0.data/headers/xsimd/config/xsimd_getauxval.hpp +159 -0
  89. ycpp-0.1.0.data/headers/xsimd/config/xsimd_macros.hpp +76 -0
  90. ycpp-0.1.0.data/headers/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  91. ycpp-0.1.0.data/headers/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  92. ycpp-0.1.0.data/headers/xsimd/memory/xsimd_alignment.hpp +102 -0
  93. ycpp-0.1.0.data/headers/xsimd/types/xsimd_all_registers.hpp +57 -0
  94. ycpp-0.1.0.data/headers/xsimd/types/xsimd_api.hpp +3106 -0
  95. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx2_register.hpp +44 -0
  96. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  97. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  98. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  99. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  100. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  101. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  102. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  103. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  104. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  105. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  106. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  107. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avx_register.hpp +64 -0
  108. ycpp-0.1.0.data/headers/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  109. ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch.hpp +1665 -0
  110. ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_constant.hpp +571 -0
  111. ycpp-0.1.0.data/headers/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  112. ycpp-0.1.0.data/headers/xsimd/types/xsimd_common_arch.hpp +49 -0
  113. ycpp-0.1.0.data/headers/xsimd/types/xsimd_emulated_register.hpp +80 -0
  114. ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  115. ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  116. ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  117. ycpp-0.1.0.data/headers/xsimd/types/xsimd_fma4_register.hpp +50 -0
  118. ycpp-0.1.0.data/headers/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  119. ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon64_register.hpp +55 -0
  120. ycpp-0.1.0.data/headers/xsimd/types/xsimd_neon_register.hpp +130 -0
  121. ycpp-0.1.0.data/headers/xsimd/types/xsimd_register.hpp +96 -0
  122. ycpp-0.1.0.data/headers/xsimd/types/xsimd_rvv_register.hpp +491 -0
  123. ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse2_register.hpp +59 -0
  124. ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse3_register.hpp +49 -0
  125. ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  126. ycpp-0.1.0.data/headers/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  127. ycpp-0.1.0.data/headers/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  128. ycpp-0.1.0.data/headers/xsimd/types/xsimd_sve_register.hpp +216 -0
  129. ycpp-0.1.0.data/headers/xsimd/types/xsimd_traits.hpp +408 -0
  130. ycpp-0.1.0.data/headers/xsimd/types/xsimd_utils.hpp +462 -0
  131. ycpp-0.1.0.data/headers/xsimd/types/xsimd_vsx_register.hpp +77 -0
  132. ycpp-0.1.0.data/headers/xsimd/types/xsimd_vxe_register.hpp +86 -0
  133. ycpp-0.1.0.data/headers/xsimd/types/xsimd_wasm_register.hpp +59 -0
  134. ycpp-0.1.0.data/headers/xsimd/utils/bits.hpp +122 -0
  135. ycpp-0.1.0.data/headers/xsimd/utils/xsimd_type_traits.hpp +145 -0
  136. ycpp-0.1.0.data/headers/xsimd/xsimd.hpp +43 -0
  137. ycpp-0.1.0.dist-info/DELVEWHEEL +2 -0
  138. ycpp-0.1.0.dist-info/METADATA +15 -0
  139. ycpp-0.1.0.dist-info/RECORD +142 -0
  140. ycpp-0.1.0.dist-info/WHEEL +4 -0
  141. ycpp.libs/msvcp140-9cb625fcbc2fbbd6fca1aee8b24b0ebe.dll +0 -0
  142. ycpp.libs/msvcp140_1-84ac1bc84e09d193dd6ad98c84c0fd94.dll +0 -0
@@ -0,0 +1,916 @@
1
+ /***************************************************************************
2
+ * Copyright (c) Johan Mabille, Sylvain Corlay, Wolf Vollprecht and *
3
+ * Martin Renou *
4
+ * Copyright (c) QuantStack *
5
+ * Copyright (c) Serge Guelton *
6
+ * *
7
+ * Distributed under the terms of the BSD 3-Clause License. *
8
+ * *
9
+ * The full license is in the file LICENSE, distributed with this software. *
10
+ ****************************************************************************/
11
+
12
+ #ifndef XSIMD_VSX_HPP
13
+ #define XSIMD_VSX_HPP
14
+
15
+ #include <complex>
16
+ #include <type_traits>
17
+
18
+ #include "../types/xsimd_vsx_register.hpp"
19
+ #include "./common/xsimd_common_cast.hpp"
20
+
21
+ #include <endian.h>
22
+
23
+ namespace xsimd
24
+ {
25
+ template <typename T, class A, bool... Values>
26
+ struct batch_bool_constant;
27
+
28
+ template <class T_out, class T_in, class A>
29
+ XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& x) noexcept;
30
+
31
+ template <typename T, class A, T... Values>
32
+ struct batch_constant;
33
+
34
+ namespace kernel
35
+ {
36
+ template <class A, class T>
37
+ XSIMD_INLINE batch<T, A> avg(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
38
+ template <class A, class T>
39
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const&, batch<T, A> const&, requires_arch<common>) noexcept;
40
+
41
+ // abs
42
+ template <class A>
43
+ XSIMD_INLINE batch<float, A> abs(batch<float, A> const& self, requires_arch<vsx>) noexcept
44
+ {
45
+ return vec_abs(self.data);
46
+ }
47
+
48
+ template <class A>
49
+ XSIMD_INLINE batch<double, A> abs(batch<double, A> const& self, requires_arch<vsx>) noexcept
50
+ {
51
+ return vec_abs(self.data);
52
+ }
53
+
54
+ // add
55
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
56
+ XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
57
+ {
58
+ return vec_add(self.data, other.data);
59
+ }
60
+
61
+ // all
62
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
63
+ XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
64
+ {
65
+ return vec_all_ne(self.data, vec_xor(self.data, self.data));
66
+ }
67
+
68
+ // any
69
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
70
+ XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
71
+ {
72
+ return vec_any_ne(self.data, vec_xor(self.data, self.data));
73
+ }
74
+
75
+ // avgr
76
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value && sizeof(T) < 8>>
77
+ XSIMD_INLINE batch<T, A> avgr(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
78
+ {
79
+ return vec_avg(self.data, other.data);
80
+ }
81
+ template <class A>
82
+ XSIMD_INLINE batch<float, A> avgr(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
83
+ {
84
+ return avgr(self, other, common {});
85
+ }
86
+ template <class A>
87
+ XSIMD_INLINE batch<double, A> avgr(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
88
+ {
89
+ return avgr(self, other, common {});
90
+ }
91
+
92
+ // avg
93
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
94
+ XSIMD_INLINE batch<T, A> avg(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
95
+ {
96
+ XSIMD_IF_CONSTEXPR(sizeof(T) < 8)
97
+ {
98
+ constexpr auto nbit = 8 * sizeof(T) - 1;
99
+ auto adj = bitwise_cast<T>(bitwise_cast<as_unsigned_integer_t<T>>((self ^ other) << nbit) >> nbit);
100
+ return avgr(self, other, A {}) - adj;
101
+ }
102
+ else
103
+ {
104
+ return avg(self, other, common {});
105
+ }
106
+ }
107
+ template <class A>
108
+ XSIMD_INLINE batch<float, A> avg(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
109
+ {
110
+ return avg(self, other, common {});
111
+ }
112
+ template <class A>
113
+ XSIMD_INLINE batch<double, A> avg(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
114
+ {
115
+ return avg(self, other, common {});
116
+ }
117
+
118
+ // batch_bool_cast
119
+ template <class A, class T_out, class T_in>
120
+ 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<vsx>) noexcept
121
+ {
122
+ return (typename batch_bool<T_out, A>::register_type)self.data;
123
+ }
124
+
125
+ // bitwise_and
126
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
127
+ XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
128
+ {
129
+ return vec_and(self.data, other.data);
130
+ }
131
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
132
+ XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
133
+ {
134
+ return vec_and(self.data, other.data);
135
+ }
136
+
137
+ // bitwise_andnot
138
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
139
+ XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
140
+ {
141
+ return vec_and(self.data, vec_nor(other.data, other.data));
142
+ }
143
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
144
+ XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
145
+ {
146
+ return self.data & ~other.data;
147
+ }
148
+
149
+ // bitwise_lshift
150
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
151
+ XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<vsx>) noexcept
152
+ {
153
+ using shift_type = as_unsigned_integer_t<T>;
154
+ batch<shift_type, A> shift(static_cast<shift_type>(other));
155
+ return vec_sl(self.data, shift.data);
156
+ }
157
+
158
+ // bitwise_not
159
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
160
+ XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<vsx>) noexcept
161
+ {
162
+ return vec_nor(self.data, self.data);
163
+ }
164
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
165
+ XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<vsx>) noexcept
166
+ {
167
+ return vec_nor(self.data, self.data);
168
+ }
169
+
170
+ // bitwise_or
171
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
172
+ XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
173
+ {
174
+ return vec_or(self.data, other.data);
175
+ }
176
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
177
+ XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
178
+ {
179
+ return vec_or(self.data, other.data);
180
+ }
181
+
182
+ // bitwise_rshift
183
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
184
+ XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<vsx>) noexcept
185
+ {
186
+ using shift_type = as_unsigned_integer_t<T>;
187
+ batch<shift_type, A> shift(static_cast<shift_type>(other));
188
+ XSIMD_IF_CONSTEXPR(std::is_signed<T>::value)
189
+ {
190
+ return vec_sra(self.data, shift.data);
191
+ }
192
+ else
193
+ {
194
+ return vec_sr(self.data, shift.data);
195
+ }
196
+ }
197
+
198
+ // bitwise_xor
199
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
200
+ XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
201
+ {
202
+ return vec_xor(self.data, other.data);
203
+ }
204
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
205
+ XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
206
+ {
207
+ return vec_xor(self.data, other.data);
208
+ }
209
+
210
+ // bitwise_cast
211
+ template <class A, class T_in, class T_out>
212
+ XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<vsx>) noexcept
213
+ {
214
+ return (typename batch<T_out, A>::register_type)(self.data);
215
+ }
216
+
217
+ // broadcast
218
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
219
+ XSIMD_INLINE batch<T, A> broadcast(T val, requires_arch<vsx>) noexcept
220
+ {
221
+ return vec_splats(val);
222
+ }
223
+
224
+ // ceil
225
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
226
+ XSIMD_INLINE batch<T, A> ceil(batch<T, A> const& self, requires_arch<vsx>) noexcept
227
+ {
228
+ return vec_ceil(self.data);
229
+ }
230
+
231
+ // store_complex
232
+ namespace detail
233
+ {
234
+ // complex_low
235
+ template <class A>
236
+ XSIMD_INLINE batch<float, A> complex_low(batch<std::complex<float>, A> const& self, requires_arch<vsx>) noexcept
237
+ {
238
+ return vec_mergeh(self.real().data, self.imag().data);
239
+ }
240
+ template <class A>
241
+ XSIMD_INLINE batch<double, A> complex_low(batch<std::complex<double>, A> const& self, requires_arch<vsx>) noexcept
242
+ {
243
+ return vec_mergeh(self.real().data, self.imag().data);
244
+ }
245
+ // complex_high
246
+ template <class A>
247
+ XSIMD_INLINE batch<float, A> complex_high(batch<std::complex<float>, A> const& self, requires_arch<vsx>) noexcept
248
+ {
249
+ return vec_mergel(self.real().data, self.imag().data);
250
+ }
251
+ template <class A>
252
+ XSIMD_INLINE batch<double, A> complex_high(batch<std::complex<double>, A> const& self, requires_arch<vsx>) noexcept
253
+ {
254
+ return vec_mergel(self.real().data, self.imag().data);
255
+ }
256
+ }
257
+
258
+ // decr_if
259
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
260
+ XSIMD_INLINE batch<T, A> decr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<vsx>) noexcept
261
+ {
262
+ return self + batch<T, A>((typename batch<T, A>::register_type)mask.data);
263
+ }
264
+
265
+ // div
266
+ template <class A>
267
+ XSIMD_INLINE batch<float, A> div(batch<float, A> const& self, batch<float, A> const& other, requires_arch<vsx>) noexcept
268
+ {
269
+ return vec_div(self.data, other.data);
270
+ }
271
+ template <class A>
272
+ XSIMD_INLINE batch<double, A> div(batch<double, A> const& self, batch<double, A> const& other, requires_arch<vsx>) noexcept
273
+ {
274
+ return vec_div(self.data, other.data);
275
+ }
276
+
277
+ // fast_cast
278
+ namespace detail
279
+ {
280
+ template <class A>
281
+ XSIMD_INLINE batch<float, A> fast_cast(batch<int32_t, A> const& self, batch<float, A> const&, requires_arch<vsx>) noexcept
282
+ {
283
+ return vec_ctf(self.data, 0);
284
+ }
285
+ template <class A>
286
+ XSIMD_INLINE batch<float, A> fast_cast(batch<uint32_t, A> const& self, batch<float, A> const&, requires_arch<vsx>) noexcept
287
+ {
288
+ return vec_ctf(self.data, 0);
289
+ }
290
+
291
+ template <class A>
292
+ XSIMD_INLINE batch<int32_t, A> fast_cast(batch<float, A> const& self, batch<int32_t, A> const&, requires_arch<vsx>) noexcept
293
+ {
294
+ return vec_cts(self.data, 0);
295
+ }
296
+
297
+ template <class A>
298
+ XSIMD_INLINE batch<uint32_t, A> fast_cast(batch<float, A> const& self, batch<uint32_t, A> const&, requires_arch<vsx>) noexcept
299
+ {
300
+ return vec_ctu(self.data, 0);
301
+ }
302
+ }
303
+
304
+ // fma
305
+ template <class A>
306
+ XSIMD_INLINE batch<float, A> fma(batch<float, A> const& x, batch<float, A> const& y, batch<float, A> const& z, requires_arch<vsx>) noexcept
307
+ {
308
+ return vec_madd(x.data, y.data, z.data);
309
+ }
310
+
311
+ template <class A>
312
+ XSIMD_INLINE batch<double, A> fma(batch<double, A> const& x, batch<double, A> const& y, batch<double, A> const& z, requires_arch<vsx>) noexcept
313
+ {
314
+ return vec_madd(x.data, y.data, z.data);
315
+ }
316
+
317
+ // fms
318
+ template <class A>
319
+ XSIMD_INLINE batch<float, A> fms(batch<float, A> const& x, batch<float, A> const& y, batch<float, A> const& z, requires_arch<vsx>) noexcept
320
+ {
321
+ return vec_msub(x.data, y.data, z.data);
322
+ }
323
+
324
+ template <class A>
325
+ XSIMD_INLINE batch<double, A> fms(batch<double, A> const& x, batch<double, A> const& y, batch<double, A> const& z, requires_arch<vsx>) noexcept
326
+ {
327
+ return vec_msub(x.data, y.data, z.data);
328
+ }
329
+
330
+ // eq
331
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
332
+ XSIMD_INLINE batch_bool<T, A> eq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
333
+ {
334
+ auto res = vec_cmpeq(self.data, other.data);
335
+ return *reinterpret_cast<typename batch_bool<T, A>::register_type*>(&res);
336
+ }
337
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
338
+ XSIMD_INLINE batch_bool<T, A> eq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
339
+ {
340
+ auto res = vec_cmpeq(self.data, other.data);
341
+ return *reinterpret_cast<typename batch_bool<T, A>::register_type*>(&res);
342
+ }
343
+
344
+ // first
345
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
346
+ XSIMD_INLINE T first(batch<T, A> const& self, requires_arch<vsx>) noexcept
347
+ {
348
+ return vec_extract(self.data, 0);
349
+ }
350
+
351
+ // floor
352
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
353
+ XSIMD_INLINE batch<T, A> floor(batch<T, A> const& self, requires_arch<vsx>) noexcept
354
+ {
355
+ return vec_floor(self.data);
356
+ }
357
+
358
+ // ge
359
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
360
+ XSIMD_INLINE batch_bool<T, A> ge(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
361
+ {
362
+ return vec_cmpge(self.data, other.data);
363
+ }
364
+
365
+ // gt
366
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
367
+ XSIMD_INLINE batch_bool<T, A> gt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
368
+ {
369
+ return vec_cmpgt(self.data, other.data);
370
+ }
371
+
372
+ // haddp
373
+ template <class A>
374
+ XSIMD_INLINE batch<float, A> haddp(batch<float, A> const* row, requires_arch<vsx>) noexcept
375
+ {
376
+ auto tmp0 = vec_mergee(row[0].data, row[1].data); // v00 v10 v02 v12
377
+ auto tmp1 = vec_mergeo(row[0].data, row[1].data); // v01 v11 v03 v13
378
+ auto tmp4 = vec_add(tmp0, tmp1); // (v00 + v01, v10 + v11, v02 + v03, v12 + v13)
379
+
380
+ auto tmp2 = vec_mergee(row[2].data, row[3].data); // v20 v30 v22 v32
381
+ auto tmp3 = vec_mergeo(row[2].data, row[3].data); // v21 v31 v23 v33
382
+ auto tmp5 = vec_add(tmp0, tmp1); // (v20 + v21, v30 + v31, v22 + v23, v32 + v33)
383
+
384
+ auto tmp6 = vec_perm(tmp4, tmp5, (__vector unsigned char) { 0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23 }); // (v00 + v01, v10 + v11, v20 + v21, v30 + v31
385
+ auto tmp7 = vec_perm(tmp4, tmp5, (__vector unsigned char) { 8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31 }); // (v02 + v03, v12 + v13, v12 + v13, v32 + v33)
386
+
387
+ return vec_add(tmp6, tmp7);
388
+ }
389
+
390
+ template <class A>
391
+ XSIMD_INLINE batch<double, A> haddp(batch<double, A> const* row, requires_arch<vsx>) noexcept
392
+ {
393
+ auto tmp0 = vec_mergee(row[0].data, row[1].data); // v00 v10 v02 v12
394
+ auto tmp1 = vec_mergeo(row[0].data, row[1].data); // v01 v11 v03 v13
395
+ return vec_add(tmp0, tmp1);
396
+ }
397
+
398
+ // incr_if
399
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value>>
400
+ XSIMD_INLINE batch<T, A> incr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<vsx>) noexcept
401
+ {
402
+ return self - batch<T, A>((typename batch<T, A>::register_type)mask.data);
403
+ }
404
+
405
+ // insert
406
+ template <class A, class T, size_t I, class = std::enable_if_t<std::is_scalar<T>::value>>
407
+ XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<vsx>) noexcept
408
+ {
409
+ return vec_insert(val, self.data, I);
410
+ }
411
+
412
+ // isnan
413
+ template <class A>
414
+ XSIMD_INLINE batch_bool<float, A> isnan(batch<float, A> const& self, requires_arch<vsx>) noexcept
415
+ {
416
+ return ~vec_cmpeq(self.data, self.data);
417
+ }
418
+ template <class A>
419
+ XSIMD_INLINE batch_bool<double, A> isnan(batch<double, A> const& self, requires_arch<vsx>) noexcept
420
+ {
421
+ return ~vec_cmpeq(self.data, self.data);
422
+ }
423
+
424
+ // load_aligned
425
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
426
+ XSIMD_INLINE batch<T, A> load_aligned(T const* mem, convert<T>, requires_arch<vsx>) noexcept
427
+ {
428
+ return vec_ld(0, reinterpret_cast<const typename batch<T, A>::register_type*>(mem));
429
+ }
430
+
431
+ // load_unaligned
432
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
433
+ XSIMD_INLINE batch<T, A> load_unaligned(T const* mem, convert<T>, requires_arch<vsx>) noexcept
434
+ {
435
+ return vec_vsx_ld(0, (typename batch<T, A>::register_type const*)mem);
436
+ }
437
+
438
+ // load_complex
439
+ namespace detail
440
+ {
441
+ template <class A>
442
+ XSIMD_INLINE batch<std::complex<float>, A> load_complex(batch<float, A> const& hi, batch<float, A> const& lo, requires_arch<vsx>) noexcept
443
+ {
444
+ __vector unsigned char perme = { 0, 1, 2, 3, 8, 9, 10, 11, 16, 17, 18, 19, 24, 25, 26, 27 };
445
+ __vector unsigned char permo = { 4, 5, 6, 7, 12, 13, 14, 15, 20, 21, 22, 23, 28, 29, 30, 31 };
446
+ return { vec_perm(hi.data, lo.data, perme), vec_perm(hi.data, lo.data, permo) };
447
+ }
448
+ template <class A>
449
+ XSIMD_INLINE batch<std::complex<double>, A> load_complex(batch<double, A> const& hi, batch<double, A> const& lo, requires_arch<vsx>) noexcept
450
+ {
451
+ return { vec_mergee(hi.data, lo.data), vec_mergeo(hi.data, lo.data) };
452
+ }
453
+ }
454
+
455
+ // le
456
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
457
+ XSIMD_INLINE batch_bool<T, A> le(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
458
+ {
459
+ return vec_cmple(self.data, other.data);
460
+ }
461
+
462
+ // lt
463
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
464
+ XSIMD_INLINE batch_bool<T, A> lt(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
465
+ {
466
+ return vec_cmplt(self.data, other.data);
467
+ }
468
+
469
+ // max
470
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
471
+ XSIMD_INLINE batch<T, A> max(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
472
+ {
473
+ return vec_max(self.data, other.data);
474
+ }
475
+
476
+ // min
477
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
478
+ XSIMD_INLINE batch<T, A> min(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
479
+ {
480
+ return vec_min(self.data, other.data);
481
+ }
482
+
483
+ // mul
484
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
485
+ XSIMD_INLINE batch<T, A> mul(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
486
+ {
487
+ return self.data * other.data;
488
+ }
489
+
490
+ // neg
491
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
492
+ XSIMD_INLINE batch<T, A> neg(batch<T, A> const& self, requires_arch<vsx>) noexcept
493
+ {
494
+ return -(self.data);
495
+ }
496
+
497
+ // neq
498
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
499
+ XSIMD_INLINE batch_bool<T, A> neq(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
500
+ {
501
+ return ~vec_cmpeq(self.data, other.data);
502
+ }
503
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
504
+ XSIMD_INLINE batch_bool<T, A> neq(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<vsx>) noexcept
505
+ {
506
+ return ~vec_cmpeq(self.data, other.data);
507
+ }
508
+
509
+ // reciprocal
510
+ template <class A>
511
+ XSIMD_INLINE batch<float, A> reciprocal(batch<float, A> const& self,
512
+ kernel::requires_arch<vsx>)
513
+ {
514
+ return vec_re(self.data);
515
+ }
516
+ template <class A>
517
+ XSIMD_INLINE batch<double, A> reciprocal(batch<double, A> const& self,
518
+ kernel::requires_arch<vsx>)
519
+ {
520
+ return vec_re(self.data);
521
+ }
522
+
523
+ // reduce_add
524
+ template <class A>
525
+ XSIMD_INLINE signed reduce_add(batch<signed, A> const& self, requires_arch<vsx>) noexcept
526
+ {
527
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
528
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
529
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
530
+ auto tmp3 = vec_add(tmp1, tmp2);
531
+ return vec_extract(tmp3, 0);
532
+ }
533
+ template <class A>
534
+ XSIMD_INLINE unsigned reduce_add(batch<unsigned, A> const& self, requires_arch<vsx>) noexcept
535
+ {
536
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
537
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
538
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
539
+ auto tmp3 = vec_add(tmp1, tmp2);
540
+ return vec_extract(tmp3, 0);
541
+ }
542
+ template <class A>
543
+ XSIMD_INLINE float reduce_add(batch<float, A> const& self, requires_arch<vsx>) noexcept
544
+ {
545
+ // FIXME: find an in-order approach
546
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
547
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v3, v1 + v2, v2 + v1, v3 + v0
548
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 + v1, v2 + v1, v3 + v0, v3 + v0
549
+ auto tmp3 = vec_add(tmp1, tmp2);
550
+ return vec_extract(tmp3, 0);
551
+ }
552
+ template <class A>
553
+ XSIMD_INLINE double reduce_add(batch<double, A> const& self, requires_arch<vsx>) noexcept
554
+ {
555
+ auto tmp0 = vec_reve(self.data); // v1, v0
556
+ auto tmp1 = vec_add(self.data, tmp0); // v0 + v1, v1 + v0
557
+ return vec_extract(tmp1, 0);
558
+ }
559
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
560
+ XSIMD_INLINE T reduce_add(batch<T, A> const& self, requires_arch<vsx>) noexcept
561
+ {
562
+ return reduce_add(self, common {});
563
+ }
564
+
565
+ // reduce_mul
566
+ template <class A>
567
+ XSIMD_INLINE signed reduce_mul(batch<signed, A> const& self, requires_arch<vsx>) noexcept
568
+ {
569
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
570
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
571
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
572
+ auto tmp3 = vec_mul(tmp1, tmp2);
573
+ return vec_extract(tmp3, 0);
574
+ }
575
+ template <class A>
576
+ XSIMD_INLINE unsigned reduce_mul(batch<unsigned, A> const& self, requires_arch<vsx>) noexcept
577
+ {
578
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
579
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
580
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
581
+ auto tmp3 = vec_mul(tmp1, tmp2);
582
+ return vec_extract(tmp3, 0);
583
+ }
584
+ template <class A>
585
+ XSIMD_INLINE float reduce_mul(batch<float, A> const& self, requires_arch<vsx>) noexcept
586
+ {
587
+ // FIXME: find an in-order approach
588
+ auto tmp0 = vec_reve(self.data); // v3, v2, v1, v0
589
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v3, v1 * v2, v2 * v1, v3 * v0
590
+ auto tmp2 = vec_mergel(tmp1, tmp1); // v2 * v1, v2 * v1, v3 * v0, v3 * v0
591
+ auto tmp3 = vec_mul(tmp1, tmp2);
592
+ return vec_extract(tmp3, 0);
593
+ }
594
+ template <class A>
595
+ XSIMD_INLINE double reduce_mul(batch<double, A> const& self, requires_arch<vsx>) noexcept
596
+ {
597
+ auto tmp0 = vec_reve(self.data); // v1, v0
598
+ auto tmp1 = vec_mul(self.data, tmp0); // v0 * v1, v1 * v0
599
+ return vec_extract(tmp1, 0);
600
+ }
601
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
602
+ XSIMD_INLINE T reduce_mul(batch<T, A> const& self, requires_arch<vsx>) noexcept
603
+ {
604
+ return reduce_mul(self, common {});
605
+ }
606
+
607
+ // round
608
+
609
+ // vec_round exists also for float vectors but is mapped to vrfin instruction which uses the wrong rounding mode
610
+ #if defined __has_builtin && __has_builtin(__builtin_vsx_xvrspi)
611
+ template <class A>
612
+ XSIMD_INLINE batch<float, A> round(batch<float, A> const& self, requires_arch<vsx>) noexcept
613
+ {
614
+ return __builtin_vsx_xvrspi(self.data);
615
+ }
616
+ #endif
617
+ // For double vectors vec_round uses xvrdpi which does the right thing
618
+ template <class A>
619
+ XSIMD_INLINE batch<double, A> round(batch<double, A> const& self, requires_arch<vsx>) noexcept
620
+ {
621
+ return vec_round(self.data);
622
+ }
623
+
624
+ // rsqrt
625
+ template <class A>
626
+ XSIMD_INLINE batch<float, A> rsqrt(batch<float, A> const& val, requires_arch<vsx>) noexcept
627
+ {
628
+ return vec_rsqrt(val.data);
629
+ }
630
+ template <class A>
631
+ XSIMD_INLINE batch<double, A> rsqrt(batch<double, A> const& val, requires_arch<vsx>) noexcept
632
+ {
633
+ return vec_rsqrt(val.data);
634
+ }
635
+
636
+ // select
637
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
638
+ 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<vsx>) noexcept
639
+ {
640
+ return vec_sel(false_br.data, true_br.data, cond.data);
641
+ }
642
+ template <class A, class T, bool... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
643
+ 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<vsx>) noexcept
644
+ {
645
+ return select(batch_bool<T, A> { Values... }, true_br, false_br, vsx {});
646
+ }
647
+
648
+ // shuffle
649
+ template <class A, class ITy, ITy I0, ITy I1, ITy I2, ITy I3>
650
+ 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<vsx>) noexcept
651
+ {
652
+ return vec_perm(x.data, y.data,
653
+ (__vector unsigned char) {
654
+ 4 * I0 + 0, 4 * I0 + 1, 4 * I0 + 2, 4 * I0 + 3,
655
+ 4 * I1 + 0, 4 * I1 + 1, 4 * I1 + 2, 4 * I1 + 3,
656
+ 4 * I2 + 0, 4 * I2 + 1, 4 * I2 + 2, 4 * I2 + 3,
657
+ 4 * I3 + 0, 4 * I3 + 1, 4 * I3 + 2, 4 * I3 + 3 });
658
+ }
659
+
660
+ template <class A, class ITy, ITy I0, ITy I1>
661
+ XSIMD_INLINE batch<double, A> shuffle(batch<double, A> const& x, batch<double, A> const& y, batch_constant<ITy, A, I0, I1>, requires_arch<vsx>) noexcept
662
+ {
663
+ return vec_perm(x.data, y.data,
664
+ (__vector unsigned char) {
665
+ 8 * I0 + 0,
666
+ 8 * I0 + 1,
667
+ 8 * I0 + 2,
668
+ 8 * I0 + 3,
669
+ 8 * I0 + 4,
670
+ 8 * I0 + 5,
671
+ 8 * I0 + 6,
672
+ 8 * I0 + 7,
673
+ 8 * I1 + 0,
674
+ 8 * I1 + 1,
675
+ 8 * I1 + 2,
676
+ 8 * I1 + 3,
677
+ 8 * I1 + 4,
678
+ 8 * I1 + 5,
679
+ 8 * I1 + 6,
680
+ 8 * I1 + 7,
681
+ });
682
+ }
683
+
684
+ // sqrt
685
+ template <class A>
686
+ XSIMD_INLINE batch<float, A> sqrt(batch<float, A> const& val, requires_arch<vsx>) noexcept
687
+ {
688
+ return vec_sqrt(val.data);
689
+ }
690
+
691
+ template <class A>
692
+ XSIMD_INLINE batch<double, A> sqrt(batch<double, A> const& val, requires_arch<vsx>) noexcept
693
+ {
694
+ return vec_sqrt(val.data);
695
+ }
696
+
697
+ // slide_left
698
+ template <size_t N, class A, class T>
699
+ XSIMD_INLINE batch<T, A> slide_left(batch<T, A> const& x, requires_arch<vsx>) noexcept
700
+ {
701
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
702
+ {
703
+ return batch<T, A>(0);
704
+ }
705
+ else
706
+ {
707
+ auto slider = vec_splats((uint8_t)(8 * N));
708
+ return (typename batch<T, A>::register_type)vec_slo(x.data, slider);
709
+ }
710
+ }
711
+
712
+ // slide_right
713
+ template <size_t N, class A, class T>
714
+ XSIMD_INLINE batch<T, A> slide_right(batch<T, A> const& x, requires_arch<vsx>) noexcept
715
+ {
716
+ XSIMD_IF_CONSTEXPR(N == batch<T, A>::size * sizeof(T))
717
+ {
718
+ return batch<T, A>(0);
719
+ }
720
+ else
721
+ {
722
+ auto slider = vec_splats((uint8_t)(8 * N));
723
+ return (typename batch<T, A>::register_type)vec_sro((__vector unsigned char)x.data, slider);
724
+ }
725
+ }
726
+
727
+ // sadd
728
+ template <class A, class T, class = std::enable_if_t<std::is_integral<T>::value && sizeof(T) != 8>>
729
+ XSIMD_INLINE batch<T, A> sadd(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
730
+ {
731
+ return vec_adds(self.data, other.data);
732
+ }
733
+
734
+ // set
735
+ template <class A, class T, class... Values>
736
+ XSIMD_INLINE batch<T, A> set(batch<T, A> const&, requires_arch<vsx>, Values... values) noexcept
737
+ {
738
+ static_assert(sizeof...(Values) == batch<T, A>::size, "consistent init");
739
+ return typename batch<T, A>::register_type { values... };
740
+ }
741
+
742
+ template <class A, class T, class... Values, class = std::enable_if_t<std::is_scalar<T>::value>>
743
+ XSIMD_INLINE batch_bool<T, A> set(batch_bool<T, A> const&, requires_arch<vsx>, Values... values) noexcept
744
+ {
745
+ static_assert(sizeof...(Values) == batch_bool<T, A>::size, "consistent init");
746
+ return typename batch_bool<T, A>::register_type { static_cast<decltype(std::declval<typename batch_bool<T, A>::register_type>()[0])>(values ? -1LL : 0LL)... };
747
+ }
748
+
749
+ // ssub
750
+
751
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value && sizeof(T) == 1>>
752
+ XSIMD_INLINE batch<T, A> ssub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
753
+ {
754
+ return vec_subs(self.data, other.data);
755
+ }
756
+
757
+ // store_aligned
758
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
759
+ XSIMD_INLINE void store_aligned(T* mem, batch<T, A> const& self, requires_arch<vsx>) noexcept
760
+ {
761
+ return vec_st(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
762
+ }
763
+
764
+ // store_unaligned
765
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
766
+ XSIMD_INLINE void store_unaligned(T* mem, batch<T, A> const& self, requires_arch<vsx>) noexcept
767
+ {
768
+ return vec_vsx_st(self.data, 0, reinterpret_cast<typename batch<T, A>::register_type*>(mem));
769
+ }
770
+
771
+ // sub
772
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
773
+ XSIMD_INLINE batch<T, A> sub(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
774
+ {
775
+ return vec_sub(self.data, other.data);
776
+ }
777
+
778
+ // swizzle
779
+
780
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
781
+ XSIMD_INLINE batch<float, A> swizzle(batch<float, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vsx>) noexcept
782
+ {
783
+ return vec_perm(self.data, self.data,
784
+ (__vector unsigned char) {
785
+ 4 * V0 + 0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
786
+ 4 * V1 + 0, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
787
+ 4 * V2 + 0, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
788
+ 4 * V3 + 0, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3 });
789
+ }
790
+
791
+ template <class A, uint64_t V0, uint64_t V1>
792
+ XSIMD_INLINE batch<double, A> swizzle(batch<double, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vsx>) noexcept
793
+ {
794
+ return vec_perm(self.data, self.data,
795
+ (__vector unsigned char) {
796
+ 8 * V0 + 0,
797
+ 8 * V0 + 1,
798
+ 8 * V0 + 2,
799
+ 8 * V0 + 3,
800
+ 8 * V0 + 4,
801
+ 8 * V0 + 5,
802
+ 8 * V0 + 6,
803
+ 8 * V0 + 7,
804
+ 8 * V1 + 0,
805
+ 8 * V1 + 1,
806
+ 8 * V1 + 2,
807
+ 8 * V1 + 3,
808
+ 8 * V1 + 4,
809
+ 8 * V1 + 5,
810
+ 8 * V1 + 6,
811
+ 8 * V1 + 7,
812
+ });
813
+ }
814
+
815
+ template <class A, uint64_t V0, uint64_t V1>
816
+ XSIMD_INLINE batch<uint64_t, A> swizzle(batch<uint64_t, A> const& self, batch_constant<uint64_t, A, V0, V1>, requires_arch<vsx>) noexcept
817
+ {
818
+ return vec_perm(self.data, self.data,
819
+ (__vector unsigned char) {
820
+ 8 * V0 + 0,
821
+ 8 * V0 + 1,
822
+ 8 * V0 + 2,
823
+ 8 * V0 + 3,
824
+ 8 * V0 + 4,
825
+ 8 * V0 + 5,
826
+ 8 * V0 + 6,
827
+ 8 * V0 + 7,
828
+ 8 * V1 + 0,
829
+ 8 * V1 + 1,
830
+ 8 * V1 + 2,
831
+ 8 * V1 + 3,
832
+ 8 * V1 + 4,
833
+ 8 * V1 + 5,
834
+ 8 * V1 + 6,
835
+ 8 * V1 + 7,
836
+ });
837
+ }
838
+
839
+ template <class A, uint64_t V0, uint64_t V1>
840
+ XSIMD_INLINE batch<int64_t, A> swizzle(batch<int64_t, A> const& self, batch_constant<uint64_t, A, V0, V1> mask, requires_arch<vsx>) noexcept
841
+ {
842
+ return bitwise_cast<int64_t>(swizzle(bitwise_cast<uint64_t>(self), mask, vsx {}));
843
+ }
844
+
845
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
846
+ XSIMD_INLINE batch<uint32_t, A> swizzle(batch<uint32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3>, requires_arch<vsx>) noexcept
847
+ {
848
+ return vec_perm(self.data, self.data,
849
+ (__vector unsigned char) {
850
+ 4 * V0 + 0, 4 * V0 + 1, 4 * V0 + 2, 4 * V0 + 3,
851
+ 4 * V1 + 0, 4 * V1 + 1, 4 * V1 + 2, 4 * V1 + 3,
852
+ 4 * V2 + 0, 4 * V2 + 1, 4 * V2 + 2, 4 * V2 + 3,
853
+ 4 * V3 + 0, 4 * V3 + 1, 4 * V3 + 2, 4 * V3 + 3 });
854
+ }
855
+
856
+ template <class A, uint32_t V0, uint32_t V1, uint32_t V2, uint32_t V3>
857
+ XSIMD_INLINE batch<int32_t, A> swizzle(batch<int32_t, A> const& self, batch_constant<uint32_t, A, V0, V1, V2, V3> mask, requires_arch<vsx>) noexcept
858
+ {
859
+ return bitwise_cast<int32_t>(swizzle(bitwise_cast<uint32_t>(self), mask, vsx {}));
860
+ }
861
+
862
+ 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>
863
+ 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<vsx>) noexcept
864
+ {
865
+ return vec_perm(self.data, self.data,
866
+ (__vector unsigned char) {
867
+ 2 * V0 + 0, 2 * V0 + 1, 2 * V1 + 0, 2 * V1 + 1,
868
+ 2 * V2 + 0, 2 * V2 + 1, 2 * V3 + 0, 2 * V3 + 1,
869
+ 2 * V4 + 0, 2 * V4 + 1, 2 * V5 + 0, 2 * V5 + 1,
870
+ 2 * V6 + 0, 2 * V6 + 1, 2 * V7 + 0, 2 * V7 + 1 });
871
+ }
872
+
873
+ 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>
874
+ 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> mask, requires_arch<vsx>) noexcept
875
+ {
876
+ return bitwise_cast<int16_t>(swizzle(bitwise_cast<uint16_t>(self), mask, vsx {}));
877
+ }
878
+
879
+ // trunc
880
+ template <class A, class T, class = std::enable_if_t<std::is_floating_point<T>::value>>
881
+ XSIMD_INLINE batch<T, A> trunc(batch<T, A> const& self, requires_arch<vsx>) noexcept
882
+ {
883
+ return vec_trunc(self.data);
884
+ }
885
+
886
+ // widen
887
+ template <class A>
888
+ XSIMD_INLINE std::array<batch<double, A>, 2> widen(batch<float, A> const& x, requires_arch<vsx>) noexcept
889
+ {
890
+ return { batch<double, A>(vec_doublel(x.data)), batch<double, A>(vec_doubleh(x.data)) };
891
+ }
892
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
893
+ XSIMD_INLINE std::array<batch<widen_t<T>, A>, 2> widen(batch<T, A> const& x, requires_arch<vsx>) noexcept
894
+ {
895
+ auto even = vec_mule(x.data, vec_splats(T(1))); // x0, x2, x4, x6
896
+ auto odd = vec_mulo(x.data, vec_splats(T(1))); // x1, x3, x5, x7
897
+ return { batch<widen_t<T>, A>(vec_mergel(even, odd)), batch<widen_t<T>, A>(vec_mergeh(even, odd)) };
898
+ }
899
+
900
+ // zip_hi
901
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
902
+ XSIMD_INLINE batch<T, A> zip_hi(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
903
+ {
904
+ return vec_mergel(self.data, other.data);
905
+ }
906
+
907
+ // zip_lo
908
+ template <class A, class T, class = std::enable_if_t<std::is_scalar<T>::value>>
909
+ XSIMD_INLINE batch<T, A> zip_lo(batch<T, A> const& self, batch<T, A> const& other, requires_arch<vsx>) noexcept
910
+ {
911
+ return vec_mergeh(self.data, other.data);
912
+ }
913
+ }
914
+ }
915
+
916
+ #endif