File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
clang/tools/sotoc/test/declare_target Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 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+ }
You can’t perform that action at this time.
0 commit comments