1+ #if defined(__AVX__ )
12#ifndef _MSC_VER
23#include <x86intrin.h>
34#else
45#include <intrin.h>
56#endif
67
7- static void THDoubleVector_copy_AVX (double * y , const double * x , const ptrdiff_t n ) {
8+ #include "AVX.h"
9+
10+ void THDoubleVector_copy_AVX (double * y , const double * x , const ptrdiff_t n ) {
811 ptrdiff_t i ;
912 ptrdiff_t off ;
1013 for (i = 0 ; i <=((n )- 8 ); i += 8 ) {
@@ -17,7 +20,7 @@ static void THDoubleVector_copy_AVX(double *y, const double *x, const ptrdiff_t
1720 }
1821}
1922
20- static void THDoubleVector_fill_AVX (double * x , const double c , const ptrdiff_t n ) {
23+ void THDoubleVector_fill_AVX (double * x , const double c , const ptrdiff_t n ) {
2124 ptrdiff_t i ;
2225 ptrdiff_t off ;
2326 __m256d YMM0 = _mm256_set_pd (c , c , c , c );
@@ -33,7 +36,7 @@ static void THDoubleVector_fill_AVX(double *x, const double c, const ptrdiff_t n
3336 }
3437}
3538
36- static void THDoubleVector_cdiv_AVX (double * z , const double * x , const double * y , const ptrdiff_t n ) {
39+ void THDoubleVector_cdiv_AVX (double * z , const double * x , const double * y , const ptrdiff_t n ) {
3740 ptrdiff_t i ;
3841 __m256d YMM0 , YMM1 , YMM2 , YMM3 ;
3942 for (i = 0 ; i <=((n )- 8 ); i += 8 ) {
@@ -51,7 +54,7 @@ static void THDoubleVector_cdiv_AVX(double *z, const double *x, const double *y,
5154 }
5255}
5356
54- static void THDoubleVector_divs_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
57+ void THDoubleVector_divs_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
5558 ptrdiff_t i ;
5659 __m256d YMM15 = _mm256_set_pd (c , c , c , c );
5760 __m256d YMM0 , YMM1 ;
@@ -68,7 +71,7 @@ static void THDoubleVector_divs_AVX(double *y, const double *x, const double c,
6871 }
6972}
7073
71- static void THDoubleVector_cmul_AVX (double * z , const double * x , const double * y , const ptrdiff_t n ) {
74+ void THDoubleVector_cmul_AVX (double * z , const double * x , const double * y , const ptrdiff_t n ) {
7275 ptrdiff_t i ;
7376 __m256d YMM0 , YMM1 , YMM2 , YMM3 ;
7477 for (i = 0 ; i <=((n )- 8 ); i += 8 ) {
@@ -86,7 +89,7 @@ static void THDoubleVector_cmul_AVX(double *z, const double *x, const double *y,
8689 }
8790}
8891
89- static void THDoubleVector_muls_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
92+ void THDoubleVector_muls_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
9093 ptrdiff_t i ;
9194 __m256d YMM15 = _mm256_set_pd (c , c , c , c );
9295 __m256d YMM0 , YMM1 ;
@@ -103,7 +106,7 @@ static void THDoubleVector_muls_AVX(double *y, const double *x, const double c,
103106 }
104107}
105108
106- static void THDoubleVector_cadd_AVX (double * z , const double * x , const double * y , const double c , const ptrdiff_t n ) {
109+ void THDoubleVector_cadd_AVX (double * z , const double * x , const double * y , const double c , const ptrdiff_t n ) {
107110 ptrdiff_t i ;
108111 __m256d YMM15 = _mm256_set_pd (c , c , c , c );
109112 __m256d YMM0 , YMM1 , YMM2 , YMM3 ;
@@ -119,7 +122,7 @@ static void THDoubleVector_cadd_AVX(double *z, const double *x, const double *y,
119122 }
120123}
121124
122- static void THDoubleVector_adds_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
125+ void THDoubleVector_adds_AVX (double * y , const double * x , const double c , const ptrdiff_t n ) {
123126 ptrdiff_t i ;
124127 __m256d YMM15 = _mm256_set_pd (c , c , c , c );
125128 __m256d YMM0 , YMM1 ;
@@ -136,7 +139,7 @@ static void THDoubleVector_adds_AVX(double *y, const double *x, const double c,
136139 }
137140}
138141
139- static void THFloatVector_copy_AVX (float * y , const float * x , const ptrdiff_t n ) {
142+ void THFloatVector_copy_AVX (float * y , const float * x , const ptrdiff_t n ) {
140143 ptrdiff_t i ;
141144 ptrdiff_t off ;
142145 for (i = 0 ; i <=((n )- 16 ); i += 16 ) {
@@ -149,7 +152,7 @@ static void THFloatVector_copy_AVX(float *y, const float *x, const ptrdiff_t n)
149152 }
150153}
151154
152- static void THFloatVector_fill_AVX (float * x , const float c , const ptrdiff_t n ) {
155+ void THFloatVector_fill_AVX (float * x , const float c , const ptrdiff_t n ) {
153156 ptrdiff_t i ;
154157 ptrdiff_t off ;
155158 __m256 YMM0 = _mm256_set_ps (c , c , c , c , c , c , c , c );
@@ -165,7 +168,7 @@ static void THFloatVector_fill_AVX(float *x, const float c, const ptrdiff_t n) {
165168 }
166169}
167170
168- static void THFloatVector_cdiv_AVX (float * z , const float * x , const float * y , const ptrdiff_t n ) {
171+ void THFloatVector_cdiv_AVX (float * z , const float * x , const float * y , const ptrdiff_t n ) {
169172 ptrdiff_t i ;
170173 __m256 YMM0 , YMM1 , YMM2 , YMM3 ;
171174 for (i = 0 ; i <=((n )- 16 ); i += 16 ) {
@@ -183,7 +186,7 @@ static void THFloatVector_cdiv_AVX(float *z, const float *x, const float *y, con
183186 }
184187}
185188
186- static void THFloatVector_divs_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
189+ void THFloatVector_divs_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
187190 ptrdiff_t i ;
188191 __m256 YMM15 = _mm256_set_ps (c , c , c , c , c , c , c , c );
189192 __m256 YMM0 , YMM1 ;
@@ -200,7 +203,7 @@ static void THFloatVector_divs_AVX(float *y, const float *x, const float c, cons
200203 }
201204}
202205
203- static void THFloatVector_cmul_AVX (float * z , const float * x , const float * y , const ptrdiff_t n ) {
206+ void THFloatVector_cmul_AVX (float * z , const float * x , const float * y , const ptrdiff_t n ) {
204207 ptrdiff_t i ;
205208 __m256 YMM0 , YMM1 , YMM2 , YMM3 ;
206209 for (i = 0 ; i <=((n )- 16 ); i += 16 ) {
@@ -218,7 +221,7 @@ static void THFloatVector_cmul_AVX(float *z, const float *x, const float *y, con
218221 }
219222}
220223
221- static void THFloatVector_muls_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
224+ void THFloatVector_muls_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
222225 ptrdiff_t i ;
223226 __m256 YMM15 = _mm256_set_ps (c , c , c , c , c , c , c , c );
224227 __m256 YMM0 , YMM1 ;
@@ -235,7 +238,7 @@ static void THFloatVector_muls_AVX(float *y, const float *x, const float c, cons
235238 }
236239}
237240
238- static void THFloatVector_cadd_AVX (float * z , const float * x , const float * y , const float c , const ptrdiff_t n ) {
241+ void THFloatVector_cadd_AVX (float * z , const float * x , const float * y , const float c , const ptrdiff_t n ) {
239242 ptrdiff_t i ;
240243 __m256 YMM15 = _mm256_set_ps (c , c , c , c , c , c , c , c );
241244 __m256 YMM0 , YMM1 , YMM2 , YMM3 ;
@@ -251,7 +254,7 @@ static void THFloatVector_cadd_AVX(float *z, const float *x, const float *y, con
251254 }
252255}
253256
254- static void THFloatVector_adds_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
257+ void THFloatVector_adds_AVX (float * y , const float * x , const float c , const ptrdiff_t n ) {
255258 ptrdiff_t i ;
256259 __m256 YMM15 = _mm256_set_ps (c , c , c , c , c , c , c , c );
257260 __m256 YMM0 , YMM1 ;
@@ -267,3 +270,5 @@ static void THFloatVector_adds_AVX(float *y, const float *x, const float c, cons
267270 y [i ] = x [i ] + c ;
268271 }
269272}
273+
274+ #endif // defined(__AVX__)
0 commit comments