| 1 |
void add90 (TYPE a[restrict N], TYPE b[restrict N], TYPE c[restrict N]) |
| 2 |
{ |
| 3 |
#if defined (UNROLL) |
| 4 |
#pragma GCC unroll 16 |
| 5 |
#endif |
| 6 |
for (int i=0; i < N; i+=2) |
| 7 |
{ |
| 8 |
c[i] = a[i] - b[i+1]; |
| 9 |
c[i+1] = a[i+1] + b[i]; |
| 10 |
} |
| 11 |
} |
| 12 |
|
| 13 |
/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */ |
| 14 |
|
| 15 |
void add270 (TYPE a[restrict N], TYPE b[restrict N], TYPE c[restrict N]) |
| 16 |
{ |
| 17 |
#if defined (UNROLL) |
| 18 |
#pragma GCC unroll 16 |
| 19 |
#endif |
| 20 |
for (int i=0; i < N; i+=2) |
| 21 |
{ |
| 22 |
c[i] = a[i] + b[i+1]; |
| 23 |
c[i+1] = a[i+1] - b[i]; |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT270" 1 "vect" } } */ |
| 28 |
|
| 29 |
void addMixed (TYPE a[restrict N], TYPE b[restrict N], TYPE c[restrict N]) |
| 30 |
{ |
| 31 |
#if defined (UNROLL) |
| 32 |
#pragma GCC unroll 16 |
| 33 |
#endif |
| 34 |
for (int i=0; i < N; i+=4) |
| 35 |
{ |
| 36 |
c[i] = a[i] - b[i+1]; |
| 37 |
c[i+1] = a[i+1] + b[i]; |
| 38 |
c[i+2] = a[i+2] + b[i+3]; |
| 39 |
c[i+3] = a[i+3] - b[i+2]; |
| 40 |
} |
| 41 |
} |
| 42 |
|
| 43 |
void add90HandUnrolled (TYPE a[restrict N], TYPE b[restrict N], |
| 44 |
TYPE c[restrict N]) |
| 45 |
{ |
| 46 |
#if defined (UNROLL) |
| 47 |
#pragma GCC unroll 16 |
| 48 |
#endif |
| 49 |
for (int i=0; i < (N /2); i+=4) |
| 50 |
{ |
| 51 |
c[i] = a[i] - b[i+1]; |
| 52 |
c[i+2] = a[i+2] - b[i+3]; |
| 53 |
c[i+1] = a[i+1] + b[i]; |
| 54 |
c[i+3] = a[i+3] + b[i+2]; |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 1 "vect" } } */ |
| 59 |
|
| 60 |
void add90Hybrid (TYPE a[restrict N], TYPE b[restrict N], TYPE c[restrict N], |
| 61 |
TYPE d[restrict N]) |
| 62 |
{ |
| 63 |
#if defined (UNROLL) |
| 64 |
#pragma GCC unroll 16 |
| 65 |
#endif |
| 66 |
for (int i=0; i < N; i+=2) |
| 67 |
{ |
| 68 |
c[i] = a[i] - b[i+1]; |
| 69 |
c[i+1] = a[i+1] + b[i]; |
| 70 |
d[i] = a[i] - b[i]; |
| 71 |
d[i+1] = a[i+1] - b[i+1]; |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
/* { dg-final { scan-tree-dump-times "stmt.*COMPLEX_ADD_ROT90" 2 "vect" } } */ |