GNU Radio Manual and C++ API Reference  3.7.6.1
The Free & Open Software Radio Ecosystem
volk_32f_convert_64f.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_volk_32f_convert_64f_u_H
24 #define INCLUDED_volk_32f_convert_64f_u_H
25 
26 #include <inttypes.h>
27 #include <stdio.h>
28 
29 #ifdef LV_HAVE_AVX
30 #include <immintrin.h>
31  /*!
32  \brief Converts the float values into double values
33  \param dVector The converted double vector values
34  \param fVector The float vector values to be converted
35  \param num_points The number of points in the two vectors to be converted
36  */
37 
38 static inline void volk_32f_convert_64f_u_avx(double* outputVector, const float* inputVector, unsigned int num_points){
39  unsigned int number = 0;
40 
41  const unsigned int quarterPoints = num_points / 4;
42 
43  const float* inputVectorPtr = (const float*)inputVector;
44  double* outputVectorPtr = outputVector;
45  __m256d ret;
46  __m128 inputVal;
47 
48  for(;number < quarterPoints; number++){
49  inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
50 
51  ret = _mm256_cvtps_pd(inputVal);
52  _mm256_storeu_pd(outputVectorPtr, ret);
53 
54  outputVectorPtr += 4;
55  }
56 
57  number = quarterPoints * 4;
58  for(; number < num_points; number++){
59  outputVector[number] = (double)(inputVector[number]);
60  }
61 }
62 
63 #endif /* LV_HAVE_AVX */
64 
65 #ifdef LV_HAVE_SSE2
66 #include <emmintrin.h>
67  /*!
68  \brief Converts the float values into double values
69  \param dVector The converted double vector values
70  \param fVector The float vector values to be converted
71  \param num_points The number of points in the two vectors to be converted
72  */
73 static inline void volk_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
74  unsigned int number = 0;
75 
76  const unsigned int quarterPoints = num_points / 4;
77 
78  const float* inputVectorPtr = (const float*)inputVector;
79  double* outputVectorPtr = outputVector;
80  __m128d ret;
81  __m128 inputVal;
82 
83  for(;number < quarterPoints; number++){
84  inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
85 
86  ret = _mm_cvtps_pd(inputVal);
87 
88  _mm_storeu_pd(outputVectorPtr, ret);
89  outputVectorPtr += 2;
90 
91  inputVal = _mm_movehl_ps(inputVal, inputVal);
92 
93  ret = _mm_cvtps_pd(inputVal);
94 
95  _mm_storeu_pd(outputVectorPtr, ret);
96  outputVectorPtr += 2;
97  }
98 
99  number = quarterPoints * 4;
100  for(; number < num_points; number++){
101  outputVector[number] = (double)(inputVector[number]);
102  }
103 }
104 #endif /* LV_HAVE_SSE2 */
105 
106 
107 #ifdef LV_HAVE_GENERIC
108 /*!
109  \brief Converts the float values into double values
110  \param dVector The converted double vector values
111  \param fVector The float vector values to be converted
112  \param num_points The number of points in the two vectors to be converted
113 */
114 static inline void volk_32f_convert_64f_generic(double* outputVector, const float* inputVector, unsigned int num_points){
115  double* outputVectorPtr = outputVector;
116  const float* inputVectorPtr = inputVector;
117  unsigned int number = 0;
118 
119  for(number = 0; number < num_points; number++){
120  *outputVectorPtr++ = ((double)(*inputVectorPtr++));
121  }
122 }
123 #endif /* LV_HAVE_GENERIC */
124 
125 
126 
127 
128 #endif /* INCLUDED_volk_32f_convert_64f_u_H */
129 
130 
131 #ifndef INCLUDED_volk_32f_convert_64f_a_H
132 #define INCLUDED_volk_32f_convert_64f_a_H
133 
134 #include <inttypes.h>
135 #include <stdio.h>
136 
137 #ifdef LV_HAVE_AVX
138 #include <immintrin.h>
139  /*!
140  \brief Converts the float values into double values
141  \param dVector The converted double vector values
142  \param fVector The float vector values to be converted
143  \param num_points The number of points in the two vectors to be converted
144  */
145 static inline void volk_32f_convert_64f_a_avx(double* outputVector, const float* inputVector, unsigned int num_points){
146  unsigned int number = 0;
147 
148  const unsigned int quarterPoints = num_points / 4;
149 
150  const float* inputVectorPtr = (const float*)inputVector;
151  double* outputVectorPtr = outputVector;
152  __m256d ret;
153  __m128 inputVal;
154 
155  for(;number < quarterPoints; number++){
156  inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
157 
158  ret = _mm256_cvtps_pd(inputVal);
159  _mm256_store_pd(outputVectorPtr, ret);
160 
161  outputVectorPtr += 4;
162  }
163 
164  number = quarterPoints * 4;
165  for(; number < num_points; number++){
166  outputVector[number] = (double)(inputVector[number]);
167  }
168 }
169 #endif /* LV_HAVE_AVX */
170 
171 #ifdef LV_HAVE_SSE2
172 #include <emmintrin.h>
173  /*!
174  \brief Converts the float values into double values
175  \param dVector The converted double vector values
176  \param fVector The float vector values to be converted
177  \param num_points The number of points in the two vectors to be converted
178  */
179 static inline void volk_32f_convert_64f_a_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
180  unsigned int number = 0;
181 
182  const unsigned int quarterPoints = num_points / 4;
183 
184  const float* inputVectorPtr = (const float*)inputVector;
185  double* outputVectorPtr = outputVector;
186  __m128d ret;
187  __m128 inputVal;
188 
189  for(;number < quarterPoints; number++){
190  inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
191 
192  ret = _mm_cvtps_pd(inputVal);
193 
194  _mm_store_pd(outputVectorPtr, ret);
195  outputVectorPtr += 2;
196 
197  inputVal = _mm_movehl_ps(inputVal, inputVal);
198 
199  ret = _mm_cvtps_pd(inputVal);
200 
201  _mm_store_pd(outputVectorPtr, ret);
202  outputVectorPtr += 2;
203  }
204 
205  number = quarterPoints * 4;
206  for(; number < num_points; number++){
207  outputVector[number] = (double)(inputVector[number]);
208  }
209 }
210 #endif /* LV_HAVE_SSE2 */
211 
212 
213 #ifdef LV_HAVE_GENERIC
214 /*!
215  \brief Converts the float values into double values
216  \param dVector The converted double vector values
217  \param fVector The float vector values to be converted
218  \param num_points The number of points in the two vectors to be converted
219 */
220 static inline void volk_32f_convert_64f_a_generic(double* outputVector, const float* inputVector, unsigned int num_points){
221  double* outputVectorPtr = outputVector;
222  const float* inputVectorPtr = inputVector;
223  unsigned int number = 0;
224 
225  for(number = 0; number < num_points; number++){
226  *outputVectorPtr++ = ((double)(*inputVectorPtr++));
227  }
228 }
229 #endif /* LV_HAVE_GENERIC */
230 
231 
232 
233 
234 #endif /* INCLUDED_volk_32f_convert_64f_a_H */