Debian Codegraph @

gcc/testsuite/g++.dg/gomp/append-args-5.C

raw
1 /* { dg-additional-options "-fdump-tree-gimple" } */
2
3 /* Check that adjust_args applies to the right argument,
4 if C++ inserts a 'this' pointer. */
5
6 #if __cplusplus >= 201103L
7 # define __GOMP_UINTPTR_T_ENUM : __UINTPTR_TYPE__
8 #else
9 # define __GOMP_UINTPTR_T_ENUM
10 #endif
11
12 typedef enum omp_interop_t __GOMP_UINTPTR_T_ENUM
13 {
14 omp_interop_none = 0,
15 __omp_interop_t_max__ = __UINTPTR_MAX__
16 } omp_interop_t;
17
18
19 struct t1 {
20 void f1(int *x, int *y, int *z, omp_interop_t);
21 #pragma omp declare variant(f1) match(construct={dispatch}) \
22 adjust_args(need_device_ptr : y) \
23 append_args( interop(target))
24 void g1(int *x, int *y, int *z);
25 };
26
27 struct t2 {
28 void f2(int *x, int *y, int *z, omp_interop_t, ...);
29 #pragma omp declare variant(f2) match(construct={dispatch}) \
30 adjust_args(need_device_ptr : x, y, z) \
31 append_args( interop(prefer_type("cuda","hip","hsa"),target, targetsync))
32 void g2(int *x, int *y, int *z, ...);
33 };
34
35
36 omp_interop_t obj1, obj2;
37
38 void test(int *a1, int *b1, int *c1,
39 int *a2, int *b2, int *c2,
40 int *a3, int *b3, int *c3,
41 int *x1, int *x2, int *x3,
42 int *y1, int *y2, int *y3)
43 {
44 struct t1 s1;
45 struct t2 s2;
46
47 #pragma omp dispatch interop(obj1)
48 s1.g1 (a1, b1, c1);
49
50 #pragma omp dispatch interop(obj2) device(5)
51 s2.g2 (a2, b2, c2, y1, y2, y3);
52 }
53
54
55 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_default_device \\(\\);" 2 "gimple" } } */
56
57 /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(D\.\[0-9\]+\\);" 3 "gimple" } } */
58 /* { dg-final { scan-tree-dump-times "__builtin_omp_set_default_device \\(5\\);" 1 "gimple" } } */
59
60 /* { dg-final { scan-tree-dump-times "obj1.\[0-9\] = obj1;" 2 "gimple" } } */
61 /* { dg-final { scan-tree-dump-times "obj2.\[0-9\] = obj2;" 1 "gimple" } } */
62
63 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_interop_int \\(obj1.\[0-9\], -5, 0B\\);" 1 "gimple" } } */
64
65 /* { dg-final { scan-tree-dump-times "__builtin_omp_get_mapped_ptr" 4 "gimple" } } */
66 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(b1, D\.\[0-9\]+\\);" 1 "gimple" } } */
67 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(c2, 5\\);" 1 "gimple" } } */
68 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(b2, 5\\);" 1 "gimple" } } */
69 /* { dg-final { scan-tree-dump-times "D\.\[0-9\]+ = __builtin_omp_get_mapped_ptr \\(a2, 5\\);" 1 "gimple" } } */
70
71 /* { dg-final { scan-tree-dump-times "t1::f1 \\(&s1, a1, D\.\[0-9\]+, c1, obj1.\[0-9\]\\);" 1 "gimple" } } */
72 /* { dg-final { scan-tree-dump-times "t2::f2 \\(&s2, D\.\[0-9\]+, D\.\[0-9\]+, D\.\[0-9\]+, obj2.\[0-9\], y1, y2, y3\\);" 1 "gimple" } } */