2020-03-20 19:03:01 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
void foo() {}
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
T tmain(T argc) {
|
|
|
|
static T a;
|
2020-03-27 23:27:04 +08:00
|
|
|
#pragma omp for reduction(inscan, +: a)
|
2020-03-20 19:03:01 +08:00
|
|
|
for (int i = 0; i < 10; ++i) {
|
2020-03-20 21:41:22 +08:00
|
|
|
#pragma omp scan inclusive(a)
|
2020-03-20 19:03:01 +08:00
|
|
|
}
|
|
|
|
return a + argc;
|
|
|
|
}
|
|
|
|
// CHECK: static T a;
|
2020-03-27 23:27:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
|
2020-03-20 21:41:22 +08:00
|
|
|
// CHECK-NEXT: #pragma omp scan inclusive(a){{$}}
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK: static int a;
|
2020-03-27 23:27:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
|
2020-03-20 21:41:22 +08:00
|
|
|
// CHECK-NEXT: #pragma omp scan inclusive(a)
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK: static char a;
|
2020-03-27 23:27:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for reduction(inscan, +: a)
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
|
2020-03-20 21:41:22 +08:00
|
|
|
// CHECK-NEXT: #pragma omp scan inclusive(a)
|
2020-03-20 19:03:01 +08:00
|
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
static int a;
|
|
|
|
// CHECK: static int a;
|
2020-03-27 23:27:04 +08:00
|
|
|
#pragma omp parallel
|
|
|
|
#pragma omp for simd reduction(inscan, ^: a, argc)
|
2020-03-20 19:03:01 +08:00
|
|
|
for (int i = 0; i < 10; ++i) {
|
2020-03-23 22:41:08 +08:00
|
|
|
#pragma omp scan exclusive(a, argc)
|
2020-03-20 19:03:01 +08:00
|
|
|
}
|
2020-03-27 23:27:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp parallel
|
|
|
|
// CHECK-NEXT: #pragma omp for simd reduction(inscan, ^: a,argc)
|
2020-03-20 19:03:01 +08:00
|
|
|
// CHECK-NEXT: for (int i = 0; i < 10; ++i) {
|
2020-03-23 22:41:08 +08:00
|
|
|
// CHECK-NEXT: #pragma omp scan exclusive(a,argc){{$}}
|
2020-03-20 19:03:01 +08:00
|
|
|
return tmain(argc) + tmain(argv[0][0]) + a;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|