forked from OSchip/llvm-project
[OPENMP50]Add support for if clause for simd part in distribute parallel for simd directive.
According to OpenMP 5.0, the if clause can be applied to simd subdirective in the combined directives.
This commit is contained in:
parent
796fa662f1
commit
52812f2ade
|
@ -4695,6 +4695,8 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
|
|||
Res = ActOnOpenMPDistributeParallelForSimdDirective(
|
||||
ClausesWithImplicit, AStmt, StartLoc, EndLoc, VarsWithInheritedDSA);
|
||||
AllowedNameModifiers.push_back(OMPD_parallel);
|
||||
if (LangOpts.OpenMP >= 50)
|
||||
AllowedNameModifiers.push_back(OMPD_simd);
|
||||
break;
|
||||
case OMPD_distribute_simd:
|
||||
Res = ActOnOpenMPDistributeSimdDirective(
|
||||
|
@ -10708,6 +10710,12 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
|
|||
if (NameModifier == OMPD_unknown || NameModifier == OMPD_simd)
|
||||
CaptureRegion = OMPD_taskloop;
|
||||
break;
|
||||
case OMPD_distribute_parallel_for_simd:
|
||||
if (OpenMPVersion <= 45)
|
||||
break;
|
||||
if (NameModifier == OMPD_unknown || NameModifier == OMPD_simd)
|
||||
CaptureRegion = OMPD_parallel;
|
||||
break;
|
||||
case OMPD_cancel:
|
||||
case OMPD_parallel:
|
||||
case OMPD_parallel_sections:
|
||||
|
@ -10718,7 +10726,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
|
|||
case OMPD_target_teams_distribute:
|
||||
case OMPD_target_teams_distribute_simd:
|
||||
case OMPD_distribute_parallel_for:
|
||||
case OMPD_distribute_parallel_for_simd:
|
||||
case OMPD_task:
|
||||
case OMPD_taskloop:
|
||||
case OMPD_master_taskloop:
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s -Wno-openmp-target | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -ast-print %s -Wno-openmp-target | FileCheck %s --check-prefix CHECK --check-prefix OMP45
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target | FileCheck %s
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target | FileCheck %s --check-prefix CHECK --check-prefix OMP45
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -ast-print %s -Wno-openmp-target -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-target | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -ast-print %s -Wno-openmp-target | 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
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target | FileCheck %s
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target | FileCheck %s --check-prefix CHECK --check-prefix OMP45
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -ast-print %s -Wno-openmp-target -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s -DOMP5
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -Wno-openmp-target -DOMP5 | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
// expected-no-diagnostics
|
||||
|
||||
#ifndef HEADER
|
||||
|
@ -143,11 +149,16 @@ int main(int argc, char **argv) {
|
|||
int i;
|
||||
#pragma omp target
|
||||
#pragma omp teams
|
||||
#ifdef OMP5
|
||||
#pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8) if(simd: argc)
|
||||
#else
|
||||
#pragma omp distribute parallel for simd aligned(x:8) linear(i:2) safelen(8) simdlen(8)
|
||||
#endif // OMP5
|
||||
for (i = 0; i < 100; i++)
|
||||
for (int j = 0; j < 200; j++)
|
||||
a += h + x[j];
|
||||
// CHECK: #pragma omp distribute parallel for simd aligned(x: 8) linear(i: 2) safelen(8) simdlen(8)
|
||||
// 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)
|
||||
// CHECK-NEXT: for (i = 0; i < 100; i++)
|
||||
// CHECK-NEXT: for (int j = 0; j < 200; j++)
|
||||
// CHECK-NEXT: a += h + x[j];
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix OMP45
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix OMP45
|
||||
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix OMP50
|
||||
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=45 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s
|
||||
// RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=50 -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
||||
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
||||
// expected-no-diagnostics
|
||||
#ifndef HEADER
|
||||
|
@ -143,7 +149,8 @@ int main() {
|
|||
// CHECK: define{{.+}} void [[OMP_TEAMS_OUTLINED_2]](
|
||||
|
||||
// CHECK: call void @__kmpc_for_static_init_4(
|
||||
// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 2, {{.+}}* [[OMP_OUTLINED_4:@.+]] to void
|
||||
// OMP45: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 2, {{.+}}* [[OMP_OUTLINED_4:@.+]] to void
|
||||
// OMP50: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 3, {{.+}}* [[OMP_OUTLINED_4:@.+]] to void
|
||||
// CHECK: call void @__kmpc_serialized_parallel(
|
||||
// CHECK: call void [[OMP_OUTLINED_4:@.+]](
|
||||
// CHECK: call void @__kmpc_end_serialized_parallel(
|
||||
|
@ -194,4 +201,9 @@ int main() {
|
|||
// CHECK: call {{.*}}void @{{.+}}fn3
|
||||
// CHECK: call void @__kmpc_for_static_fini(
|
||||
// CHECK: ret void
|
||||
|
||||
// OMP45-NOT: !{!"llvm.loop.vectorize.enable", i1 false}
|
||||
// CHECK-DAG: !{!"llvm.loop.vectorize.enable", i1 true}
|
||||
// OMP50-DAG: !{!"llvm.loop.vectorize.enable", i1 false}
|
||||
// OMP45-NOT: !{!"llvm.loop.vectorize.enable", i1 false}
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue