58 #ifndef INCLUDED_volk_32f_x2_max_32f_a_H
59 #define INCLUDED_volk_32f_x2_max_32f_a_H
64 #ifdef LV_HAVE_AVX512F
65 #include <immintrin.h>
67 static inline void volk_32f_x2_max_32f_a_avx512f(
float* cVector,
70 unsigned int num_points)
72 unsigned int number = 0;
73 const unsigned int sixteenthPoints = num_points / 16;
75 float* cPtr = cVector;
76 const float* aPtr = aVector;
77 const float* bPtr = bVector;
79 __m512 aVal, bVal, cVal;
80 for (; number < sixteenthPoints; number++) {
81 aVal = _mm512_load_ps(aPtr);
82 bVal = _mm512_load_ps(bPtr);
84 cVal = _mm512_max_ps(aVal, bVal);
86 _mm512_store_ps(cPtr, cVal);
93 number = sixteenthPoints * 16;
94 for (; number < num_points; number++) {
95 const float a = *aPtr++;
96 const float b = *bPtr++;
97 *cPtr++ = (a > b ? a : b);
103 #include <xmmintrin.h>
106 const float* aVector,
107 const float* bVector,
108 unsigned int num_points)
110 unsigned int number = 0;
111 const unsigned int quarterPoints = num_points / 4;
113 float* cPtr = cVector;
114 const float* aPtr = aVector;
115 const float* bPtr = bVector;
118 for (; number < quarterPoints; number++) {
131 number = quarterPoints * 4;
132 for (; number < num_points; number++) {
133 const float a = *aPtr++;
134 const float b = *bPtr++;
135 *cPtr++ = (a > b ? a : b);
141 #include <immintrin.h>
144 const float* aVector,
145 const float* bVector,
146 unsigned int num_points)
148 unsigned int number = 0;
149 const unsigned int eighthPoints = num_points / 8;
151 float* cPtr = cVector;
152 const float* aPtr = aVector;
153 const float* bPtr = bVector;
155 __m256 aVal, bVal, cVal;
156 for (; number < eighthPoints; number++) {
157 aVal = _mm256_load_ps(aPtr);
158 bVal = _mm256_load_ps(bPtr);
160 cVal = _mm256_max_ps(aVal, bVal);
162 _mm256_store_ps(cPtr, cVal);
169 number = eighthPoints * 8;
170 for (; number < num_points; number++) {
171 const float a = *aPtr++;
172 const float b = *bPtr++;
173 *cPtr++ = (a > b ? a : b);
179 #include <arm_neon.h>
182 const float* aVector,
183 const float* bVector,
184 unsigned int num_points)
186 unsigned int quarter_points = num_points / 4;
187 float* cPtr = cVector;
188 const float* aPtr = aVector;
189 const float* bPtr = bVector;
190 unsigned int number = 0;
192 float32x4_t a_vec, b_vec, c_vec;
193 for (number = 0; number < quarter_points; number++) {
194 a_vec = vld1q_f32(aPtr);
195 b_vec = vld1q_f32(bPtr);
196 c_vec = vmaxq_f32(a_vec, b_vec);
197 vst1q_f32(cPtr, c_vec);
203 for (number = quarter_points * 4; number < num_points; number++) {
204 const float a = *aPtr++;
205 const float b = *bPtr++;
206 *cPtr++ = (a > b ? a : b);
212 #ifdef LV_HAVE_GENERIC
215 const float* aVector,
216 const float* bVector,
217 unsigned int num_points)
219 float* cPtr = cVector;
220 const float* aPtr = aVector;
221 const float* bPtr = bVector;
222 unsigned int number = 0;
224 for (number = 0; number < num_points; number++) {
225 const float a = *aPtr++;
226 const float b = *bPtr++;
227 *cPtr++ = (a > b ? a : b);
233 extern void volk_32f_x2_max_32f_a_orc_impl(
float* cVector,
234 const float* aVector,
235 const float* bVector,
236 unsigned int num_points);
238 static inline void volk_32f_x2_max_32f_u_orc(
float* cVector,
239 const float* aVector,
240 const float* bVector,
241 unsigned int num_points)
243 volk_32f_x2_max_32f_a_orc_impl(cVector, aVector, bVector, num_points);
251 #ifndef INCLUDED_volk_32f_x2_max_32f_u_H
252 #define INCLUDED_volk_32f_x2_max_32f_u_H
254 #include <inttypes.h>
257 #ifdef LV_HAVE_AVX512F
258 #include <immintrin.h>
260 static inline void volk_32f_x2_max_32f_u_avx512f(
float* cVector,
261 const float* aVector,
262 const float* bVector,
263 unsigned int num_points)
265 unsigned int number = 0;
266 const unsigned int sixteenthPoints = num_points / 16;
268 float* cPtr = cVector;
269 const float* aPtr = aVector;
270 const float* bPtr = bVector;
272 __m512 aVal, bVal, cVal;
273 for (; number < sixteenthPoints; number++) {
274 aVal = _mm512_loadu_ps(aPtr);
275 bVal = _mm512_loadu_ps(bPtr);
277 cVal = _mm512_max_ps(aVal, bVal);
279 _mm512_storeu_ps(cPtr, cVal);
286 number = sixteenthPoints * 16;
287 for (; number < num_points; number++) {
288 const float a = *aPtr++;
289 const float b = *bPtr++;
290 *cPtr++ = (a > b ? a : b);
296 #include <immintrin.h>
299 const float* aVector,
300 const float* bVector,
301 unsigned int num_points)
303 unsigned int number = 0;
304 const unsigned int eighthPoints = num_points / 8;
306 float* cPtr = cVector;
307 const float* aPtr = aVector;
308 const float* bPtr = bVector;
310 __m256 aVal, bVal, cVal;
311 for (; number < eighthPoints; number++) {
312 aVal = _mm256_loadu_ps(aPtr);
313 bVal = _mm256_loadu_ps(bPtr);
315 cVal = _mm256_max_ps(aVal, bVal);
317 _mm256_storeu_ps(cPtr, cVal);
324 number = eighthPoints * 8;
325 for (; number < num_points; number++) {
326 const float a = *aPtr++;
327 const float b = *bPtr++;
328 *cPtr++ = (a > b ? a : b);
float32x4_t __m128
Definition: sse2neon.h:235
FORCE_INLINE __m128 _mm_load_ps(const float *p)
Definition: sse2neon.h:1858
FORCE_INLINE void _mm_store_ps(float *p, __m128 a)
Definition: sse2neon.h:2704
FORCE_INLINE __m128 _mm_max_ps(__m128 a, __m128 b)
Definition: sse2neon.h:2025
static void volk_32f_x2_max_32f_u_avx(float *cVector, const float *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32f_x2_max_32f.h:298
static void volk_32f_x2_max_32f_a_avx(float *cVector, const float *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32f_x2_max_32f.h:143
static void volk_32f_x2_max_32f_neon(float *cVector, const float *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32f_x2_max_32f.h:181
static void volk_32f_x2_max_32f_generic(float *cVector, const float *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32f_x2_max_32f.h:214
static void volk_32f_x2_max_32f_a_sse(float *cVector, const float *aVector, const float *bVector, unsigned int num_points)
Definition: volk_32f_x2_max_32f.h:105