brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.8 KiB · 0fbc0e1 Raw
197 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP452// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s3// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP454// RUN: %clang_cc1 -verify -fopenmp -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP505// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP56// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP507 8// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP519// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5110// RUN: %clang_cc1 -fopenmp -fopenmp-version=60 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5111 12// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5113// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5114// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5115// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5216// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5217// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5218 19// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP4520// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s21// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP4522// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5023// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP524// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5025// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5126// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5127// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5128// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=60 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5129// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=60 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5130// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=60 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5131// expected-no-diagnostics32// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5233// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5234// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP5235// expected-no-diagnostics36 37#ifndef HEADER38#define HEADER39 40struct S {41  S(): a(0) {}42  S(int v) : a(v) {}43  int a;44  typedef int type;45};46 47template <typename T>48class S7 : public T {49protected:50  T a;51  S7() : a(0) {}52 53public:54  S7(typename T::type v) : a(v) {55#pragma omp target56#pragma omp teams57#pragma omp distribute simd private(a) private(this->a) private(T::a) allocate(T::a)58    for (int k = 0; k < a.a; ++k)59      ++this->a.a;60  }61  S7 &operator=(S7 &s) {62#pragma omp target63#pragma omp teams64#pragma omp distribute simd allocate(a) private(a) private(this->a)65    for (int k = 0; k < s.a.a; ++k)66      ++s.a.a;67    return *this;68  }69};70 71// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) allocate(T::a){{$}}72// CHECK: #pragma omp distribute simd allocate(this->a) private(this->a) private(this->a)73// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) allocate(this->S::a)74 75class S8 : public S7<S> {76  S8() {}77 78public:79  S8(int v) : S7<S>(v){80#pragma omp target81#pragma omp teams82#pragma omp distribute simd private(a) private(this->a) private(S7<S>::a)83    for (int k = 0; k < a.a; ++k)84      ++this->a.a;85  }86  S8 &operator=(S8 &s) {87#pragma omp target88#pragma omp teams89#pragma omp distribute simd private(a) private(this->a)90    for (int k = 0; k < s.a.a; ++k)91      ++s.a.a;92    return *this;93  }94};95 96// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S7<S>::a)97// CHECK: #pragma omp distribute simd private(this->a) private(this->a)98 99template <class T, int N>100T tmain(T argc) {101  T b = argc, c, d, e, f, h;102  static T a;103// CHECK: static T a;104  static T g;105#pragma omp threadprivate(g)106 107#pragma omp target108#pragma omp teams109#pragma omp distribute simd dist_schedule(static, a) firstprivate(a)110  for (int i = 0; i < 2; ++i)111    a = 2;112// CHECK: #pragma omp distribute simd dist_schedule(static, a) firstprivate(a)113// CHECK-NEXT: for (int i = 0; i < 2; ++i)114// CHECK-NEXT: a = 2;115 116#pragma omp target117#pragma omp teams118#pragma omp distribute simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) reduction(+ : h) dist_schedule(static,N)119  for (int i = 0; i < 2; ++i)120    for (int j = 0; j < 2; ++j)121      for (int k = 0; k < 10; ++k)122        for (int m = 0; m < 10; ++m)123          for (int n = 0; n < 10; ++n)124            a++;125// CHECK: #pragma omp distribute simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) reduction(+: h) dist_schedule(static, N)126// CHECK-NEXT: for (int i = 0; i < 2; ++i)127// CHECK-NEXT: for (int j = 0; j < 2; ++j)128// CHECK-NEXT: for (int k = 0; k < 10; ++k)129// CHECK-NEXT: for (int m = 0; m < 10; ++m)130// CHECK-NEXT: for (int n = 0; n < 10; ++n)131// CHECK-NEXT: a++;132  return T();133}134 135int main(int argc, char **argv) {136  int b = argc, c, d, e, f, h;137  int x[200];138  static int a;139// CHECK: static int a;140  static float g;141#pragma omp threadprivate(g)142 143#pragma omp target144#pragma omp teams145#pragma omp distribute simd dist_schedule(static, a) private(a)146  for (int i = 0; i < 2; ++i)147    a = 2;148// CHECK: #pragma omp distribute simd  dist_schedule(static, a) private(a)149// CHECK-NEXT: for (int i = 0; i < 2; ++i)150// CHECK-NEXT: a = 2;151 152#pragma omp target153#pragma omp teams154#ifdef OMP5155#pragma omp distribute simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) reduction(+ : h) dist_schedule(static, b) if(simd:argc)156#else157#pragma omp distribute simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) reduction(+ : h) dist_schedule(static, b)158#endif // OMP5159  for (int i = 0; i < 10; ++i)160    for (int j = 0; j < 10; ++j)161            a++;162// OMP45: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)163// OMP50: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b) if(simd: argc)164// OMP51: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)165// OMP52: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b)166// CHECK-NEXT: for (int i = 0; i < 10; ++i)167// CHECK-NEXT: for (int j = 0; j < 10; ++j)168// CHECK-NEXT: a++;169 170  int i;171#pragma omp target172#pragma omp teams173#ifdef OMP52174#pragma omp distribute simd aligned(x:8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(reproducible:concurrent)175#elif OMP51176#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(reproducible:concurrent)177#elif OMP5178#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(concurrent)179#else180#pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)181#endif // OMP51182  for (i = 0; i < 100; i++)183    for (int j = 0; j < 200; j++)184      a += h + x[j];185// OMP45: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8)186// OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(concurrent)187// OMP51: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent)188// OMP52: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent)189// CHECK-NEXT: for (i = 0; i < 100; i++)190// CHECK-NEXT: for (int j = 0; j < 200; j++)191// CHECK-NEXT: a += h + x[j];192 193  return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));194}195 196#endif197