Debian Codegraph @

gcc/testsuite/c-c++-common/gomp/dispatch-10.c

raw
1 /* { dg-do compile } */
2 /* { dg-additional-options "-fdump-tree-gimple" } */
3
4 int *f();
5
6 struct t {
7 int *a, *b;
8 };
9
10 void construct(int *x, int *y);
11 void noconstruct(int *x, int *y);
12
13 #pragma omp declare variant(construct) match(construct={dispatch}) adjust_args(need_device_ptr: x,y)
14 #pragma omp declare variant(noconstruct) match(implementation={vendor(gnu)})
15 void bar(int *x, int *y);
16
17 int nocontext, novariant;
18
19 void sub(struct t *s, void *y)
20 {
21 bar( f(), s->b);
22 #pragma omp dispatch device(0) is_device_ptr(s)
23 bar( f(), s->b);
24
25 bar( (int *) y, s->b);
26 #pragma omp dispatch device(0) is_device_ptr(y)
27 bar( (int *) y, s->b);
28 }
29
30 /* { dg-final { scan-tree-dump-times "__builtin_omp_get_default_device" 2 "gimple" } } */
31 /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device" 4 "gimple" } } */
32 /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(0\\);" 2 "gimple" } } */
33 /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\\.\[0-9\]+\\);" 2 "gimple" } } */
34 /* { dg-final { scan-tree-dump-times "__builtin_omp_get_mapped_ptr" 3 "gimple" } } */
35 /* { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = s->b;\[\r\n\]* *D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(D\\.\[0-9\]+, 0\\);" 2 "gimple" } } */
36 /* { dg-final { scan-tree-dump-times "D\\.\[0-9\]+ = f \\(\\);\[\r\n\]* *D\\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(D\\.\[0-9\]+, 0\\);" 1 "gimple" } } */