aboutsummaryrefslogtreecommitdiff
path: root/clang/test/OpenMP/target_default_ast.cpp
blob: 73bc8e525e29bdbad1752e9c518ff7e51820ce37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
// expected-no-diagnostics

//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \
//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \
//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \
//RUN:   -ast-print %s | FileCheck %s --check-prefix=PRINT

//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \
//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \
//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \
//RUN:   -ast-dump %s | FileCheck %s --check-prefix=DUMP

//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \
//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \
//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \
//RUN:   -emit-pch -o %t %s

//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \
//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \
//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \
//RUN:   -include-pch %t -ast-print %s | FileCheck %s --check-prefix=PRINT

//RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fopenmp -fopenmp-version=60 \
//RUN:   -x c++ -std=c++14 -fexceptions -fcxx-exceptions                   \
//RUN:   -Wno-source-uses-openmp -Wno-openmp-clauses                       \
//RUN:   -include-pch %t -ast-dump-all %s | FileCheck %s --check-prefix=DUMP

#ifndef HEADER
#define HEADER

void foo() {
  int a;
#pragma omp target default(firstprivate)
  a++;
  // PRINT: #pragma omp target default(firstprivate)
  // PRINT-NEXT: a++;
  // DUMP: -OMPTargetDirective
  // DUMP-NEXT:  -OMPDefaultClause
  // DUMP-NEXT:  -OMPFirstprivateClause {{.*}} <implicit>
  // DUMP-NEXT:   -DeclRefExpr {{.*}} 'a'

}
void fun(){
int a = 0;
    int x = 10;
    #pragma omp target data default(firstprivate) map(a)
    {
  // DUMP: -OMPTargetDataDirective
  // DUMP-NEXT: -OMPDefaultClause
  // DUMP-NEXT: -OMPMapClause
  // DUMP-NEXT:  -DeclRefExpr {{.*}} 'a'
  // DUMP-NEXT: -OMPFirstprivateClause {{.*}} <implicit>
  // DUMP-NEXT:  -DeclRefExpr {{.*}} 'x'


        x += 10;
        a += 1;
    }
}
void bar(){
int i = 0;
int j = 0;
int  nn = 10;
#pragma omp target default(firstprivate)
#pragma omp teams 
#pragma teams distribute parallel for simd 
        for (j = 0; j < nn; j++ ) {
          for (i = 0; i < nn; i++ ) {
                ;
          }
        }

  // PRINT: #pragma omp target default(firstprivate)
  // DUMP: -OMPTargetDirective
  // DUMP-NEXT: -OMPDefaultClause
  // DUMP-NEXT: -OMPFirstprivateClause {{.*}} <implicit>
  // DUMP-NEXT: -DeclRefExpr {{.*}} 'j'
  // DUMP-NEXT: -DeclRefExpr {{.*}} 'nn'
  // DUMP-NEXT: -DeclRefExpr {{.*}} 'i'
}
#endif