Use move-aware auto_vec in map
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / reduction-5.c
blobddccfe89e73c9ff33aee48c4f7a8c4d27974d70e
1 /* { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
2 aspects of that functionality. */
4 /* Multiple reductions. */
6 #include <stdio.h>
7 #include <stdlib.h>
9 #define ng 8
10 #define nw 4
11 #define vl 32
13 const int n = 100;
15 #define DO_PRAGMA(x) _Pragma (#x) /* { dg-line pragma_loc } */
17 #define check_reduction(gwv_par, gwv_loop) \
18 { \
19 s1 = 2; s2 = 5; \
20 DO_PRAGMA (acc parallel gwv_par copy (s1, s2)) /* { dg-line DO_PRAGMA_loc } */ \
21 DO_PRAGMA (acc loop gwv_loop reduction (+:s1, s2)) \
22 for (i = 0; i < n; i++) \
23 { \
24 s1 = s1 + 3; \
25 s2 = s2 + 5; \
26 } \
28 if (s1 != v1 && s2 != v2) \
29 abort (); \
32 int
33 main (void)
35 int s1 = 2, s2 = 5, v1 = 2, v2 = 5;
36 int i;
38 for (i = 0; i < n; i++)
40 v1 = v1 + 3;
41 v2 = v2 + 2;
44 check_reduction (num_gangs (ng), gang);
46 /* Nvptx targets require a vector_length or 32 in to allow spinlocks with
47 gangs. */
48 check_reduction (num_workers (nw) vector_length (vl), worker); /* { dg-line check_reduction_loc } */
49 /* { dg-warning "22:region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } pragma_loc }
50 { dg-note "1:in expansion of macro 'DO_PRAGMA'" "" { target *-*-* xfail offloading_enabled } DO_PRAGMA_loc }
51 { dg-note "3:in expansion of macro 'check_reduction'" "" { target *-*-* xfail offloading_enabled } check_reduction_loc }
52 TODO See PR101551 for 'offloading_enabled' XFAILs. */
53 check_reduction (vector_length (vl), vector);
54 check_reduction (num_gangs (ng) num_workers (nw) vector_length (vl), gang
55 worker vector);
57 return 0;