"Fossies" - the Fresh Open Source Software Archive

Member "cfe-9.0.0.src/test/OpenMP/taskloop_simd_ast_print.cpp" (27 Mar 2019, 4121 Bytes) of package /linux/misc/cfe-9.0.0.src.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "taskloop_simd_ast_print.cpp": 8.0.1_vs_9.0.0.

    1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s | FileCheck %s
    2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
    3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
    4 
    5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s
    6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
    7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
    8 // expected-no-diagnostics
    9 
   10 #ifndef HEADER
   11 #define HEADER
   12 
   13 void foo() {}
   14 
   15 template <class T, int N>
   16 T tmain(T argc) {
   17   T b = argc, c, d, e, f, g;
   18   T *ptr;
   19   static T a;
   20 // CHECK: static T a;
   21 #pragma omp taskgroup task_reduction(+: d) allocate(d)
   22 #pragma omp taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d)
   23   // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) allocate(d)
   24   // CHECK-NEXT: #pragma omp taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}}
   25   for (int i = 0; i < 2; ++i)
   26     a = 2;
   27 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   28 // CHECK-NEXT: a = 2;
   29 #pragma omp parallel
   30 #pragma omp taskloop simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) shared(g) if (c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
   31   for (int i = 0; i < 2; ++i)
   32     for (int j = 0; j < 2; ++j)
   33       for (int j = 0; j < 2; ++j)
   34         for (int j = 0; j < 2; ++j)
   35           for (int j = 0; j < 2; ++j)
   36   for (int i = 0; i < 2; ++i)
   37     for (int j = 0; j < 2; ++j)
   38       for (int j = 0; j < 2; ++j)
   39         for (int j = 0; j < 2; ++j)
   40           for (int j = 0; j < 2; ++j)
   41             foo();
   42   // CHECK-NEXT: #pragma omp parallel
   43   // CHECK-NEXT: #pragma omp taskloop simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) shared(g) if(c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
   44   // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   45   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   46   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   47   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   48   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   49   // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   50   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   51   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   52   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   53   // CHECK-NEXT: for (int j = 0; j < 2; ++j)
   54   // CHECK-NEXT: foo();
   55   return T();
   56 }
   57 
   58 // CHECK-LABEL: int main(int argc, char **argv) {
   59 int main(int argc, char **argv) {
   60   int b = argc, c, d, e, f, g;
   61   static int a;
   62 // CHECK: static int a;
   63 #pragma omp taskgroup task_reduction(+: d)
   64 #pragma omp taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b), aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d)
   65   // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
   66   // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b) aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d)
   67   for (int i = 0; i < 2; ++i)
   68     a = 2;
   69 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
   70 // CHECK-NEXT: a = 2;
   71 #pragma omp parallel
   72 #pragma omp taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
   73   for (int i = 0; i < 10; ++i)
   74     for (int j = 0; j < 10; ++j)
   75       foo();
   76   // CHECK-NEXT: #pragma omp parallel
   77   // CHECK-NEXT: #pragma omp taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e)
   78   // CHECK-NEXT: for (int i = 0; i < 10; ++i)
   79   // CHECK-NEXT: for (int j = 0; j < 10; ++j)
   80   // CHECK-NEXT: foo();
   81   return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
   82 }
   83 
   84 #endif