Skip to content

Commit 22589e0

Browse files
author
Boris Kosmynin
committed
Test for referred functions
1 parent 220cc9b commit 22589e0

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
typedef char data_t;
3+
typedef int calc_t;
4+
5+
static inline calc_t ffirst(calc_t first, calc_t second)
6+
{
7+
return first;
8+
}
9+
10+
static inline calc_t fsecond(calc_t first, calc_t second)
11+
{
12+
return second;
13+
}
14+
15+
static inline data_t falpha(data_t a)
16+
{
17+
return a;
18+
}
19+
20+
static int bar(int first, int second, data_t a){
21+
calc_t one = ffirst((calc_t)first,(calc_t)second);
22+
calc_t two = fsecond((calc_t)first,(calc_t)second);
23+
data_t alpha = falpha(a);
24+
25+
return (int)(one + two + alpha);
26+
}
27+
28+
#pragma omp declare target
29+
static void foo(int first, int second, data_t a){
30+
#pragma omp parallel for
31+
for (int i=0; i<10; ++i){
32+
bar(first,second,a);
33+
}
34+
}
35+
#pragma omp end declare target
36+
37+
int main(){
38+
39+
calc_t i=0;
40+
calc_t j=0;
41+
data_t var='a';
42+
43+
#pragma omp parallel
44+
{
45+
foo(i,j,var);
46+
}
47+
48+
return 0;
49+
}

0 commit comments

Comments
 (0)