File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
DirectProgramming/C++/CompilerInfrastructure/Intrinsics/src Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 30
30
*
31
31
*/
32
32
#include < immintrin.h>
33
+ #include < omp.h>
33
34
#include < pmmintrin.h>
34
35
#include < stdio.h>
35
- #include < omp.h>
36
36
37
37
#define SIZE 24 // assumes size is a multiple of 8 because
38
38
// Intel(R) AVX registers will store 8, 32bit elements.
@@ -117,7 +117,7 @@ float dot_product(float *a, float *b) {
117
117
float dot_product_SIMD (float *a, float *b) {
118
118
int i;
119
119
int sum = 0 ;
120
- #pragma omp simd reduction(+: sum)
120
+ #pragma omp simd reduction(+ : sum)
121
121
for (i = 0 ; i < SIZE; i++) {
122
122
sum += a[i] * b[i];
123
123
}
@@ -211,7 +211,7 @@ float dot_product_intrin(float *a, float *b) {
211
211
b +
212
212
i); // loads unaligned array b into num2 num2= b[3] b[2] b[1] b[0]
213
213
num3 = _mm_mul_ps (num1, num2); // performs multiplication num3 =
214
- // a[3]*b[3] a[2]*b[2] a[1]*b[1] a[0]*b[0]
214
+ // a[3]*b[3] a[2]*b[2] a[1]*b[1] a[0]*b[0]
215
215
num3 = _mm_hadd_ps (num3, num3); // performs horizontal addition
216
216
// num3= a[3]*b[3]+ a[2]*b[2] a[1]*b[1]+a[0]*b[0] a[3]*b[3]+ a[2]*b[2]
217
217
// a[1]*b[1]+a[0]*b[0]
You can’t perform that action at this time.
0 commit comments