PR c/81417
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / reduction.h
blob1b3f8d45ace50d40d035c026b891644c41f43b77
1 #ifndef REDUCTION_H
2 #define REDUCTION_H
4 #define DO_PRAGMA(x) _Pragma (#x)
6 #define check_reduction_op(type, op, init, b, gwv_par, gwv_loop) \
7 { \
8 type res, vres; \
9 res = (init); \
10 DO_PRAGMA (acc parallel gwv_par copy (res)) \
11 DO_PRAGMA (acc loop gwv_loop reduction (op:res)) \
12 for (i = 0; i < n; i++) \
13 res = res op (b); \
15 vres = (init); \
16 for (i = 0; i < n; i++) \
17 vres = vres op (b); \
19 if (res != vres) \
20 abort (); \
23 #define check_reduction_macro(type, op, init, b, gwv_par, gwv_loop) \
24 { \
25 type res, vres; \
26 res = (init); \
27 DO_PRAGMA (acc parallel gwv_par copy(res)) \
28 DO_PRAGMA (acc loop gwv_loop reduction (op:res)) \
29 for (i = 0; i < n; i++) \
30 res = op (res, (b)); \
32 vres = (init); \
33 for (i = 0; i < n; i++) \
34 vres = op (vres, (b)); \
36 if (res != vres) \
37 abort (); \
40 #define max(a, b) (((a) > (b)) ? (a) : (b))
41 #define min(a, b) (((a) < (b)) ? (a) : (b))
43 #endif