| 1 |
/* { dg-do run { target { ! { hppa*-*-hpux* } } } } */ |
| 2 |
|
| 3 |
/* complex reductions. */ |
| 4 |
|
| 5 |
#include <stdlib.h> |
| 6 |
#include <complex.h> |
| 7 |
#include "reduction.h" |
| 8 |
|
| 9 |
#define ng 8 |
| 10 |
#define nw 4 |
| 11 |
#define vl 32 |
| 12 |
|
| 13 |
static void |
| 14 |
test_reductions (void) |
| 15 |
{ |
| 16 |
const int n = 10; |
| 17 |
int i; |
| 18 |
double _Complex array[n]; |
| 19 |
|
| 20 |
for (i = 0; i < n; i++) |
| 21 |
array[i] = i+1; |
| 22 |
|
| 23 |
/* Gang reductions. */ |
| 24 |
check_reduction_op (double, +, 0, creal (array[i]), num_gangs (ng), gang); |
| 25 |
check_reduction_op (double, *, 1, creal (array[i]), num_gangs (ng), gang); |
| 26 |
|
| 27 |
/* Worker reductions. */ |
| 28 |
check_reduction_op (double, +, 0, creal (array[i]), num_workers (nw), |
| 29 |
worker); |
| 30 |
check_reduction_op (double, *, 1, creal (array[i]), num_workers (nw), |
| 31 |
worker); |
| 32 |
|
| 33 |
/* Vector reductions. */ |
| 34 |
check_reduction_op (double, +, 0, creal (array[i]), vector_length (vl), |
| 35 |
vector); |
| 36 |
check_reduction_op (double, *, 1, creal (array[i]), vector_length (vl), |
| 37 |
vector); |
| 38 |
|
| 39 |
/* Combined reductions. */ |
| 40 |
check_reduction_op (double, +, 0, creal (array[i]), num_gangs (ng) |
| 41 |
num_workers (nw) vector_length (vl), gang worker |
| 42 |
vector); |
| 43 |
check_reduction_op (double, *, 1, creal (array[i]), num_gangs (ng) |
| 44 |
num_workers (nw) vector_length (vl), gang worker |
| 45 |
vector); |
| 46 |
} |
| 47 |
|
| 48 |
int |
| 49 |
main (void) |
| 50 |
{ |
| 51 |
test_reductions (); |
| 52 |
return 0; |
| 53 |
} |