Index: clang/include/clang/Basic/DiagnosticParseKinds.td =================================================================== --- clang/include/clang/Basic/DiagnosticParseKinds.td +++ clang/include/clang/Basic/DiagnosticParseKinds.td @@ -1348,6 +1348,12 @@ def warn_omp_extra_tokens_at_eol : Warning< "extra tokens at the end of '#pragma omp %0' are ignored">, InGroup; +def warn_omp_extra_tokens_at_eo_simple_step_modifier : Warning< + "extra tokens at the end of 'simple step modifier' are ignored">, + InGroup; +def warn_omp_multiple_step_or_linear_modifier : Warning< + "multiple %select{'step size'|'linear modifier'}0 found, ignoring the previous one">, + InGroup; def warn_pragma_expected_colon_r_paren : Warning< "missing ':' or ')' after %0 - ignoring">, InGroup; def err_omp_unknown_directive : Error< @@ -1382,6 +1388,8 @@ "missing map type">; def err_omp_map_type_modifier_missing : Error< "missing map type modifier">; +def err_omp_step_simple_modifier_exclusive : Error< + "step simple modifier is exclusive and can't be use with 'val', 'uval', 'ref' or 'step' modifier">; def err_omp_declare_simd_inbranch_notinbranch : Error< "unexpected '%0' clause, '%1' is specified already">; def err_omp_expected_clause_argument Index: clang/lib/AST/OpenMPClause.cpp =================================================================== --- clang/lib/AST/OpenMPClause.cpp +++ clang/lib/AST/OpenMPClause.cpp @@ -2206,16 +2206,20 @@ void OMPClausePrinter::VisitOMPLinearClause(OMPLinearClause *Node) { if (!Node->varlist_empty()) { OS << "linear"; + VisitOMPClauseList(Node, '('); + if (Node->getModifierLoc().isValid() || Node->getStep() != nullptr) { + OS << ": "; + } if (Node->getModifierLoc().isValid()) { - OS << '(' - << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier()); + OS << getOpenMPSimpleClauseTypeName(OMPC_linear, Node->getModifier()); } - VisitOMPClauseList(Node, '('); - if (Node->getModifierLoc().isValid()) - OS << ')'; if (Node->getStep() != nullptr) { - OS << ": "; + if (Node->getModifierLoc().isValid()) { + OS << ", "; + } + OS << "step("; Node->getStep()->printPretty(OS, nullptr, Policy, 0); + OS << ")"; } OS << ")"; } Index: clang/lib/Parse/ParseOpenMP.cpp =================================================================== --- clang/lib/Parse/ParseOpenMP.cpp +++ clang/lib/Parse/ParseOpenMP.cpp @@ -4380,6 +4380,28 @@ return false; } +static void ParseStepSize(Parser &P, Sema::OpenMPVarListDataTy &Data, + SourceLocation ELoc, bool &StepFound, + bool IsStepSimpleModifier = false) { + ExprResult Tail = P.ParseAssignmentExpression(); + Sema &Actions = P.getActions(); + Tail = Actions.ActOnFinishFullExpr(Tail.get(), ELoc, + /*DiscardedValue*/ false); + if (Tail.isUsable()) { + Data.DepModOrTailExpr = Tail.get(); + StepFound = true; + Token CurTok = P.getCurToken(); + if (CurTok.isNot(tok::r_paren) && IsStepSimpleModifier) { + P.Diag(CurTok, diag::warn_omp_extra_tokens_at_eo_simple_step_modifier); + P.SkipUntil(tok::r_paren, tok::annot_pragma_openmp_end, + Parser::StopBeforeMatch); + } + } 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 +4766,82 @@ // Parse ':' linear-step (or ':' alignment). const bool MustHaveTail = MayHaveTail && Tok.is(tok::colon); + bool StepFound = false; + bool ModifierFound = false; 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) { + while (Tok.isNot(tok::r_paren)) { + if (Tok.is(tok::identifier)) { + if (PP.getSpelling(Tok) == "step") { + if (StepFound) + Diag(Tok, diag::warn_omp_multiple_step_or_linear_modifier) << 0; + + BalancedDelimiterTracker T(*this, tok::l_paren, + tok::annot_pragma_openmp_end); + ConsumeToken(); + // parse '(' + T.consumeOpen(); + ParseStepSize(*this, Data, Tok.getLocation(), StepFound); + // parse ')' + T.consumeClose(); + } else { + // identifier could be a linear modifier (val, uval, ref) or step + // size + OpenMPLinearClauseKind LinKind = + static_cast(getOpenMPSimpleClauseType( + Kind, Tok.isAnnotation() ? "" : PP.getSpelling(Tok), + getLangOpts())); + + // Check if it is a vaild linear modifier + // if not then treat it as a step simple modifier + if (LinKind >= 0 && LinKind < OMPC_LINEAR_unknown) { + if (ModifierFound) + Diag(Tok, diag::warn_omp_multiple_step_or_linear_modifier) << 1; + + Data.ExtraModifier = LinKind; + Data.ExtraModifierLoc = ConsumeToken(); + ModifierFound = true; + } else { + // step simple modifier is exlusive + if (ModifierFound || StepFound) + Diag(Tok, diag::err_omp_step_simple_modifier_exclusive); + else + ParseStepSize(*this, Data, Tok.getLocation(), StepFound, + /*IsStepSimpleModifier*/ true); + break; + } + } + } else { + // parse an integer expression as step size + if (ModifierFound || StepFound) + Diag(Tok, diag::err_omp_step_simple_modifier_exclusive); + else + ParseStepSize(*this, Data, Tok.getLocation(), StepFound, + /*IsStepSimpleModifier*/ true); + break; + } + + if (Tok.is(tok::comma)) + ConsumeToken(); + if (Tok.is(tok::r_paren) || Tok.is(tok::annot_pragma_openmp_end)) + break; + } + if (!StepFound && !ModifierFound) + Diag(ELoc, diag::err_expected_expression); + } else { + // for OMPC_Aligned and OMPC_linear (with OpenMP <= 5.1) + 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); + } } // Parse ')'. @@ -4766,8 +4853,8 @@ ExitScope(); return (Kind != OMPC_depend && Kind != OMPC_doacross && Kind != OMPC_map && Vars.empty()) || - (MustHaveTail && !Data.DepModOrTailExpr) || InvalidReductionId || - IsInvalidMapperModifier || InvalidIterator; + (MustHaveTail && !Data.DepModOrTailExpr && StepFound) || + InvalidReductionId || IsInvalidMapperModifier || InvalidIterator; } /// Parsing of OpenMP clause 'private', 'firstprivate', 'lastprivate', Index: clang/test/OpenMP/declare_simd_messages.cpp =================================================================== --- clang/test/OpenMP/declare_simd_messages.cpp +++ clang/test/OpenMP/declare_simd_messages.cpp @@ -122,11 +122,12 @@ #pragma omp declare simd aligned( // expected-error@+1 {{expected expression}} #pragma omp declare simd aligned() +// expected-error@+4 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}} // expected-note@+3 {{to match this '('}} // expected-error@+2 {{expected ')'}} // expected-error@+1 {{expected expression}} #pragma omp declare simd aligned(a: -// expected-error@+1 {{expected expression}} +// expected-error@+1 {{expected expression}} expected-error@+1 {{argument of aligned clause should be array, pointer, reference to array or reference to pointer, not 'int'}} #pragma omp declare simd aligned(a:) // expected-warning@+2 {{extra tokens at the end of '#pragma omp declare simd' are ignored}} // expected-error@+1 {{expected '(' after 'aligned'}} @@ -205,6 +206,8 @@ // expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} expected-warning@+1 {{extra tokens at the end of '#pragma omp declare simd' are ignored}} #pragma omp declare simd linear(uref(b)) allocate(b) #pragma omp declare simd linear(ref(c)) +// expected-note@+2 {{'a' declared here}} +// expected-note@+1 {{'a' declared here}} void bar(int a, int *b, float &c); template Index: clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp +++ clang/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp @@ -165,9 +165,9 @@ for (i = 0; i < 100; i++) for (int j = 0; j < 200; j++) a += h + x[j]; - // OMP45: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) - // OMP50: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(concurrent) - // OMP51: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(unconstrained: concurrent) + // OMP45: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) + // OMP50: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(concurrent) + // OMP51: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(simd: argc) nontemporal(argc,c,d) order(unconstrained: 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_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,29 @@ #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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: step()) // omp52-error 2 {{expected expression}} + for (i = 0; i < argc; ++i) ++i; + #pragma omp target + #pragma omp teams + #pragma omp distribute parallel for simd linear(i: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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) @@ -164,9 +174,10 @@ for (i = 0; i < 100; i++) for (int j = 0; j < 200; j++) a += h + x[j]; -// 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) +// OMP45: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) +// OMP50: #pragma omp distribute simd aligned(x: 8) linear(i: step(2)) safelen(8) simdlen(8) if(argc) nontemporal(argc,c,d) order(concurrent) +// 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) +// 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) // 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,29 @@ #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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: step()) // omp52-error 2 {{expected expression}} + for (k = 0; k < argc; ++k) ++k; + #pragma omp target + #pragma omp teams + #pragma omp distribute simd linear(k: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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 @@ -62,13 +68,13 @@ // CHECK: #pragma omp for private(this->a) private(this->a) private(T::a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(T::a) -// CHECK: #pragma omp for linear(val(this->c)) +// CHECK: #pragma omp for linear(this->c: val) // CHECK: #pragma omp for private(this->a) private(this->a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) -// CHECK: #pragma omp for linear(uval(this->b)) +// CHECK: #pragma omp for linear(this->b: uval) // CHECK: #pragma omp for private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(this->S::a) -// CHECK: #pragma omp for linear(val(this->c)) +// CHECK: #pragma omp for linear(this->c: val) class S8 : public S7 { S8() {} @@ -101,7 +107,7 @@ // CHECK: #pragma omp for private(this->a) private(this->a) private(this->S7::a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) lastprivate(this->S7::a) -// CHECK: #pragma omp for linear(ref(this->S7::d)) +// CHECK: #pragma omp for linear(this->S7::d: ref) // CHECK: #pragma omp for private(this->a) private(this->a) // CHECK: #pragma omp for lastprivate(this->a) lastprivate(this->a) // CHECK: #pragma omp for linear(this->c) @@ -227,25 +233,32 @@ 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) foo(), (void)x; // CHECK-NEXT: #pragma omp parallel - // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(3) schedule(auto) ordered nowait linear(g: -1) reduction(task, +: e) + // CHECK-NEXT: #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) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: 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,12 +1,14 @@ // 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) { - 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 for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp for linear(lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -213,15 +215,37 @@ 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 2 {{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), val) +#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 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for linear(j: step(1), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for linear(j: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for linear(j: pval, step(1)) // omp52-error{{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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,16 +109,19 @@ // 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 -// 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) +// OMP52-NEXT: #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) +// OMP51-NEXT: #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) +// OMP50-NEXT: #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(concurrent) +// OMP45-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: step(-5)) lastprivate(res) simdlen(5) allocate(res) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; res = val; @@ -152,7 +162,7 @@ // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) +// CHECK-NEXT: #pragma omp for simd allocate(k1) safelen(4) linear(k1,k2: step(4)) aligned(a: 4) simdlen(4) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; @@ -194,9 +204,10 @@ #else #pragma omp for simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) #endif -// 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) +// OMP52-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) +// OMP51-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) +// OMP50-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) if(simd: a) +// OMP45-NEXT: #pragma omp for simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) for (int i = 0; i < 10; ++i)foo(); // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: foo(); 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,12 +1,14 @@ // 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) { - 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 for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp for simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp for simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp masked taskloop simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' 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,74 @@ 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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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(i: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp masked taskloop simd linear(j: step()) // omp52-error 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp masked taskloop simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp master taskloop simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -255,13 +257,33 @@ 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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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(i: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp master taskloop simd linear(j: step()) // omp52-error 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp master taskloop simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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,11 +157,15 @@ 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(); - // CHECK-NEXT: #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) + // CHECK-NEXT: #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)) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: 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,12 +1,14 @@ // 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) { - 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 parallel for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp parallel for linear(lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#else + #pragma omp for linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; Index: clang/test/OpenMP/parallel_for_simd_ast_print.cpp =================================================================== --- clang/test/OpenMP/parallel_for_simd_ast_print.cpp +++ clang/test/OpenMP/parallel_for_simd_ast_print.cpp @@ -104,7 +104,7 @@ // CHECK: T val; // CHECK: T lin = 0; #pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) if(7) allocate(lin) -// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) if(7) allocate(lin) +// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: step(-5)) lastprivate(res) simdlen(5) if(7) allocate(lin) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; res = val; @@ -145,7 +145,7 @@ // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp parallel for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) +// CHECK-NEXT: #pragma omp parallel for simd allocate(k1) safelen(4) linear(k1,k2: step(4)) aligned(a: 4) simdlen(4) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; @@ -191,7 +191,7 @@ const int CLEN = 4; // CHECK-NEXT: const int CLEN = 4; #pragma omp parallel for simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) -// CHECK-NEXT: #pragma omp parallel for simd aligned(a: CLEN) linear(a: CLEN) safelen(CLEN) collapse(1) simdlen(CLEN) +// CHECK-NEXT: #pragma omp parallel for simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) for (int i = 0; i < 10; ++i)foo(); // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: foo(); 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,11 +1,13 @@ // 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) { - 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 parallel for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp parallel for simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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_ast_print.cpp =================================================================== --- clang/test/OpenMP/parallel_masked_taskloop_simd_ast_print.cpp +++ clang/test/OpenMP/parallel_masked_taskloop_simd_ast_print.cpp @@ -62,7 +62,7 @@ #pragma omp taskgroup task_reduction(+: d) #pragma omp parallel masked taskloop simd if(parallel: a) default(none) shared(a, b, argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c:b) filter(tid) // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp parallel masked taskloop simd if(parallel: a) default(none) shared(a,b,argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c: b) filter(tid) + // CHECK-NEXT: #pragma omp parallel masked taskloop simd if(parallel: a) default(none) shared(a,b,argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c: step(b)) filter(tid) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 parallel 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}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp parallel masked taskloop simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp parallel masked taskloop simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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_ast_print.cpp =================================================================== --- clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp +++ clang/test/OpenMP/parallel_master_taskloop_simd_ast_print.cpp @@ -68,7 +68,7 @@ #pragma omp taskgroup task_reduction(+: d) #pragma omp parallel master taskloop simd if(parallel: a) default(none) shared(a, b, argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c:b) // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp parallel master taskloop simd if(parallel: a) default(none) shared(a,b,argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c: b) + // CHECK-NEXT: #pragma omp parallel master taskloop simd if(parallel: a) default(none) shared(a,b,argc) final(b) priority(5) num_tasks(argc) reduction(*: g) aligned(argv: 8) linear(c: step(b)) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 parallel 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}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp parallel master taskloop simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp parallel master taskloop simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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 @@ -80,11 +87,15 @@ N i; N ind; N myind; - N &ref = i; + N &r = i; T sum = (T)0; // CHECK: T sum = (T)0; -#pragma omp simd private(myind, g_ind), linear(ind), aligned(arr), linear(uval(ref)) -// CHECK-NEXT: #pragma omp simd private(myind,g_ind) linear(ind) aligned(arr) linear(uval(ref)) +#ifdef OMP52 +#pragma omp simd private(myind, g_ind), linear(ind), aligned(arr), linear(r: uval) +#else +#pragma omp simd private(myind, g_ind), linear(ind), aligned(arr), linear(uval(r)) +#endif +// CHECK-NEXT: #pragma omp simd private(myind,g_ind) linear(ind) aligned(arr) linear(r: uval) for (i = 0; i < num; ++i) { myind = ind; T cur = arr[myind]; @@ -101,13 +112,17 @@ T res; T val; T lin = 0; - T &ref = res; + T &r = res; // CHECK: T res; // CHECK: T val; // CHECK: T lin = 0; -// CHECK: T &ref = res; - #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref)) -// CHECK-NEXT: #pragma omp simd allocate(res) private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref)) +// CHECK: T &r = res; +#ifdef OMP52 + #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : step(-5)) lastprivate(res) simdlen(5) linear(r: ref) +#else + #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(r)) +#endif +// CHECK-NEXT: #pragma omp simd allocate(res) private(val) safelen(7) linear(lin: step(-5)) lastprivate(res) simdlen(5) linear(r: ref) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; res = val; @@ -148,7 +163,7 @@ // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) allocate(k1) +// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: step(4)) aligned(a: 4) simdlen(4) allocate(k1) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; @@ -161,7 +176,7 @@ int main (int argc, char **argv) { int b = argc, c, d, e, f, g; int k1=0,k2=0; - int &ref = b; + int &r = b; static int *a; // CHECK: static int *a; #pragma omp simd @@ -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 - #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) +#ifdef OMP52 + #pragma omp simd aligned(a:CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(r: val, step(CLEN)) if(a) +#elif OMP5 + #pragma omp simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(val(r): CLEN) if(a) +// OMP50-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) linear(r: val, step(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) + #pragma omp simd aligned(a:CLEN) linear(a:CLEN) safelen(CLEN) collapse( 1 ) simdlen(CLEN) linear(val(r): CLEN) +// OMP45-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) linear(r: val, step(CLEN)) +// OMP51-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) linear(r: val, step(CLEN)) +// OMP52-NEXT: #pragma omp simd aligned(a: CLEN) linear(a: step(CLEN)) safelen(CLEN) collapse(1) simdlen(CLEN) linear(r: val, step(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,11 +1,13 @@ // 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) { - 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 simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -245,13 +247,33 @@ 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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#else #pragma omp simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp simd linear(i: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp simd linear(j: step()) // omp52-error 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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_ast_print.cpp =================================================================== --- clang/test/OpenMP/target_parallel_for_ast_print.cpp +++ clang/test/OpenMP/target_parallel_for_ast_print.cpp @@ -208,7 +208,7 @@ for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); - // CHECK-NEXT: #pragma omp target parallel for 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) + // CHECK-NEXT: #pragma omp target parallel for 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)) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: foo(); 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 target parallel for linear(lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp target parallel for linear(lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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,12 +245,15 @@ 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(); - // CHECK: #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) + // CHECK: #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)) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: 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 @@ -16,8 +18,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 target parallel for simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp target parallel for simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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,11 +246,15 @@ // 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(); - // CHECK: #pragma omp target simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) if(target: argc) reduction(+: h) linear(a: -5) + // CHECK: #pragma omp target simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) if(target: argc) reduction(+: h) linear(a: step(-5)) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: 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; @@ -15,8 +17,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 target simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp target simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -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 2 {{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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#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; @@ -13,8 +15,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; void xxx(int argc) { - int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} -#pragma omp target teams distribute parallel for simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}} + int i, step_sz; // expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp target teams distribute parallel for simd linear(i : step_sz) // expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } 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; @@ -13,8 +15,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; void xxx(int argc) { - int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} -#pragma omp target teams distribute simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}} + int i, step_sz; // expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp target teams distribute simd linear(i : step_sz) // expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } 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; @@ -14,8 +16,8 @@ extern const omp_allocator_handle_t omp_thread_mem_alloc; 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 taskloop simd linear(i, lin : step) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step' is uninitialized when used here}} + int i, lin, step_sz; // expected-note {{initialize the variable 'lin' to silence this warning}} expected-note {{initialize the variable 'step_sz' to silence this warning}} +#pragma omp taskloop simd linear(i, lin : step_sz) // expected-warning {{variable 'lin' is uninitialized when used here}} expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } @@ -255,13 +257,33 @@ 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), step(2)) // omp52-warning {{multiple 'step size' found, ignoring the previous one}} +#else #pragma omp taskloop simd linear(i) +#endif for (int k = 0; k < argc; ++k) ++k; +#ifdef OMP52 + #pragma omp taskloop simd linear(i: val, val) // omp52-warning {{multiple 'linear modifier' found, ignoring the previous one}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp taskloop simd linear(j: step()) // omp52-error 2 {{expected expression}} + for (int k = 0; k < argc; ++k) ++k; + #pragma omp taskloop simd linear(j: pval, step(1)) // omp52-error {{use of undeclared identifier 'pval'}} omp52-warning {{extra tokens at the end of 'simple step modifier' are ignored}} + 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,12 +1,14 @@ // 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) { - int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} + int i, step_sz; // expected-note {{initialize the variable 'step_sz' to silence this warning}} #pragma omp target -#pragma omp teams distribute parallel for simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}} +#pragma omp teams distribute parallel for simd linear(i : step_sz) // expected-warning {{variable 'step_sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; } 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,12 +1,14 @@ // 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) { - int i, step; // expected-note {{initialize the variable 'step' to silence this warning}} + int i, sz; // expected-note {{initialize the variable 'sz' to silence this warning}} #pragma omp target -#pragma omp teams distribute simd linear(i : step) // expected-warning {{variable 'step' is uninitialized when used here}} +#pragma omp teams distribute simd linear(i : sz) // expected-warning {{variable 'sz' is uninitialized when used here}} for (i = 0; i < 10; ++i) ; }