3 /* Integer reductions. */
13 test_reductions (void)
19 for (i
= 0; i
< n
; i
++)
22 /* Gang reductions. */
23 check_reduction_op (int, +, 0, array
[i
], num_gangs (ng
), gang
);
24 check_reduction_op (int, *, 1, array
[i
], num_gangs (ng
), gang
);
25 check_reduction_op (int, &, -1, array
[i
], num_gangs (ng
), gang
);
26 check_reduction_op (int, |, 0, array
[i
], num_gangs (ng
), gang
);
27 check_reduction_op (int, ^, 0, array
[i
], num_gangs (ng
), gang
);
29 /* Worker reductions. */
30 check_reduction_op (int, +, 0, array
[i
], num_workers (nw
), worker
);
31 check_reduction_op (int, *, 1, array
[i
], num_workers (nw
), worker
);
32 check_reduction_op (int, &, -1, array
[i
], num_workers (nw
), worker
);
33 check_reduction_op (int, |, 0, array
[i
], num_workers (nw
), worker
);
34 check_reduction_op (int, ^, 0, array
[i
], num_workers (nw
), worker
);
36 /* Vector reductions. */
37 check_reduction_op (int, +, 0, array
[i
], vector_length (vl
), vector
);
38 check_reduction_op (int, *, 1, array
[i
], vector_length (vl
), vector
);
39 check_reduction_op (int, &, -1, array
[i
], vector_length (vl
), vector
);
40 check_reduction_op (int, |, 0, array
[i
], vector_length (vl
), vector
);
41 check_reduction_op (int, ^, 0, array
[i
], vector_length (vl
), vector
);
43 /* Combined reductions. */
44 check_reduction_op (int, +, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
45 vector_length (vl
), gang worker vector
);
46 check_reduction_op (int, *, 1, array
[i
], num_gangs (ng
) num_workers (nw
)
47 vector_length (vl
), gang worker vector
);
48 check_reduction_op (int, &, -1, array
[i
], num_gangs (ng
) num_workers (nw
)
49 vector_length (vl
), gang worker vector
);
50 check_reduction_op (int, |, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
51 vector_length (vl
), gang worker vector
);
52 check_reduction_op (int, ^, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
53 vector_length (vl
), gang worker vector
);
57 test_reductions_bool (void)
64 for (i
= 0; i
< n
; i
++)
69 /* Gang reductions. */
70 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_gangs (ng
),
72 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_gangs (ng
),
75 /* Worker reductions. */
76 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_workers (nw
),
78 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_workers (nw
),
81 /* Vector reductions. */
82 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), vector_length (vl
),
84 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), vector_length (vl
),
87 /* Combined reductions. */
88 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_gangs (ng
)
89 num_workers (nw
) vector_length (vl
), gang worker vector
);
90 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_gangs (ng
)
91 num_workers (nw
) vector_length (vl
), gang worker vector
);
95 test_reductions_minmax (void)
101 for (i
= 0; i
< n
; i
++)
104 /* Gang reductions. */
105 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_gangs (ng
), gang
);
106 check_reduction_macro (int, max
, -1, array
[i
], num_gangs (ng
), gang
);
108 /* Worker reductions. */
109 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_workers (nw
), worker
);
110 check_reduction_macro (int, max
, -1, array
[i
], num_workers (nw
), worker
);
112 /* Vector reductions. */
113 check_reduction_macro (int, min
, n
+ 1, array
[i
], vector_length (vl
),
115 check_reduction_macro (int, max
, -1, array
[i
], vector_length (vl
), vector
);
117 /* Combined reductions. */
118 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_gangs (ng
)
119 num_workers (nw
) vector_length (vl
), gang worker
121 check_reduction_macro (int, max
, -1, array
[i
], num_gangs (ng
)
122 num_workers (nw
) vector_length (vl
), gang worker
130 test_reductions_bool ();
131 test_reductions_minmax ();