2015-07-02 12:17:07 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s
|
2015-07-02 12:36:13 +08:00
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
|
2015-07-02 12:17:07 +08:00
|
|
|
// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
2015-07-02 12:17:07 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
int main (int argc, char **argv) {
|
|
|
|
// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(
|
|
|
|
#pragma omp parallel
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point parallel
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp cancel parallel
|
2015-07-02 12:17:07 +08:00
|
|
|
argv[0][0] = argc;
|
|
|
|
}
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
|
2015-07-02 12:17:07 +08:00
|
|
|
#pragma omp sections
|
|
|
|
{
|
2015-09-15 20:52:43 +08:00
|
|
|
{
|
2015-07-02 12:17:07 +08:00
|
|
|
#pragma omp cancellation point sections
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp cancel sections
|
|
|
|
}
|
2015-07-02 12:17:07 +08:00
|
|
|
}
|
2016-01-22 16:56:50 +08:00
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID]], i32 3)
|
2016-01-22 16:56:50 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void @__kmpc_barrier(%struct.ident_t*
|
2015-07-03 17:56:58 +08:00
|
|
|
#pragma omp sections
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point sections
|
|
|
|
#pragma omp section
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point sections
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp cancel sections
|
2015-07-03 17:56:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID]], i32 3)
|
2015-07-02 12:17:07 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID]], i32 3)
|
2015-07-03 17:56:58 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
2015-07-02 12:17:07 +08:00
|
|
|
#pragma omp for
|
|
|
|
for (int i = 0; i < argc; ++i) {
|
|
|
|
#pragma omp cancellation point for
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp cancel for
|
2015-07-02 12:17:07 +08:00
|
|
|
}
|
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID]], i32 2)
|
2015-07-02 12:17:07 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void @__kmpc_barrier(%struct.ident_t*
|
2015-07-02 12:17:07 +08:00
|
|
|
#pragma omp task
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point taskgroup
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp cancel taskgroup
|
2015-07-02 12:17:07 +08:00
|
|
|
}
|
|
|
|
// CHECK: call i8* @__kmpc_omp_task_alloc(
|
|
|
|
// CHECK: call i32 @__kmpc_omp_task(
|
2017-02-18 02:32:58 +08:00
|
|
|
#pragma omp task
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point taskgroup
|
|
|
|
}
|
|
|
|
// CHECK: call i8* @__kmpc_omp_task_alloc(
|
|
|
|
// CHECK: call i32 @__kmpc_omp_task(
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp parallel sections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point sections
|
|
|
|
#pragma omp cancel sections
|
|
|
|
}
|
|
|
|
}
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp parallel sections
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point sections
|
|
|
|
#pragma omp cancel sections
|
|
|
|
}
|
|
|
|
#pragma omp section
|
|
|
|
{
|
|
|
|
#pragma omp cancellation point sections
|
|
|
|
}
|
|
|
|
}
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
|
2015-09-15 20:52:43 +08:00
|
|
|
#pragma omp parallel for
|
|
|
|
for (int i = 0; i < argc; ++i) {
|
|
|
|
#pragma omp cancellation point for
|
|
|
|
#pragma omp cancel for
|
|
|
|
}
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: call void (%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(
|
2015-07-02 12:17:07 +08:00
|
|
|
return argc;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}},
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 1)
|
2015-07-02 12:17:07 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]],
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label %[[RETURN:.+]]
|
|
|
|
// CHECK: [[RETURN]]
|
|
|
|
// CHECK: ret void
|
|
|
|
|
|
|
|
// CHECK: define internal i32 @{{[^(]+}}(i32
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 4)
|
2017-02-18 02:32:58 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]],
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label %[[RETURN:.+]]
|
|
|
|
// CHECK: [[RETURN]]
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
|
|
|
// CHECK: define internal i32 @{{[^(]+}}(i32
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 4)
|
2015-07-02 12:17:07 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]],
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label %[[RETURN:.+]]
|
|
|
|
// CHECK: [[RETURN]]
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
2015-09-15 20:52:43 +08:00
|
|
|
// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
|
2016-01-22 16:56:50 +08:00
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 3)
|
2016-01-22 16:56:50 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
2015-09-15 20:52:43 +08:00
|
|
|
// CHECK: ret void
|
|
|
|
|
|
|
|
// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}})
|
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 3)
|
2015-09-15 20:52:43 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID]], i32 3)
|
2015-09-15 20:52:43 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
|
|
|
// CHECK: ret void
|
|
|
|
|
|
|
|
// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}},
|
|
|
|
// CHECK: call void @__kmpc_for_static_init_4(
|
2018-04-17 01:59:34 +08:00
|
|
|
// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%struct.ident_t* {{[^,]+}}, i32 [[GTID:%.+]], i32 2)
|
2015-09-15 20:52:43 +08:00
|
|
|
// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0
|
|
|
|
// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]]
|
|
|
|
// CHECK: [[EXIT]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: [[CONTINUE]]
|
|
|
|
// CHECK: br label
|
|
|
|
// CHECK: call void @__kmpc_for_static_fini(
|
|
|
|
// CHECK: ret void
|
|
|
|
|
2015-07-02 12:17:07 +08:00
|
|
|
#endif
|