Index: clang/include/clang/Basic/DiagnosticParseKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticParseKinds.td +++ clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1382,6 +1382,10 @@ "missing map type">; def err_omp_map_type_modifier_missing : Error< "missing map type modifier">; +def err_omp_step_modifier_missing : Error< + "expected step size in 'step' modifier">; +def err_omp_linear_modifier_missing : Error< + "expected linear modifier ('val', 'uval', or 'ref')">; def err_omp_declare_simd_inbranch_notinbranch : Error< "unexpected '%0' clause, '%1' is specified already">; def err_omp_expected_clause_argument Index: clang/lib/Parse/ParseOpenMP.cpp =================================================================== --- clang/lib/Parse/ParseOpenMP.cpp +++ clang/lib/Parse/ParseOpenMP.cpp @@ -4380,6 +4380,19 @@ return false; } +static void ParseAlignedOrLinearStepSizeExpression( + Parser &P, Sema::OpenMPVarListDataTy &Data, SourceLocation ELoc) { + ExprResult Tail = P.ParseAssignmentExpression(); + Sema &Actions = P.getActions(); + Tail = Actions.ActOnFinishFullExpr(Tail.get(), ELoc, + /*DiscardedValue*/ false); + if (Tail.isUsable()) + Data.DepModOrTailExpr = Tail.get(); + else + P.SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end, + Parser::StopBeforeMatch); +} + /// Parses clauses with list. bool Parser::ParseOpenMPVarList(OpenMPDirectiveKind DKind, OpenMPClauseKind Kind, @@ -4744,17 +4757,78 @@ // Parse ':' linear-step (or ':' alignment). const bool MustHaveTail = MayHaveTail && Tok.is(tok::colon); + bool StepFound = false; + bool StepSizeExpected = true; + BalancedDelimiterTracker StepT(*this, tok::l_paren, + tok::annot_pragma_openmp_end); if (MustHaveTail) { Data.ColonLoc = Tok.getLocation(); SourceLocation ELoc = ConsumeToken(); - ExprResult Tail = ParseAssignmentExpression(); - Tail = - Actions.ActOnFinishFullExpr(Tail.get(), ELoc, /*DiscardedValue*/ false); - if (Tail.isUsable()) - Data.DepModOrTailExpr = Tail.get(); - else - SkipUntil(tok::comma, tok::r_paren, tok::annot_pragma_openmp_end, - StopBeforeMatch); + + if (getLangOpts().OpenMP >= 52 && Kind == OMPC_linear) { + if (Tok.is(tok::identifier) && + (PP.getSpelling(Tok) == "val" || PP.getSpelling(Tok) == "uval" || + PP.getSpelling(Tok) == "ref")) { + // syntax: linear( : linear-modifier [, step(step-size)]) + Data.ExtraModifier = OMPC_LINEAR_val; + Data.ExtraModifier = + getOpenMPSimpleClauseType(Kind, PP.getSpelling(Tok), getLangOpts()); + Data.ExtraModifierLoc = ConsumeToken(); + + // parse , + if (Tok.is(tok::comma)) + ConsumeToken(); + else + StepSizeExpected = false; + + // parse 'step' and '(' + if (StepSizeExpected) { + if (Tok.is(tok::identifier) && PP.getSpelling(Tok) == "step" && + PP.LookAhead(0).is(tok::l_paren)) { + StepFound = true; + ConsumeToken(); + StepT.consumeOpen(); + } else { + Diag(Tok, diag::err_omp_step_modifier_missing); + } + // parse 'step-size' expression + ParseAlignedOrLinearStepSizeExpression(*this, Data, ELoc); + // parse ')' + if (StepFound) + StepT.consumeClose(); + } + } else if (Tok.is(tok::identifier) && PP.getSpelling(Tok) == "step" && + PP.LookAhead(0).is(tok::l_paren)) { + // syntax: inear( : step(step-size) [, linear-modifier]) + // parse 'step' and '(' + ConsumeToken(); + StepT.consumeOpen(); + + // parse 'step-size' expression + ParseAlignedOrLinearStepSizeExpression(*this, Data, ELoc); + + // parse ')' + StepT.consumeClose(); + + if (Tok.is(tok::comma)) { + ConsumeToken(); + if (Tok.is(tok::identifier)) { + Data.ExtraModifier = OMPC_LINEAR_val; + Data.ExtraModifier = getOpenMPSimpleClauseType( + Kind, PP.getSpelling(Tok), getLangOpts()); + Data.ExtraModifierLoc = ConsumeToken(); + } else { + Diag(Tok, diag::err_omp_linear_modifier_missing); + } + } + } else { + // syntax: linear( : step-size) + ParseAlignedOrLinearStepSizeExpression(*this, Data, ELoc); + } + } else { + // for clauses other than OMPC_linear + ParseAlignedOrLinearStepSizeExpression(*this, Data, ELoc); + } } // Parse ')'. @@ -4766,8 +4840,8 @@ ExitScope(); return (Kind != OMPC_depend && Kind != OMPC_doacross && Kind != OMPC_map && Vars.empty()) || - (MustHaveTail && !Data.DepModOrTailExpr) || InvalidReductionId || - IsInvalidMapperModifier || InvalidIterator; + (MustHaveTail && !Data.DepModOrTailExpr && StepSizeExpected) || + InvalidReductionId || IsInvalidMapperModifier || InvalidIterator; } /// Parsing of OpenMP clause 'private', 'firstprivate', 'lastprivate', Index: clang/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp +++ clang/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wno-openmp-mapping -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-mapping -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wno-openmp-mapping -Wuninitialized extern int omp_default_mem_alloc; @@ -333,6 +335,25 @@ #pragma omp teams #pragma omp distribute parallel for simd linear(i : 4) for (i = 0; i < argc; ++i) { ++i; i += 4; } + +#ifdef OMP52 + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: step()) // omp52-error{{expected expression}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (i = 0; i < argc; ++i) ++i; +#endif } foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} Index: clang/test/OpenMP/distribute_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/distribute_simd_ast_print.cpp +++ clang/test/OpenMP/distribute_simd_ast_print.cpp @@ -7,6 +7,9 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s @@ -18,6 +21,10 @@ // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -147,6 +154,7 @@ // OMP45: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b) // 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) // OMP51: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b) +// OMP52: #pragma omp distribute simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) reduction(+: h) dist_schedule(static, b) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: a++; @@ -154,7 +162,9 @@ int i; #pragma omp target #pragma omp teams -#ifdef OMP51 +#ifdef 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) +#elif OMP51 #pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(reproducible:concurrent) #elif OMP5 #pragma omp distribute simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(argc) nontemporal(argc, c, d) order(concurrent) @@ -167,6 +177,7 @@ // OMP45: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) // OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(concurrent) // OMP51: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent) +// OMP52: #pragma omp distribute simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(reproducible: concurrent) // CHECK-NEXT: for (i = 0; i < 100; i++) // CHECK-NEXT: for (int j = 0; j < 200; j++) // CHECK-NEXT: a += h + x[j]; Index: clang/test/OpenMP/distribute_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/distribute_simd_linear_messages.cpp +++ clang/test/OpenMP/distribute_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wno-openmp-mapping -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wno-openmp-mapping -Wuninitialized extern int omp_default_mem_alloc; @@ -322,6 +324,25 @@ #pragma omp teams #pragma omp distribute simd linear(k : 4) for (k = 0; k < argc; k+=4) { } + +#ifdef OMP52 + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: step()) // omp52-error{{expected expression}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (k = 0; k < argc; ++k) ++k; +#endif } foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} Index: clang/test/OpenMP/for_ast_print.cpp =================================================================== --- clang/test/OpenMP/for_ast_print.cpp +++ clang/test/OpenMP/for_ast_print.cpp @@ -4,6 +4,9 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -Wsign-conversion -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wsign-conversion -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s -Wsign-conversion | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s @@ -11,6 +14,9 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s -Wsign-conversion -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wsign-conversion -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // expected-no-diagnostics #ifndef HEADER @@ -227,19 +233,26 @@ float arr[20]; static int a; // CHECK: static int a; -#ifdef OMP51 +#ifdef OMP52 +#pragma omp for schedule(guided, argc) reduction(+:argv[0][:1]) order(unconstrained:concurrent) +#elif OMP51 #pragma omp for schedule(guided, argc) reduction(+:argv[0][:1]) order(unconstrained:concurrent) #else #pragma omp for schedule(guided, argc) reduction(+:argv[0][:1]) order(concurrent) #endif // OMP51 // OMP50: #pragma omp for schedule(guided, argc) reduction(+: argv[0][:1]) order(concurrent) // OMP51: #pragma omp for schedule(guided, argc) reduction(+: argv[0][:1]) order(unconstrained: concurrent) + // OMP52: #pragma omp for schedule(guided, argc) reduction(+: argv[0][:1]) order(unconstrained: concurrent) for (int i = argc; i < c; ++i) a = 2; // CHECK-NEXT: for (int i = argc; i < c; ++i) // CHECK-NEXT: a = 2; #pragma omp parallel +#ifdef OMP52 +#pragma omp for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(3) schedule(auto) ordered nowait linear(g: step(-1)) reduction(task, +:e) +#else #pragma omp for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(3) schedule(auto) ordered nowait linear(g:-1) reduction(task, +:e) +#endif for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) for (auto x : arr) Index: clang/test/OpenMP/for_linear_messages.cpp =================================================================== --- clang/test/OpenMP/for_linear_messages.cpp +++ clang/test/OpenMP/for_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; @@ -213,15 +215,33 @@ int i; #pragma omp for linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for linear(i : step(4)) +#else #pragma omp for linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp for linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp for linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp for linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; #pragma omp for linear(i) ordered(1) // expected-error {{'linear' clause cannot be specified along with 'ordered' clause with a parameter}} for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{n instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/for_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/for_simd_ast_print.cpp +++ clang/test/OpenMP/for_simd_ast_print.cpp @@ -6,7 +6,10 @@ // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP5 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 -// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s @@ -18,6 +21,10 @@ // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -102,13 +109,16 @@ // CHECK: T res; // CHECK: T val; // CHECK: T lin = 0; -#ifdef OMP51 +#ifdef OMP52 + #pragma omp for simd private(val) safelen(7) linear(lin : step(-5)) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res, val, lin) order(reproducible:concurrent) +#elif OMP51 #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res, val, lin) order(reproducible:concurrent) #elif OMP5 #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res, val, lin) order(concurrent) #else #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) #endif // OMP51 +// OMP52-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res,val,lin) order(reproducible: concurrent) // OMP51-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res,val,lin) order(reproducible: concurrent) // OMP50-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) if(res) nontemporal(res,val,lin) order(concurrent) // OMP45-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) allocate(res) @@ -194,6 +204,7 @@ #else #pragma omp for simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) #endif +// OMP52-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) // OMP51-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) // OMP50-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) if(simd: a) // OMP45-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) Index: clang/test/OpenMP/for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/for_simd_linear_messages.cpp +++ clang/test/OpenMP/for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; @@ -210,15 +212,33 @@ #pragma omp parallel { int i; - #pragma omp for simd linear(i : i) + #pragma omp for simd linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for simd linear(i : step(4)) +#else #pragma omp for simd linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp for simd linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp for simd linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp for simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/masked_taskloop_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/masked_taskloop_simd_linear_messages.cpp +++ clang/test/OpenMP/masked_taskloop_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -15,7 +17,7 @@ void xxx(int argc) { int i, lin, step; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step' to silence this warning}} -#pragma omp master taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} +#pragma omp masked taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -37,29 +39,29 @@ void test_linear_colons() { int B = 0; - #pragma omp master taskloop simd linear(B:bfoo()) + #pragma omp masked taskloop simd linear(B:bfoo()) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'}} - #pragma omp master taskloop simd linear(B::ib:B:bfoo()) + #pragma omp masked taskloop simd linear(B::ib:B:bfoo()) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{use of undeclared identifier 'ib'; did you mean 'B::ib'}} - #pragma omp master taskloop simd linear(B:ib) + #pragma omp masked taskloop simd linear(B:ib) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{unexpected ':' in nested name specifier; did you mean '::'?}} - #pragma omp master taskloop simd linear(z:B:ib) + #pragma omp masked taskloop simd linear(z:B:ib) for (int i = 0; i < 10; ++i) ; - #pragma omp master taskloop simd linear(B:B::bfoo()) + #pragma omp masked taskloop simd linear(B:B::bfoo()) for (int i = 0; i < 10; ++i) ; - #pragma omp master taskloop simd linear(X::x : ::z) + #pragma omp masked taskloop simd linear(X::x : ::z) for (int i = 0; i < 10; ++i) ; - #pragma omp master taskloop simd linear(B,::z, X::x) + #pragma omp masked taskloop simd linear(B,::z, X::x) for (int i = 0; i < 10; ++i) ; - #pragma omp master taskloop simd linear(::z) + #pragma omp masked taskloop simd linear(::z) for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{expected variable name}} - #pragma omp master taskloop simd linear(B::bfoo()) + #pragma omp masked taskloop simd linear(B::bfoo()) for (int i = 0; i < 10; ++i) ; - #pragma omp master taskloop simd linear(B::ib,B:C1+C2) + #pragma omp masked taskloop simd linear(B::ib,B:C1+C2) for (int i = 0; i < 10; ++i) ; } @@ -68,7 +70,7 @@ T sum = (T)0; T ind2 = - num * L; // expected-note {{'ind2' defined here}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type}} -#pragma omp master taskloop simd linear(ind2:L) +#pragma omp masked taskloop simd linear(ind2:L) for (i = 0; i < num; ++i) { T cur = arr[(int)ind2]; ind2 += L; @@ -80,7 +82,7 @@ template int test_warn() { int ind2 = 0; // expected-warning@+1 {{zero linear step (ind2 should probably be const)}} - #pragma omp master taskloop simd linear(ind2:LEN) + #pragma omp masked taskloop simd linear(ind2:LEN) for (int i = 0; i < 100; i++) { ind2 += LEN; } @@ -123,59 +125,59 @@ I g(5); int i, z; int &j = i; - #pragma omp master taskloop simd linear // expected-error {{expected '(' after 'linear'}} + #pragma omp masked taskloop simd linear // expected-error {{expected '(' after 'linear'}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (uval( // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} + #pragma omp masked taskloop simd linear (uval( // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (ref() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (ref() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (foo() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (foo() // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear () // expected-error {{expected expression}} + #pragma omp masked taskloop simd linear () // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (val argc // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (val argc // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (val(argc, // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} + #pragma omp masked taskloop simd linear (val(argc, // expected-error {{expected expression}} expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} + #pragma omp masked taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} + #pragma omp masked taskloop simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp masked taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{linear variable with incomplete type 'S1'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}} - #pragma omp master taskloop simd linear (val(a, b):B::ib) + #pragma omp masked taskloop simd linear (val(a, b):B::ib) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argv[1]) // expected-error {{expected variable name}} + #pragma omp masked taskloop simd linear (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(ref(e, g)) // expected-error 2 {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'ref'}} + #pragma omp masked taskloop simd linear(ref(e, g)) // expected-error 2 {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'ref'}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(h, z) // expected-error {{threadprivate or thread local variable cannot be linear}} + #pragma omp masked taskloop simd linear(h, z) // expected-error {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(uval(i)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} + #pragma omp masked taskloop simd linear(uval(i)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { int v = 0; int i; - #pragma omp master taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'master taskloop simd' directive}} + #pragma omp masked taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'masked taskloop simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; } } - #pragma omp master taskloop simd linear(ref(j)) + #pragma omp masked taskloop simd linear(ref(j)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(uval(j)) + #pragma omp masked taskloop simd linear(uval(j)) for (int k = 0; k < argc; ++k) ++k; int v = 0; - #pragma omp master taskloop simd linear(v:j) + #pragma omp masked taskloop simd linear(v:j) for (int k = 0; k < argc; ++k) { ++k; v += j; } - #pragma omp master taskloop simd linear(i) + #pragma omp masked taskloop simd linear(i) for (int k = 0; k < argc; ++k) ++k; return 0; } @@ -190,15 +192,15 @@ void linear_modifiers(int argc) { int &f = argc; - #pragma omp master taskloop simd linear(f) + #pragma omp masked taskloop simd linear(f) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(val(f)) + #pragma omp masked taskloop simd linear(val(f)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(uval(f)) + #pragma omp masked taskloop simd linear(uval(f)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(ref(f)) + #pragma omp masked taskloop simd linear(ref(f)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(foo(f)) // expected-error {{expected one of 'ref', val' or 'uval' modifiers}} + #pragma omp masked taskloop simd linear(foo(f)) // expected-error {{expected one of 'ref', val' or 'uval' modifiers}} for (int k = 0; k < argc; ++k) ++k; } @@ -214,54 +216,72 @@ S5 g(5); // expected-note {{'g' defined here}} int i, z; int &j = i; - #pragma omp master taskloop simd linear(f) linear(f) // expected-error {{linear variable cannot be linear}} expected-note {{defined as linear}} + #pragma omp masked taskloop simd linear(f) linear(f) // expected-error {{linear variable cannot be linear}} expected-note {{defined as linear}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear // expected-error {{expected '(' after 'linear'}} + #pragma omp masked taskloop simd linear // expected-error {{expected '(' after 'linear'}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear () // expected-error {{expected expression}} + #pragma omp masked taskloop simd linear () // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (val // expected-error {{use of undeclared identifier 'val'}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (ref()) // expected-error {{expected expression}} + #pragma omp masked taskloop simd linear (ref()) // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (foo()) // expected-error {{expected expression}} + #pragma omp masked taskloop simd linear (foo()) // expected-error {{expected expression}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp masked taskloop simd linear (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} + #pragma omp masked taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argc, z) + #pragma omp masked taskloop simd linear (argc, z) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp masked taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{linear variable with incomplete type 'S1'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S2'}} - #pragma omp master taskloop simd linear(a, b) + #pragma omp masked taskloop simd linear(a, b) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear (argv[1]) // expected-error {{expected variable name}} + #pragma omp masked taskloop simd linear (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; // expected-error@+2 {{argument of a linear clause should be of integral or pointer type, not 'S4'}} // expected-error@+1 {{argument of a linear clause should be of integral or pointer type, not 'S5'}} - #pragma omp master taskloop simd linear(val(e, g)) + #pragma omp masked taskloop simd linear(val(e, g)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} + #pragma omp masked taskloop simd linear(h, C::x) // expected-error 2 {{threadprivate or thread local variable cannot be linear}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel { int i; - #pragma omp master taskloop simd linear(val(i)) + #pragma omp masked taskloop simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#ifdef OMP52 + #pragma omp masked taskloop simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else + #pragma omp masked taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } - #pragma omp master taskloop simd linear(ref(j)) +#ifdef OMP52 + #pragma omp masked taskloop simd linear(j: ref) +#else + #pragma omp masked taskloop simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; - #pragma omp master taskloop simd linear(i) +#ifdef OMP52 + #pragma omp masked taskloop simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else + #pragma omp masked taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp masked taskloop simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp masked taskloop simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/master_taskloop_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/master_taskloop_simd_linear_messages.cpp +++ clang/test/OpenMP/master_taskloop_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -255,13 +257,31 @@ int i; #pragma omp master taskloop simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp master taskloop simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp master taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp master taskloop simd linear(j: ref) +#else #pragma omp master taskloop simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp master taskloop simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp master taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp master taskloop simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp master taskloop simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/parallel_for_ast_print.cpp =================================================================== --- clang/test/OpenMP/parallel_for_ast_print.cpp +++ clang/test/OpenMP/parallel_for_ast_print.cpp @@ -4,6 +4,9 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP50 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s @@ -12,6 +15,10 @@ // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -76,13 +83,14 @@ // CHECK: static T a; static T g; #pragma omp threadprivate(g) -#ifdef OMP51 +#if defined(OMP51) || defined(OMP52) #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d, e,f) order(reproducible:concurrent) #else #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d, e,f) order(concurrent) #endif // OMP51 // OMP50: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(concurrent) // OMP51: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(reproducible: concurrent) + // OMP52: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) lastprivate(conditional: d,e,f) order(reproducible: concurrent) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) @@ -149,7 +157,11 @@ a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; +#ifdef OMP52 +#pragma omp parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a: step(-5)) +#else #pragma omp parallel for private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a:-5) +#endif for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); Index: clang/test/OpenMP/parallel_for_linear_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_for_linear_messages.cpp +++ clang/test/OpenMP/parallel_for_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; @@ -261,16 +263,28 @@ #pragma omp parallel for linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp parallel for linear(i : step(4)) +#else #pragma omp parallel for linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } -#pragma omp parallel for linear(j) +#ifdef OMP52 +#pragma omp for linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else +#pragma omp for linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for linear(i) +#ifdef OMP52 + #pragma omp for linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else + #pragma omp for linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; Index: clang/test/OpenMP/parallel_for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_for_simd_linear_messages.cpp +++ clang/test/OpenMP/parallel_for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) { @@ -210,12 +212,24 @@ int i; #pragma omp parallel for simd linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel for simd linear(i : step(4)) +#else #pragma omp parallel for simd linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp for linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp parallel for simd linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp for linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp parallel for simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} Index: clang/test/OpenMP/parallel_masked_taskloop_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_masked_taskloop_simd_linear_messages.cpp +++ clang/test/OpenMP/parallel_masked_taskloop_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -255,13 +257,31 @@ int i; #pragma omp parallel masked taskloop simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel masked taskloop simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp parallel masked taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp parallel masked taskloop simd linear(j: ref) +#else #pragma omp parallel masked taskloop simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel masked taskloop simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp parallel masked taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel masked taskloop simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp parallel masked taskloop simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/parallel_master_taskloop_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/parallel_master_taskloop_simd_linear_messages.cpp +++ clang/test/OpenMP/parallel_master_taskloop_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -255,13 +257,31 @@ int i; #pragma omp parallel master taskloop simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel master taskloop simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp parallel master taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp parallel master taskloop simd linear(j: ref) +#else #pragma omp parallel master taskloop simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel master taskloop simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp parallel master taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp parallel master taskloop simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp parallel master taskloop simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/simd_ast_print.cpp +++ clang/test/OpenMP/simd_ast_print.cpp @@ -7,6 +7,9 @@ // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s @@ -18,6 +21,10 @@ // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -83,7 +90,11 @@ N &ref = i; T sum = (T)0; // CHECK: T sum = (T)0; +#ifdef OMP52 +#pragma omp simd private(myind, g_ind), linear(ind), aligned(arr), linear(ref: uval) +#else #pragma omp simd private(myind, g_ind), linear(ind), aligned(arr), linear(uval(ref)) +#endif // CHECK-NEXT: #pragma omp simd private(myind,g_ind) linear(ind) aligned(arr) linear(uval(ref)) for (i = 0; i < num; ++i) { myind = ind; @@ -106,7 +117,11 @@ // CHECK: T val; // CHECK: T lin = 0; // CHECK: T &ref = res; +#ifdef OMP52 + #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : step(-5)) lastprivate(res) simdlen(5) linear(ref: ref) +#else #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref)) +#endif // CHECK-NEXT: #pragma omp simd allocate(res) private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref)) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; @@ -169,7 +184,10 @@ for (int i=0; i < 2; ++i)*a=2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: *a = 2; -#ifdef OMP51 +#ifdef OMP52 +#pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a) nontemporal(argc, c, d) lastprivate(conditional: e, f) order(unconstrained:concurrent) +// OMP52-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a) nontemporal(argc,c,d) lastprivate(conditional: e,f) order(unconstrained: concurrent) +#elif OMP51 #pragma omp simd private(argc, b),lastprivate(d,f) collapse(2) aligned(a : 4) if(simd:a) nontemporal(argc, c, d) lastprivate(conditional: e, f) order(unconstrained:concurrent) // OMP51-NEXT: #pragma omp simd private(argc,b) lastprivate(d,f) collapse(2) aligned(a: 4) if(simd: a) nontemporal(argc,c,d) lastprivate(conditional: e,f) order(unconstrained: concurrent) #elif OMP5 @@ -192,13 +210,16 @@ // CHECK-NEXT: foo(); const int CLEN = 4; // CHECK-NEXT: const int CLEN = 4; -#ifdef OMP5 +#ifdef OMP52 + #pragma omp simd aligned(a:CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(ref: val, step(CLEN)) if(a) +#elif OMP5 #pragma omp simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(val(ref): CLEN) if(a) // OMP50-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) linear(val(ref): CLEN) if(a) #else #pragma omp simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(val(ref): CLEN) // OMP45-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) linear(val(ref): CLEN) // OMP51-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) linear(val(ref): CLEN) +// OMP52-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) linear(val(ref): CLEN) #endif // OMP5 for (int i = 0; i < 10; ++i)foo(); // CHECK-NEXT: for (int i = 0; i < 10; ++i) Index: clang/test/OpenMP/simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/simd_linear_messages.cpp +++ clang/test/OpenMP/simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) { @@ -245,13 +247,31 @@ int i; #pragma omp simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp simd linear(j: ref) +#else #pragma omp simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/target_parallel_for_linear_messages.cpp =================================================================== --- clang/test/OpenMP/target_parallel_for_linear_messages.cpp +++ clang/test/OpenMP/target_parallel_for_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -270,16 +272,28 @@ #pragma omp target parallel for linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target parallel for linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp target parallel for linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 +#pragma omp target parallel for linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp target parallel for linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target parallel for linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp target parallel for linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; Index: clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp +++ clang/test/OpenMP/target_parallel_for_simd_ast_print.cpp @@ -7,6 +7,9 @@ // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP51 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping @@ -18,6 +21,10 @@ // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -131,7 +138,7 @@ // CHECK-NEXT: for (T i = 0; i < 2; ++i) { // CHECK-NEXT: } -#ifdef OMP51 +#if defined(OMP51) || defined(OMP52) #pragma omp target parallel for simd if(target:argc > 0) if (simd: argc) nontemporal(argc, c, d) order(unconstrained:concurrent) allocate(omp_high_bw_mem_alloc:f) private(f) uses_allocators(omp_high_bw_mem_alloc) #elif OMP5 #pragma omp target parallel for simd if(target:argc > 0) if (simd: argc) nontemporal(argc, c, d) order(concurrent) allocate(omp_high_bw_mem_alloc:f) private(f) uses_allocators(omp_high_bw_mem_alloc) @@ -142,6 +149,7 @@ // OMP45: #pragma omp target parallel for simd if(target: argc > 0) // OMP50: #pragma omp target parallel for simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) order(concurrent) allocate(omp_high_bw_mem_alloc: f) private(f) uses_allocators(omp_high_bw_mem_alloc) // OMP51: #pragma omp target parallel for simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) order(unconstrained: concurrent) allocate(omp_high_bw_mem_alloc: f) private(f) uses_allocators(omp_high_bw_mem_alloc) + // OMP52: #pragma omp target parallel for simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) order(unconstrained: concurrent) allocate(omp_high_bw_mem_alloc: f) private(f) uses_allocators(omp_high_bw_mem_alloc) // CHECK-NEXT: for (T i = 0; i < 2; ++i) { // CHECK-NEXT: } @@ -237,8 +245,11 @@ a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; - +#ifdef OMP52 +#pragma omp target parallel for simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (target: argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a: step(-5)) +#else #pragma omp target parallel for simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) schedule(auto) ordered if (target: argc) num_threads(a) default(shared) shared(e) reduction(+ : h) linear(a:-5) +#endif for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); @@ -265,7 +276,7 @@ // CHECK-NEXT: for (int i = 0; i < 2; ++i) { // CHECK-NEXT: } -#ifdef OMP51 +#if defined(OMP51) || defined(OMP52) #pragma omp target parallel for simd if (parallel:argc > 0) #elif OMP5 #pragma omp target parallel for simd if (parallel:argc > 0) if(simd: argc) @@ -276,6 +287,7 @@ // OMP45: #pragma omp target parallel for simd if(parallel: argc > 0) // OMP50: #pragma omp target parallel for simd if(parallel: argc > 0) if(simd: argc) // OMP51: #pragma omp target parallel for simd if(parallel: argc > 0) + // OMP52: #pragma omp target parallel for simd if(parallel: argc > 0) // CHECK-NEXT: for (int i = 0; i < 2; ++i) { // CHECK-NEXT: } Index: clang/test/OpenMP/target_parallel_for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/target_parallel_for_simd_linear_messages.cpp +++ clang/test/OpenMP/target_parallel_for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized #pragma omp requires dynamic_allocators @@ -272,16 +274,28 @@ #pragma omp target parallel for simd linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target parallel for simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp target parallel for simd linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 +#pragma omp target parallel for simd linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp target parallel for simd linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target parallel for simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp target parallel for simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; Index: clang/test/OpenMP/target_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/target_simd_ast_print.cpp +++ clang/test/OpenMP/target_simd_ast_print.cpp @@ -7,6 +7,9 @@ // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP51 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP52 +// RUN: %clang_cc1 -fopenmp -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-mapping | FileCheck %s --check-prefix=CHECK --check-prefix=OMP45 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping @@ -18,6 +21,10 @@ // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP51 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP51 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP51 // expected-no-diagnostics +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=52 -ast-print %s -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -x c++ -std=c++11 -emit-pch -o %t %s -Wno-openmp-mapping -DOMP52 +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=52 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-mapping -DOMP52 | FileCheck %s --check-prefix=CHECK --check-prefix=OMP52 +// expected-no-diagnostics #ifndef HEADER #define HEADER @@ -141,6 +148,7 @@ // OMP45: #pragma omp target simd if(target: argc > 0) // OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc) allocate(omp_default_mem_alloc: f) private(f) uses_allocators(omp_default_mem_alloc) // OMP51: #pragma omp target simd if(target: argc > 0) + // OMP52: #pragma omp target simd if(target: argc > 0) // CHECK-NEXT: for (T i = 0; i < 2; ++i) { // CHECK-NEXT: } @@ -238,7 +246,11 @@ // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; +#ifdef OMP52 +#pragma omp target simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) if (target: argc) reduction(+ : h) linear(a: step(-5)) +#else #pragma omp target simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) if (target: argc) reduction(+ : h) linear(a:-5) +#endif for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); @@ -259,7 +271,7 @@ // CHECK-NEXT: for (int i = 0; i < 2; ++i) { // CHECK-NEXT: } -#ifdef OMP51 +#if defined(OMP51) || defined(OMP52) #pragma omp target simd if (target:argc > 0) if(simd:argc) nontemporal(argc, c, d) lastprivate(conditional: d, f) order(reproducible:concurrent) #elif OMP5 #pragma omp target simd if (target:argc > 0) if(simd:argc) nontemporal(argc, c, d) lastprivate(conditional: d, f) order(concurrent) @@ -270,6 +282,7 @@ // OMP45: #pragma omp target simd if(target: argc > 0) // OMP50: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) lastprivate(conditional: d,f) order(concurrent) // OMP51: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) lastprivate(conditional: d,f) order(reproducible: concurrent) + // OMP52: #pragma omp target simd if(target: argc > 0) if(simd: argc) nontemporal(argc,c,d) lastprivate(conditional: d,f) order(reproducible: concurrent) // CHECK-NEXT: for (int i = 0; i < 2; ++i) { // CHECK-NEXT: } Index: clang/test/OpenMP/target_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/target_simd_linear_messages.cpp +++ clang/test/OpenMP/target_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized #pragma omp requires dynamic_allocators typedef void **omp_allocator_handle_t; @@ -271,16 +273,28 @@ #pragma omp target simd linear(i) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp target simd linear(i : 4) +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 +#pragma omp target simd linear(j: step() //omp52-error{{expected expression}} omp52-error{{expected ')'}} omp52-note{{to match this '('}} +#else #pragma omp target simd linear(j) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 +#pragma omp target simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp target simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; Index: clang/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp +++ clang/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_default_mem_alloc; Index: clang/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp +++ clang/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_default_mem_alloc; Index: clang/test/OpenMP/taskloop_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/taskloop_simd_linear_messages.cpp +++ clang/test/OpenMP/taskloop_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized typedef void **omp_allocator_handle_t; extern const omp_allocator_handle_t omp_null_allocator; @@ -255,13 +257,31 @@ int i; #pragma omp taskloop simd linear(val(i)) for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp taskloop simd linear(i : uval, step(4)) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#else #pragma omp taskloop simd linear(uval(i) : 4) // expected-error {{variable of non-reference type 'int' can be used only with 'val' modifier, but used with 'uval'}} +#endif for (int k = 0; k < argc; ++k) { ++k; i += 4; } } +#ifdef OMP52 + #pragma omp taskloop simd linear(j: ref) +#else #pragma omp taskloop simd linear(ref(j)) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp taskloop simd linear(i: step(1),) // omp52-error{{expected linear modifier ('val', 'uval', or 'ref')}} +#else #pragma omp taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp taskloop simd linear(j: step()) // omp52-error{{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp taskloop simd linear(j: step(1), pval) // omp52-error{{expected one of 'ref', val' or 'uval' modifiers}} + for (int k = 0; k < argc; ++k) ++k; +#endif foomain(argc,argv); // expected-note {{in instantiation of function template specialization 'foomain' requested here}} return 0; Index: clang/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp +++ clang/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) { Index: clang/test/OpenMP/teams_distribute_simd_linear_messages.cpp =================================================================== --- clang/test/OpenMP/teams_distribute_simd_linear_messages.cpp +++ clang/test/OpenMP/teams_distribute_simd_linear_messages.cpp @@ -1,6 +1,8 @@ // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized +// RUN: %clang_cc1 -verify=expected,omp52 -fopenmp-simd -fopenmp-version=52 -DOMP52 %s -Wuninitialized extern int omp_default_mem_alloc; void xxx(int argc) {