3 /* Ignore vector_length warnings for offloaded (nvptx) targets. */
4 /* { dg-additional-options "-foffload=-w" } */
6 /* Integer reductions. */
16 test_reductions (void)
22 for (i
= 0; i
< n
; i
++)
25 /* Gang reductions. */
26 check_reduction_op (int, +, 0, array
[i
], num_gangs (ng
), gang
);
27 check_reduction_op (int, *, 1, array
[i
], num_gangs (ng
), gang
);
28 check_reduction_op (int, &, -1, array
[i
], num_gangs (ng
), gang
);
29 check_reduction_op (int, |, 0, array
[i
], num_gangs (ng
), gang
);
30 check_reduction_op (int, ^, 0, array
[i
], num_gangs (ng
), gang
);
32 /* Worker reductions. */
33 check_reduction_op (int, +, 0, array
[i
], num_workers (nw
), worker
);
34 check_reduction_op (int, *, 1, array
[i
], num_workers (nw
), worker
);
35 check_reduction_op (int, &, -1, array
[i
], num_workers (nw
), worker
);
36 check_reduction_op (int, |, 0, array
[i
], num_workers (nw
), worker
);
37 check_reduction_op (int, ^, 0, array
[i
], num_workers (nw
), worker
);
39 /* Vector reductions. */
40 check_reduction_op (int, +, 0, array
[i
], vector_length (vl
), vector
);
41 check_reduction_op (int, *, 1, array
[i
], vector_length (vl
), vector
);
42 check_reduction_op (int, &, -1, array
[i
], vector_length (vl
), vector
);
43 check_reduction_op (int, |, 0, array
[i
], vector_length (vl
), vector
);
44 check_reduction_op (int, ^, 0, array
[i
], vector_length (vl
), vector
);
46 /* Combined reductions. */
47 check_reduction_op (int, +, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
48 vector_length (vl
), gang worker vector
);
49 check_reduction_op (int, *, 1, array
[i
], num_gangs (ng
) num_workers (nw
)
50 vector_length (vl
), gang worker vector
);
51 check_reduction_op (int, &, -1, array
[i
], num_gangs (ng
) num_workers (nw
)
52 vector_length (vl
), gang worker vector
);
53 check_reduction_op (int, |, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
54 vector_length (vl
), gang worker vector
);
55 check_reduction_op (int, ^, 0, array
[i
], num_gangs (ng
) num_workers (nw
)
56 vector_length (vl
), gang worker vector
);
60 test_reductions_bool (void)
67 for (i
= 0; i
< n
; i
++)
72 /* Gang reductions. */
73 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_gangs (ng
),
75 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_gangs (ng
),
78 /* Worker reductions. */
79 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_workers (nw
),
81 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_workers (nw
),
84 /* Vector reductions. */
85 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), vector_length (vl
),
87 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), vector_length (vl
),
90 /* Combined reductions. */
91 check_reduction_op (int, &&, 1, (cmp_val
> array
[i
]), num_gangs (ng
)
92 num_workers (nw
) vector_length (vl
), gang worker vector
);
93 check_reduction_op (int, ||, 0, (cmp_val
> array
[i
]), num_gangs (ng
)
94 num_workers (nw
) vector_length (vl
), gang worker vector
);
98 test_reductions_minmax (void)
104 for (i
= 0; i
< n
; i
++)
107 /* Gang reductions. */
108 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_gangs (ng
), gang
);
109 check_reduction_macro (int, max
, -1, array
[i
], num_gangs (ng
), gang
);
111 /* Worker reductions. */
112 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_workers (nw
), worker
);
113 check_reduction_macro (int, max
, -1, array
[i
], num_workers (nw
), worker
);
115 /* Vector reductions. */
116 check_reduction_macro (int, min
, n
+ 1, array
[i
], vector_length (vl
),
118 check_reduction_macro (int, max
, -1, array
[i
], vector_length (vl
), vector
);
120 /* Combined reductions. */
121 check_reduction_macro (int, min
, n
+ 1, array
[i
], num_gangs (ng
)
122 num_workers (nw
) vector_length (vl
), gang worker
124 check_reduction_macro (int, max
, -1, array
[i
], num_gangs (ng
)
125 num_workers (nw
) vector_length (vl
), gang worker
133 test_reductions_bool ();
134 test_reductions_minmax ();