1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
#ifndef INCLUDED_volk_32f_s32f_multiply_32f_u_H
#define INCLUDED_volk_32f_s32f_multiply_32f_u_H
#include <inttypes.h>
#include <stdio.h>
#ifdef LV_HAVE_SSE
#include <xmmintrin.h>
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_u_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const unsigned int quarterPoints = num_points / 4;
float* cPtr = cVector;
const float* aPtr = aVector;
__m128 aVal, bVal, cVal;
bVal = _mm_set_ps1(scalar);
for(;number < quarterPoints; number++){
aVal = _mm_loadu_ps(aPtr);
cVal = _mm_mul_ps(aVal, bVal);
_mm_storeu_ps(cPtr,cVal); // Store the results back into the C container
aPtr += 4;
cPtr += 4;
}
number = quarterPoints * 4;
for(;number < num_points; number++){
*cPtr++ = (*aPtr++) * scalar;
}
}
#endif /* LV_HAVE_SSE */
#ifdef LV_HAVE_AVX
#include <immintrin.h>
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_u_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const unsigned int eighthPoints = num_points / 8;
float* cPtr = cVector;
const float* aPtr = aVector;
__m256 aVal, bVal, cVal;
bVal = _mm256_set1_ps(scalar);
for(;number < eighthPoints; number++){
aVal = _mm256_loadu_ps(aPtr);
cVal = _mm256_mul_ps(aVal, bVal);
_mm256_storeu_ps(cPtr,cVal); // Store the results back into the C container
aPtr += 8;
cPtr += 8;
}
number = eighthPoints * 8;
for(;number < num_points; number++){
*cPtr++ = (*aPtr++) * scalar;
}
}
#endif /* LV_HAVE_AVX */
#ifdef LV_HAVE_GENERIC
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const float* inputPtr = aVector;
float* outputPtr = cVector;
for(number = 0; number < num_points; number++){
*outputPtr = (*inputPtr) * scalar;
inputPtr++;
outputPtr++;
}
}
#endif /* LV_HAVE_GENERIC */
#endif /* INCLUDED_volk_32f_s32f_multiply_32f_u_H */
#ifndef INCLUDED_volk_32f_s32f_multiply_32f_a_H
#define INCLUDED_volk_32f_s32f_multiply_32f_a_H
#include <inttypes.h>
#include <stdio.h>
#ifdef LV_HAVE_SSE
#include <xmmintrin.h>
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_a_sse(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const unsigned int quarterPoints = num_points / 4;
float* cPtr = cVector;
const float* aPtr = aVector;
__m128 aVal, bVal, cVal;
bVal = _mm_set_ps1(scalar);
for(;number < quarterPoints; number++){
aVal = _mm_load_ps(aPtr);
cVal = _mm_mul_ps(aVal, bVal);
_mm_store_ps(cPtr,cVal); // Store the results back into the C container
aPtr += 4;
cPtr += 4;
}
number = quarterPoints * 4;
for(;number < num_points; number++){
*cPtr++ = (*aPtr++) * scalar;
}
}
#endif /* LV_HAVE_SSE */
#ifdef LV_HAVE_AVX
#include <immintrin.h>
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_a_avx(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const unsigned int eighthPoints = num_points / 8;
float* cPtr = cVector;
const float* aPtr = aVector;
__m256 aVal, bVal, cVal;
bVal = _mm256_set1_ps(scalar);
for(;number < eighthPoints; number++){
aVal = _mm256_load_ps(aPtr);
cVal = _mm256_mul_ps(aVal, bVal);
_mm256_store_ps(cPtr,cVal); // Store the results back into the C container
aPtr += 8;
cPtr += 8;
}
number = eighthPoints * 8;
for(;number < num_points; number++){
*cPtr++ = (*aPtr++) * scalar;
}
}
#endif /* LV_HAVE_AVX */
#ifdef LV_HAVE_GENERIC
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
static inline void volk_32f_s32f_multiply_32f_a_generic(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
unsigned int number = 0;
const float* inputPtr = aVector;
float* outputPtr = cVector;
for(number = 0; number < num_points; number++){
*outputPtr = (*inputPtr) * scalar;
inputPtr++;
outputPtr++;
}
}
#endif /* LV_HAVE_GENERIC */
#ifdef LV_HAVE_ORC
/*!
\brief Scalar float multiply
\param cVector The vector where the results will be stored
\param aVector One of the vectors to be multiplied
\param scalar the scalar value
\param num_points The number of values in aVector and bVector to be multiplied together and stored into cVector
*/
extern void volk_32f_s32f_multiply_32f_a_orc_impl(float* dst, const float* src, const float scalar, unsigned int num_points);
static inline void volk_32f_s32f_multiply_32f_u_orc(float* cVector, const float* aVector, const float scalar, unsigned int num_points){
volk_32f_s32f_multiply_32f_a_orc_impl(cVector, aVector, scalar, num_points);
}
#endif /* LV_HAVE_GENERIC */
#endif /* INCLUDED_volk_32f_s32f_multiply_32f_a_H */
|