2015-05-20 12:24:19 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
|
2014-07-22 14:45:04 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
void foo() {}
|
|
|
|
|
2015-12-23 18:27:45 +08:00
|
|
|
template <class T, int N>
|
2014-07-22 14:45:04 +08:00
|
|
|
T tmain (T argc) {
|
|
|
|
T b = argc, c, d, e, f, g;
|
|
|
|
static T a;
|
|
|
|
#pragma omp for ordered
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-09-25 18:37:12 +08:00
|
|
|
#pragma omp for ordered
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered threads
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-09-28 14:39:35 +08:00
|
|
|
#pragma omp simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
|
|
|
#pragma omp for simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
|
|
|
#pragma omp parallel for simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-12-18 13:05:56 +08:00
|
|
|
#pragma omp parallel for ordered(1)
|
|
|
|
for (int i =0 ; i < argc; ++i) {
|
|
|
|
#pragma omp ordered depend(source)
|
2015-12-23 18:27:45 +08:00
|
|
|
#pragma omp ordered depend(sink:i+N)
|
2015-12-18 13:05:56 +08:00
|
|
|
a = 2;
|
|
|
|
}
|
2014-07-22 14:45:04 +08:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK: static T a;
|
2014-07-22 14:45:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
2018-02-15 01:38:47 +08:00
|
|
|
// CHECK-NEXT: #pragma omp ordered{{$}}
|
2014-07-22 14:45:04 +08:00
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-09-25 18:37:12 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered threads
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-09-28 14:39:35 +08:00
|
|
|
// CHECK-NEXT: #pragma omp simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp parallel for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: #pragma omp parallel for ordered(1)
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i) {
|
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(source)
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(sink : i + N)
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK: static int a;
|
2014-07-22 14:45:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-09-25 18:37:12 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered threads
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-09-28 14:39:35 +08:00
|
|
|
// CHECK-NEXT: #pragma omp simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp parallel for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: #pragma omp parallel for ordered(1)
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i) {
|
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(source)
|
2016-11-10 16:49:37 +08:00
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(sink : i + 3)
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
2014-07-22 14:45:04 +08:00
|
|
|
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-LABEL: int main(
|
2014-07-22 14:45:04 +08:00
|
|
|
int main (int argc, char **argv) {
|
|
|
|
int b = argc, c, d, e, f, g;
|
|
|
|
static int a;
|
|
|
|
// CHECK: static int a;
|
|
|
|
#pragma omp for ordered
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-09-25 18:37:12 +08:00
|
|
|
#pragma omp for ordered
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered threads
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-09-28 14:39:35 +08:00
|
|
|
#pragma omp simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
|
|
|
#pragma omp for simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
|
|
|
#pragma omp parallel for simd
|
|
|
|
for (int i =0 ; i < argc; ++i)
|
|
|
|
#pragma omp ordered simd
|
|
|
|
{
|
|
|
|
a=2;
|
|
|
|
}
|
2015-12-18 13:05:56 +08:00
|
|
|
#pragma omp parallel for ordered(1)
|
|
|
|
for (int i =0 ; i < argc; ++i) {
|
|
|
|
#pragma omp ordered depend(source)
|
2015-12-23 18:27:45 +08:00
|
|
|
#pragma omp ordered depend(sink: i - 5)
|
2015-12-18 13:05:56 +08:00
|
|
|
a = 2;
|
|
|
|
}
|
2014-07-22 14:45:04 +08:00
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
2015-09-25 18:37:12 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp for ordered
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered threads
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
2015-09-28 14:39:35 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp parallel for simd
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i)
|
|
|
|
// CHECK-NEXT: #pragma omp ordered simd
|
|
|
|
// CHECK-NEXT: {
|
|
|
|
// CHECK-NEXT: a = 2;
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: }
|
|
|
|
// CHECK-NEXT: #pragma omp parallel for ordered(1)
|
|
|
|
// CHECK-NEXT: for (int i = 0; i < argc; ++i) {
|
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(source)
|
2015-12-23 18:27:45 +08:00
|
|
|
// CHECK-NEXT: #pragma omp ordered depend(sink : i - 5)
|
2015-12-18 13:05:56 +08:00
|
|
|
// CHECK-NEXT: a = 2;
|
2014-07-22 14:45:04 +08:00
|
|
|
// CHECK-NEXT: }
|
2015-12-23 18:27:45 +08:00
|
|
|
return tmain<int, 3>(argc);
|
2014-07-22 14:45:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|