#include "timer.h" #ifdef NORESTRICT #define restrict #define __hint__(x) #endif typedef struct vector_t { float x, y, z, w; } vector __attribute__((aligned(16))); void arraystuff ( vector *restrict a, vector *restrict b, int size ) { int i; __hint__((prefetch(a))); __hint__((prefetch(b))); for ( i = 0; i < size ; i++ ) { __hint__((unroll(4))) a[i].x += b[i].x; a[i].y += b[i].y; a[i].z += b[i].z; a[i].w += b[i].w; } } #define SIZE 10000 vector aarray[SIZE], barray[SIZE]; int main ( ) { int a; START_TIMER ( ); for ( a = 0; a < 10000; a++ ) arraystuff ( aarray, barray, SIZE ); STOP_TIMER ( ); return 0; }