Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/time.h>
- #include <stdlib.h>
- #include <stdio.h>
- #include <math.h>
- #include <strings.h>
- #include "test2.h"
- double gettime ()
- {
- struct timeval tv;
- gettimeofday (&tv, NULL);
- return (double)tv.tv_sec + (0.000001 * (double)tv.tv_usec);
- }
- #define N 400000000
- int main ()
- {
- float z = sqrtf(2)/2;
- float a[4] __attribute__((aligned(16))) = {z,z,0,0};
- float (*b)[4] = aligned_alloc (16, 4*N*sizeof(float));
- int i;
- for (i=0; i<N; i++)
- {
- bzero (b[i], 16);
- b[i][i%3] = 4;
- }
- double time = gettime();
- for (i=0; i<N; i++)
- {
- #if 0
- b[i][0] = 0;
- #endif
- rotate_vector (a,b[i],b[i]);
- }
- time = gettime() - time;
- printf ("%f %f %f\n", b[0][0], b[0][1], b[0][2]);
- printf ("%f\n", time);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement