2018-01-17 00:27:49 +08:00
|
|
|
// Test host codegen.
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32
|
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
|
|
|
|
|
|
|
// Test target codegen - host bc file has to be created first.
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-64
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-64
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-32
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -fopenmp-version=45 -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix TCHECK --check-prefix TCHECK-32
|
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck --check-prefix SIMD-ONLY1 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm-bc %s -o %t-x86-host.bc
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck --check-prefix SIMD-ONLY1 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -emit-pch -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple i386-unknown-unknown -fopenmp-targets=i386-pc-linux-gnu -std=c++11 -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY1 %s
|
|
|
|
// SIMD-ONLY1-NOT: {{__kmpc|__tgt}}
|
|
|
|
|
|
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
// CHECK-DAG: [[TT:%.+]] = type { i64, i8 }
|
|
|
|
// CHECK-DAG: [[ENTTY:%.+]] = type { i8*, i8*, i[[SZ:32|64]], i32, i32 }
|
|
|
|
|
|
|
|
// TCHECK: [[ENTTY:%.+]] = type { i8*, i8*, i{{32|64}}, i32, i32 }
|
|
|
|
|
2019-06-26 00:00:43 +08:00
|
|
|
// CHECK-DAG: [[SIZET:@.+]] = private unnamed_addr constant [2 x i64] [i64 0, i64 4]
|
2018-07-20 00:34:13 +08:00
|
|
|
// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 544, i64 800]
|
2018-05-08 22:16:57 +08:00
|
|
|
// CHECK-DAG: @{{.*}} = weak constant i8 0
|
2018-01-17 00:27:49 +08:00
|
|
|
|
2018-03-31 02:31:07 +08:00
|
|
|
// TCHECK: @{{.+}} = weak constant [[ENTTY]]
|
2018-01-17 00:27:49 +08:00
|
|
|
// TCHECK: @{{.+}} = {{.*}}constant [[ENTTY]]
|
2018-03-31 02:31:07 +08:00
|
|
|
// TCHECK-NOT: @{{.+}} = weak constant [[ENTTY]]
|
2018-01-17 00:27:49 +08:00
|
|
|
|
|
|
|
// Check target registration is registered as a Ctor.
|
2019-10-16 02:42:47 +08:00
|
|
|
// CHECK: appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @.omp_offloading.requires_reg, i8* null }]
|
2018-01-17 00:27:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
template<typename tx, typename ty>
|
|
|
|
struct TT{
|
|
|
|
tx X;
|
|
|
|
ty Y;
|
|
|
|
};
|
|
|
|
|
|
|
|
int global;
|
|
|
|
extern int global;
|
|
|
|
|
|
|
|
// CHECK: define {{.*}}[[FOO:@.+]](
|
|
|
|
int foo(int n) {
|
|
|
|
int a = 0;
|
|
|
|
short aa = 0;
|
|
|
|
float b[10];
|
|
|
|
float bn[n];
|
|
|
|
double c[5][10];
|
|
|
|
double cn[5][n];
|
|
|
|
TT<long long, char> d;
|
|
|
|
static long *plocal;
|
|
|
|
|
2020-05-28 22:41:01 +08:00
|
|
|
// CHECK: [[ADD:%.+]] = add nsw i32
|
|
|
|
// CHECK: store i32 [[ADD]], i32* [[DEVICE_CAP:%.+]],
|
|
|
|
// CHECK: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 0
|
|
|
|
// CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: store i32 [[DEV]], i32* [[GEP]],
|
|
|
|
// CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @1, i32 [[GTID:%.+]], i32 1, i[[SZ]] {{20|40}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY0:@.+]] to i32 (i32, i8*)*))
|
|
|
|
// CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY0:%.+]]*
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 0
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 1
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 2
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 3
|
|
|
|
// CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* %{{.+}} to i8*
|
|
|
|
// CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @1, i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null)
|
|
|
|
// CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]])
|
|
|
|
// CHECK: call i32 [[TASK_ENTRY0]](i32 [[GTID]], [[TASK_TY0]]* [[BC_TASK]])
|
|
|
|
// CHECK: call void @__kmpc_omp_task_complete_if0(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]])
|
|
|
|
#pragma omp target parallel device(global + a) depend(in \
|
|
|
|
: global) depend(out \
|
|
|
|
: a, b, cn[4])
|
2018-01-17 00:27:49 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: [[ADD:%.+]] = add nsw i32
|
|
|
|
// CHECK: store i32 [[ADD]], i32* [[DEVICE_CAP:%.+]],
|
|
|
|
|
|
|
|
// CHECK: [[BOOL:%.+]] = icmp ne i32 %{{.+}}, 0
|
|
|
|
// CHECK: br i1 [[BOOL]], label %[[THEN:.+]], label %[[ELSE:.+]]
|
|
|
|
// CHECK: [[THEN]]:
|
|
|
|
// CHECK-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[PADDR0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%.+]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: [[CBPADDR0:%.+]] = bitcast i8** [[BPADDR0]] to i[[SZ]]**
|
|
|
|
// CHECK-DAG: [[CPADDR0:%.+]] = bitcast i8** [[PADDR0]] to i[[SZ]]**
|
|
|
|
// CHECK-DAG: store i[[SZ]]* [[BP0:%[^,]+]], i[[SZ]]** [[CBPADDR0]]
|
|
|
|
// CHECK-DAG: store i[[SZ]]* [[BP0]], i[[SZ]]** [[CPADDR0]]
|
|
|
|
|
|
|
|
// CHECK-DAG: [[BPADDR1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 1
|
|
|
|
// CHECK-DAG: [[PADDR1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 1
|
|
|
|
// CHECK-DAG: [[CBPADDR1:%.+]] = bitcast i8** [[BPADDR1]] to i[[SZ]]*
|
|
|
|
// CHECK-DAG: [[CPADDR1:%.+]] = bitcast i8** [[PADDR1]] to i[[SZ]]*
|
|
|
|
// CHECK-DAG: store i[[SZ]] [[BP1:%[^,]+]], i[[SZ]]* [[CBPADDR1]]
|
|
|
|
// CHECK-DAG: store i[[SZ]] [[BP1]], i[[SZ]]* [[CPADDR1]]
|
|
|
|
// CHECK-DAG: getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP]], i32 0, i32 0
|
|
|
|
// CHECK-DAG: getelementptr inbounds [2 x i8*], [2 x i8*]* [[P]], i32 0, i32 0
|
|
|
|
// CHECK: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2
|
|
|
|
// CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: store i32 [[DEV]], i32* [[GEP]],
|
2019-06-19 22:26:43 +08:00
|
|
|
// CHECK: [[DEV1:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64
|
2018-01-17 00:27:49 +08:00
|
|
|
|
2020-10-27 12:02:23 +08:00
|
|
|
// CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_target_task_alloc(%struct.ident_t* @{{.*}}, i32 [[GTID]], i32 1, i[[SZ]] {{104|60}}, i[[SZ]] {{16|12}}, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY1_:@.+]] to i32 (i32, i8*)*), i64 [[DEV2]])
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY1_:%.+]]*
|
2020-04-06 23:21:43 +08:00
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 0
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 1
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 2
|
|
|
|
// CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* %{{.+}} to i8*
|
2020-05-28 22:41:01 +08:00
|
|
|
// CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null)
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: br label %[[EXIT:.+]]
|
|
|
|
|
|
|
|
// CHECK: [[ELSE]]:
|
|
|
|
// CHECK-NOT: getelementptr inbounds [2 x i8*], [2 x i8*]*
|
|
|
|
// CHECK: [[GEP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2
|
|
|
|
// CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: store i32 [[DEV]], i32* [[GEP]],
|
2019-06-19 22:26:43 +08:00
|
|
|
// CHECK: [[DEV1:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: [[DEV2:%.+]] = sext i32 [[DEV1]] to i64
|
2018-01-17 00:27:49 +08:00
|
|
|
|
2020-05-28 22:41:01 +08:00
|
|
|
// CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_target_task_alloc(%struct.ident_t* @1, i32 [[GTID]], i32 1, i[[SZ]] {{56|28}}, i[[SZ]] {{16|12}}, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY1__:@.+]] to i32 (i32, i8*)*), i64 [[DEV2]])
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY1__:%.+]]*
|
2020-04-06 23:21:43 +08:00
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 0
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 1
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 2
|
|
|
|
// CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* %{{.+}} to i8*
|
2020-05-28 22:41:01 +08:00
|
|
|
// CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null)
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: br label %[[EXIT:.+]]
|
|
|
|
// CHECK: [[EXIT]]:
|
|
|
|
|
2020-05-28 22:41:01 +08:00
|
|
|
#pragma omp target parallel device(global + a) nowait depend(inout \
|
|
|
|
: global, a, bn) if (target \
|
|
|
|
: a)
|
2018-01-17 00:27:49 +08:00
|
|
|
{
|
|
|
|
static int local1;
|
|
|
|
*plocal = global;
|
|
|
|
local1 = global;
|
|
|
|
}
|
|
|
|
|
2020-05-28 22:41:01 +08:00
|
|
|
// CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @1, i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*))
|
|
|
|
// CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]*
|
|
|
|
// CHECK: getelementptr %struct.kmp_depend_info, %struct.kmp_depend_info* %{{.+}}, i[[SZ]] 0
|
|
|
|
// CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* %{{.+}} to i8*
|
|
|
|
// CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @1, i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null)
|
|
|
|
// CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]])
|
|
|
|
// CHECK: call i32 [[TASK_ENTRY2]](i32 [[GTID]], [[TASK_TY2]]* [[BC_TASK]])
|
|
|
|
// CHECK: call void @__kmpc_omp_task_complete_if0(%struct.ident_t* @1, i32 [[GTID]], i8* [[TASK]])
|
|
|
|
#pragma omp target parallel if (0) firstprivate(global) depend(out \
|
|
|
|
: global)
|
2018-01-17 00:27:49 +08:00
|
|
|
{
|
|
|
|
global += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check that the offloading functions are emitted and that the arguments are
|
|
|
|
// correct and loaded correctly for the target regions in foo().
|
|
|
|
|
|
|
|
// CHECK: define internal void [[HVT0:@.+]]()
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal{{.*}} i32 [[TASK_ENTRY0]](i32{{.*}}, [[TASK_TY0]]* noalias %1)
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: store void (i8*, ...)* null, void (i8*, ...)** %
|
|
|
|
// CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 0
|
|
|
|
// CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64
|
2020-11-20 00:56:59 +08:00
|
|
|
// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i64* null, i64* null, i8** null, i8** null, i32 1, i32 0)
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0
|
|
|
|
// CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]]
|
|
|
|
// CHECK: [[FAIL]]
|
|
|
|
// CHECK: call void [[HVT0]]()
|
|
|
|
// CHECK-NEXT: br label %[[END]]
|
|
|
|
// CHECK: [[END]]
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
|
|
|
// CHECK: define internal void [[HVT1:@.+]](i[[SZ]]* %{{.+}}, i[[SZ]] %{{.+}})
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal{{.*}} i32 [[TASK_ENTRY1_]](i32{{.*}}, [[TASK_TY1_]]* noalias %1)
|
2021-03-30 01:26:42 +08:00
|
|
|
// CHECK: [[FN:%.+]] = bitcast void (i8*, ...)* {{%.*}} to void (i8*,
|
|
|
|
// CHECK: call void [[FN]](
|
2019-06-26 00:00:43 +08:00
|
|
|
// CHECK: [[SZT:%.+]] = getelementptr inbounds [2 x i64], [2 x i64]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2
|
|
|
|
// CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]],
|
|
|
|
// CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64
|
2020-11-20 00:56:59 +08:00
|
|
|
// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_nowait_mapper(%struct.ident_t* @{{.+}}, i64 [[DEVICE]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i64* [[SZT]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i8** null, i8** null, i32 1, i32 0)
|
2018-01-17 00:27:49 +08:00
|
|
|
|
|
|
|
// CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0
|
|
|
|
// CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]]
|
|
|
|
// CHECK: [[FAIL]]
|
|
|
|
// CHECK: [[BP0:%.+]] = load i[[SZ]]*, i[[SZ]]** %
|
2020-01-18 09:39:04 +08:00
|
|
|
// CHECK: [[BP1_I32:%.+]] = load i32, i32* @
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK-64: [[BP1_CAST:%.+]] = bitcast i[[SZ]]* [[BP1_PTR:%.+]] to i32*
|
|
|
|
// CHECK-64: store i32 [[BP1_I32]], i32* [[BP1_CAST]],
|
|
|
|
// CHECK-32: store i32 [[BP1_I32]], i32* [[BP1_PTR:%.+]],
|
|
|
|
// CHECK: [[BP1:%.+]] = load i[[SZ]], i[[SZ]]* [[BP1_PTR]],
|
|
|
|
// CHECK: call void [[HVT1]](i[[SZ]]* [[BP0]], i[[SZ]] [[BP1]])
|
|
|
|
// CHECK-NEXT: br label %[[END]]
|
|
|
|
// CHECK: [[END]]
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal{{.*}} i32 [[TASK_ENTRY1__]](i32{{.*}}, [[TASK_TY1__]]* noalias %1)
|
2021-03-30 01:26:42 +08:00
|
|
|
// CHECK: [[FN:%.+]] = bitcast void (i8*, ...)* {{%.*}} to void (i8*,
|
|
|
|
// CHECK: call void [[FN]](
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2
|
|
|
|
// CHECK: [[BP0:%.+]] = load i[[SZ]]*, i[[SZ]]** %
|
2020-01-18 09:39:04 +08:00
|
|
|
// CHECK: [[BP1_I32:%.+]] = load i32, i32* @
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK-64: [[BP1_CAST:%.+]] = bitcast i[[SZ]]* [[BP1_PTR:%.+]] to i32*
|
|
|
|
// CHECK-64: store i32 [[BP1_I32]], i32* [[BP1_CAST]],
|
|
|
|
// CHECK-32: store i32 [[BP1_I32]], i32* [[BP1_PTR:%.+]],
|
|
|
|
// CHECK: [[BP1:%.+]] = load i[[SZ]], i[[SZ]]* [[BP1_PTR]],
|
|
|
|
// CHECK: call void [[HVT1]](i[[SZ]]* [[BP0]], i[[SZ]] [[BP1]])
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
|
|
|
// CHECK: define internal void [[HVT2:@.+]](i[[SZ]] %{{.+}})
|
|
|
|
// Create stack storage and store argument in there.
|
|
|
|
// CHECK: [[AA_ADDR:%.+]] = alloca i[[SZ]], align
|
|
|
|
// CHECK: store i[[SZ]] %{{.+}}, i[[SZ]]* [[AA_ADDR]], align
|
|
|
|
// CHECK-64: [[AA_CADDR:%.+]] = bitcast i[[SZ]]* [[AA_ADDR]] to i32*
|
|
|
|
// CHECK-64: load i32, i32* [[AA_CADDR]], align
|
|
|
|
// CHECK-32: load i32, i32* [[AA_ADDR]], align
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal{{.*}} i32 [[TASK_ENTRY2]](i32{{.*}}, [[TASK_TY2]]* noalias %1)
|
2021-03-30 01:26:42 +08:00
|
|
|
// CHECK: [[FN:%.+]] = bitcast void (i8*, ...)* {{%.*}} to void (i8*,
|
|
|
|
// CHECK: call void [[FN]](
|
2018-01-17 00:27:49 +08:00
|
|
|
// CHECK: [[BP1_I32:%.+]] = load i32, i32* %
|
|
|
|
// CHECK-64: [[BP1_CAST:%.+]] = bitcast i[[SZ]]* [[BP1_PTR:%.+]] to i32*
|
|
|
|
// CHECK-64: store i32 [[BP1_I32]], i32* [[BP1_CAST]],
|
|
|
|
// CHECK-32: store i32 [[BP1_I32]], i32* [[BP1_PTR:%.+]],
|
|
|
|
// CHECK: [[BP1:%.+]] = load i[[SZ]], i[[SZ]]* [[BP1_PTR]],
|
|
|
|
// CHECK: call void [[HVT2]](i[[SZ]] [[BP1]])
|
|
|
|
// CHECK: ret i32 0
|
|
|
|
|
2019-05-22 03:42:01 +08:00
|
|
|
// CHECK: define internal void @.omp_offloading.requires_reg()
|
|
|
|
// CHECK: call void @__tgt_register_requires(i64 1)
|
|
|
|
// CHECK: ret void
|
2018-01-17 00:27:49 +08:00
|
|
|
|
|
|
|
#endif
|