Newer
Older
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
//by Branislav Jansik, @IT4Innovations, 2014
#include <stdio.h>
int main(void) {
#define REPEAT10(x) x x x x x x x x x x
double x[8] __attribute__((aligned(64))) = {1.0,0.0,0.0,1.0,1.2,0.9,0.1,0.2};
double y[8] __attribute__((aligned(64))) = {0.0,1.0,1.1,1.0,1.1,0.8,0.1,0.2};
double z[8] __attribute__((aligned(64))) = {0.0,0.0,0.0,1.0,1.3,0.9,0.2,0.2};
double dx[8] __attribute__((aligned(64)));
double dy[8] __attribute__((aligned(64)));
double dz[8] __attribute__((aligned(64)));
double p[4] __attribute__((aligned(64))) = {10.0,28.0,8.0/3.0,1e-6};
register long int i;
register int j;
for (i=0; i<1000000000; i+=10) {
REPEAT10(
for (j=0; j<8; j++) {
dx[j] = p[0]*(y[j]-x[j]);
dy[j] = x[j]*(p[1]-z[j]) - y[j];
dz[j] = x[j]*y[j]-p[2]*z[j];
x[j] += p[3]*dx[j];
y[j] += p[3]*dy[j];
z[j] += p[3]*dz[j];
}
)
}
printf("Outputs:\n");
printf("x: %f %f %f %f %f %f %f %f\n", x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7]);
printf("y: %f %f %f %f %f %f %f %f\n", y[0], y[1], y[2], y[3], y[4], y[5], y[6], y[7]);
printf("z: %f %f %f %f %f %f %f %f\n", z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7]);
return 0;
}