GNU Radio Manual and C++ API Reference  3.7.6.1
The Free & Open Software Radio Ecosystem
volk_32f_x2_divide_32f.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_x2_divide_32f_a_H
24 #define INCLUDED_volk_32f_x2_divide_32f_a_H
25 
26 #include <inttypes.h>
27 #include <stdio.h>
28 
29 #ifdef LV_HAVE_SSE
30 #include <xmmintrin.h>
31 /*!
32  \brief Divides the two input vectors and store their results in the third vector
33  \param cVector The vector where the results will be stored
34  \param aVector The vector to be divideed
35  \param bVector The divisor vector
36  \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
37 */
38 static inline void volk_32f_x2_divide_32f_a_sse(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
39  unsigned int number = 0;
40  const unsigned int quarterPoints = num_points / 4;
41 
42  float* cPtr = cVector;
43  const float* aPtr = aVector;
44  const float* bPtr= bVector;
45 
46  __m128 aVal, bVal, cVal;
47  for(;number < quarterPoints; number++){
48 
49  aVal = _mm_load_ps(aPtr);
50  bVal = _mm_load_ps(bPtr);
51 
52  cVal = _mm_div_ps(aVal, bVal);
53 
54  _mm_store_ps(cPtr,cVal); // Store the results back into the C container
55 
56  aPtr += 4;
57  bPtr += 4;
58  cPtr += 4;
59  }
60 
61  number = quarterPoints * 4;
62  for(;number < num_points; number++){
63  *cPtr++ = (*aPtr++) / (*bPtr++);
64  }
65 }
66 #endif /* LV_HAVE_SSE */
67 
68 #ifdef LV_HAVE_GENERIC
69 /*!
70  \brief Divides the two input vectors and store their results in the third vector
71  \param cVector The vector where the results will be stored
72  \param aVector The vector to be divideed
73  \param bVector The divisor vector
74  \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
75 */
76 static inline void volk_32f_x2_divide_32f_generic(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
77  float* cPtr = cVector;
78  const float* aPtr = aVector;
79  const float* bPtr= bVector;
80  unsigned int number = 0;
81 
82  for(number = 0; number < num_points; number++){
83  *cPtr++ = (*aPtr++) / (*bPtr++);
84  }
85 }
86 #endif /* LV_HAVE_GENERIC */
87 
88 #ifdef LV_HAVE_ORC
89 /*!
90  \brief Divides the two input vectors and store their results in the third vector
91  \param cVector The vector where the results will be stored
92  \param aVector The vector to be divideed
93  \param bVector The divisor vector
94  \param num_points The number of values in aVector and bVector to be divideed together and stored into cVector
95 */
96 extern void volk_32f_x2_divide_32f_a_orc_impl(float* cVector, const float* aVector, const float* bVector, unsigned int num_points);
97 static inline void volk_32f_x2_divide_32f_u_orc(float* cVector, const float* aVector, const float* bVector, unsigned int num_points){
98  volk_32f_x2_divide_32f_a_orc_impl(cVector, aVector, bVector, num_points);
99 }
100 #endif /* LV_HAVE_ORC */
101 
102 
103 
104 #endif /* INCLUDED_volk_32f_x2_divide_32f_a_H */