2015-05-20 12:24:19 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -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++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
2014-10-21 11:16:40 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
2019-04-09 03:06:42 +08:00
|
|
|
|
|
|
|
enum omp_allocator_handle_t {
|
|
|
|
omp_null_allocator = 0,
|
|
|
|
omp_default_mem_alloc = 1,
|
|
|
|
omp_large_cap_mem_alloc = 2,
|
|
|
|
omp_const_mem_alloc = 3,
|
|
|
|
omp_high_bw_mem_alloc = 4,
|
|
|
|
omp_low_lat_mem_alloc = 5,
|
|
|
|
omp_cgroup_mem_alloc = 6,
|
|
|
|
omp_pteam_mem_alloc = 7,
|
|
|
|
omp_thread_mem_alloc = 8,
|
|
|
|
KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__
|
|
|
|
};
|
2019-04-03 03:44:46 +08:00
|
|
|
|
2014-10-21 11:16:40 +08:00
|
|
|
template <class T>
|
|
|
|
struct S {
|
|
|
|
T f;
|
|
|
|
S(T a) : f(a) {}
|
|
|
|
S() : f() {}
|
|
|
|
operator T() { return T(); }
|
|
|
|
~S() {}
|
|
|
|
};
|
|
|
|
|
2015-09-10 17:48:30 +08:00
|
|
|
volatile int g __attribute__((aligned(128))) = 1212;
|
2014-12-16 15:00:22 +08:00
|
|
|
|
2016-02-08 17:29:13 +08:00
|
|
|
struct SS {
|
|
|
|
int a;
|
|
|
|
int b : 4;
|
|
|
|
int &c;
|
|
|
|
SS(int &d) : a(0), b(0), c(d) {
|
|
|
|
#pragma omp parallel private(a, b, c)
|
|
|
|
#ifdef LAMBDA
|
|
|
|
[&]() {
|
|
|
|
++this->a, --b, (this)->c /= 1;
|
|
|
|
#pragma omp parallel private(a, b, c)
|
|
|
|
++(this)->a, --b, this->c /= 1;
|
|
|
|
}();
|
|
|
|
#elif defined(BLOCKS)
|
|
|
|
^{
|
|
|
|
++a;
|
|
|
|
--this->b;
|
|
|
|
(this)->c /= 1;
|
|
|
|
#pragma omp parallel private(a, b, c)
|
|
|
|
++(this)->a, --b, this->c /= 1;
|
|
|
|
}();
|
|
|
|
#else
|
|
|
|
++this->a, --b, c /= 1;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct SST {
|
|
|
|
T a;
|
|
|
|
SST() : a(T()) {
|
2019-04-03 03:44:46 +08:00
|
|
|
#pragma omp parallel private(a) allocate(omp_large_cap_mem_alloc:a)
|
2016-02-08 17:29:13 +08:00
|
|
|
#ifdef LAMBDA
|
|
|
|
[&]() {
|
|
|
|
[&]() {
|
|
|
|
++this->a;
|
|
|
|
#pragma omp parallel private(a)
|
|
|
|
++(this)->a;
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
#elif defined(BLOCKS)
|
|
|
|
^{
|
|
|
|
^{
|
|
|
|
++a;
|
|
|
|
#pragma omp parallel private(a)
|
|
|
|
++(this)->a;
|
|
|
|
}();
|
|
|
|
}();
|
|
|
|
#else
|
|
|
|
++(this)->a;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// CHECK: [[SS_TY:%.+]] = type { i{{[0-9]+}}, i8
|
|
|
|
// LAMBDA: [[SS_TY:%.+]] = type { i{{[0-9]+}}, i8
|
|
|
|
// BLOCKS: [[SS_TY:%.+]] = type { i{{[0-9]+}}, i8
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: [[S_FLOAT_TY:%.+]] = type { float }
|
|
|
|
// CHECK: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
|
2016-02-08 17:29:13 +08:00
|
|
|
// CHECK: [[SST_TY:%.+]] = type { i{{[0-9]+}} }
|
2014-10-21 11:16:40 +08:00
|
|
|
template <typename T>
|
|
|
|
T tmain() {
|
|
|
|
S<T> test;
|
2016-02-08 17:29:13 +08:00
|
|
|
SST<T> sst;
|
2015-09-10 17:48:30 +08:00
|
|
|
T t_var __attribute__((aligned(128))) = T();
|
|
|
|
T vec[] __attribute__((aligned(128))) = {1, 2};
|
|
|
|
S<T> s_arr[] __attribute__((aligned(128))) = {1, 2};
|
|
|
|
S<T> var __attribute__((aligned(128))) (3);
|
2014-10-21 11:16:40 +08:00
|
|
|
#pragma omp parallel private(t_var, vec, s_arr, var)
|
|
|
|
{
|
|
|
|
vec[0] = t_var;
|
|
|
|
s_arr[0] = var;
|
|
|
|
}
|
|
|
|
return T();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
2015-09-16 02:56:58 +08:00
|
|
|
static int sivar;
|
2016-02-08 17:29:13 +08:00
|
|
|
SS ss(sivar);
|
2014-12-16 15:00:22 +08:00
|
|
|
#ifdef LAMBDA
|
2018-02-24 03:30:48 +08:00
|
|
|
// LAMBDA: [[G:@.+]] = {{(dso_local )?}}global i{{[0-9]+}} 1212,
|
2014-12-16 15:00:22 +08:00
|
|
|
// LAMBDA-LABEL: @main
|
2016-02-09 20:16:42 +08:00
|
|
|
// LAMBDA: alloca [[SS_TY]],
|
|
|
|
// LAMBDA: alloca [[CAP_TY:%.+]],
|
|
|
|
// LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@[^(]+]]([[CAP_TY]]*
|
2014-12-16 15:00:22 +08:00
|
|
|
[&]() {
|
|
|
|
// LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]](
|
2015-06-23 12:51:00 +08:00
|
|
|
// LAMBDA-NOT: = getelementptr inbounds %{{.+}},
|
2015-09-10 16:12:02 +08:00
|
|
|
// LAMBDA: call{{.*}} void {{.+}} @__kmpc_fork_call({{.+}}, i32 0, {{.+}}* [[OMP_REGION:@.+]] to {{.+}})
|
2015-09-16 02:56:58 +08:00
|
|
|
#pragma omp parallel private(g, sivar)
|
2014-12-16 15:00:22 +08:00
|
|
|
{
|
2016-02-08 21:47:46 +08:00
|
|
|
// LAMBDA: define {{.+}} @{{.+}}([[SS_TY]]*
|
2016-02-08 17:29:13 +08:00
|
|
|
// LAMBDA: store i{{[0-9]+}} 0, i{{[0-9]+}}* %
|
|
|
|
// LAMBDA: store i8
|
|
|
|
// LAMBDA: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[SS_TY]]*)* [[SS_MICROTASK:@.+]] to void
|
|
|
|
// LAMBDA: ret
|
|
|
|
|
|
|
|
// LAMBDA: define internal void [[SS_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
|
|
|
|
// LAMBDA-NOT: getelementptr {{.*}}[[SS_TY]], [[SS_TY]]* %
|
|
|
|
// LAMBDA: call{{.*}} void
|
|
|
|
// LAMBDA: ret void
|
|
|
|
|
|
|
|
// LAMBDA: define internal void @{{.+}}(i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
|
|
|
|
// LAMBDA: [[A_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// LAMBDA: [[B_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// LAMBDA: [[C_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// LAMBDA: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REFA:%.+]],
|
|
|
|
// LAMBDA: store i{{[0-9]+}}* [[C_PRIV]], i{{[0-9]+}}** [[REFC:%.+]],
|
|
|
|
// LAMBDA-NEXT: [[A_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFA]],
|
|
|
|
// LAMBDA-NEXT: [[A_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// LAMBDA-NEXT: [[INC:%.+]] = add nsw i{{[0-9]+}} [[A_VAL]], 1
|
|
|
|
// LAMBDA-NEXT: store i{{[0-9]+}} [[INC]], i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// LAMBDA-NEXT: [[B_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// LAMBDA-NEXT: [[DEC:%.+]] = add nsw i{{[0-9]+}} [[B_VAL]], -1
|
|
|
|
// LAMBDA-NEXT: store i{{[0-9]+}} [[DEC]], i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// LAMBDA-NEXT: [[C_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFC]],
|
|
|
|
// LAMBDA-NEXT: [[C_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// LAMBDA-NEXT: [[DIV:%.+]] = sdiv i{{[0-9]+}} [[C_VAL]], 1
|
|
|
|
// LAMBDA-NEXT: store i{{[0-9]+}} [[DIV]], i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// LAMBDA-NEXT: ret void
|
|
|
|
|
2015-09-10 16:12:02 +08:00
|
|
|
// LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}})
|
2014-12-16 15:00:22 +08:00
|
|
|
// LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
|
2015-09-16 02:56:58 +08:00
|
|
|
// LAMBDA: [[SIVAR_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
|
2014-12-16 15:00:22 +08:00
|
|
|
g = 1;
|
2015-09-16 02:56:58 +08:00
|
|
|
sivar = 2;
|
|
|
|
// LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
|
|
|
|
// LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR_PRIVATE_ADDR]],
|
2015-02-28 03:18:17 +08:00
|
|
|
// LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
|
2014-12-16 15:00:22 +08:00
|
|
|
// LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]]
|
2015-09-16 02:56:58 +08:00
|
|
|
|
|
|
|
// LAMBDA: [[SIVAR_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
|
|
|
|
// LAMBDA: store i{{[0-9]+}}* [[SIVAR_PRIVATE_ADDR]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
|
|
|
|
|
2015-06-30 01:29:50 +08:00
|
|
|
// LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]])
|
2014-12-16 15:00:22 +08:00
|
|
|
[&]() {
|
|
|
|
// LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]])
|
|
|
|
// LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]],
|
|
|
|
g = 2;
|
2015-09-16 02:56:58 +08:00
|
|
|
sivar = 4;
|
2015-02-28 05:19:58 +08:00
|
|
|
// LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]]
|
2015-02-28 03:18:17 +08:00
|
|
|
// LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
|
2015-02-28 05:19:58 +08:00
|
|
|
// LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]]
|
2015-07-14 18:32:29 +08:00
|
|
|
// LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]]
|
2015-09-16 02:56:58 +08:00
|
|
|
// LAMBDA: [[SIVAR_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
|
|
|
|
// LAMBDA: [[SIVAR_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[SIVAR_PTR_REF]]
|
|
|
|
// LAMBDA: store i{{[0-9]+}} 4, i{{[0-9]+}}* [[SIVAR_REF]]
|
2014-12-16 15:00:22 +08:00
|
|
|
}();
|
|
|
|
}
|
|
|
|
}();
|
|
|
|
return 0;
|
|
|
|
#elif defined(BLOCKS)
|
2018-02-24 03:30:48 +08:00
|
|
|
// BLOCKS: [[G:@.+]] = {{(dso_local )?}}global i{{[0-9]+}} 1212,
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS-LABEL: @main
|
2016-02-08 17:29:13 +08:00
|
|
|
// BLOCKS: call
|
2015-06-30 01:29:50 +08:00
|
|
|
// BLOCKS: call{{.*}} void {{%.+}}(i8
|
2014-12-16 15:00:22 +08:00
|
|
|
^{
|
|
|
|
// BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8*
|
2015-06-23 12:51:00 +08:00
|
|
|
// BLOCKS-NOT: = getelementptr inbounds %{{.+}},
|
2015-09-10 16:12:02 +08:00
|
|
|
// BLOCKS: call{{.*}} void {{.+}} @__kmpc_fork_call({{.+}}, i32 0, {{.+}}* [[OMP_REGION:@.+]] to {{.+}})
|
2015-09-16 02:56:58 +08:00
|
|
|
#pragma omp parallel private(g, sivar)
|
2014-12-16 15:00:22 +08:00
|
|
|
{
|
2015-09-10 16:12:02 +08:00
|
|
|
// BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}})
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
|
2015-09-16 02:56:58 +08:00
|
|
|
// BLOCKS: [[SIVAR_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
|
2014-12-16 15:00:22 +08:00
|
|
|
g = 1;
|
2015-09-16 02:56:58 +08:00
|
|
|
sivar = 20;
|
|
|
|
// BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
|
|
|
|
// BLOCKS: store i{{[0-9]+}} 20, i{{[0-9]+}}* [[SIVAR_PRIVATE_ADDR]],
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS-NOT: [[G]]{{[[^:word:]]}}
|
|
|
|
// BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
|
|
|
|
// BLOCKS-NOT: [[G]]{{[[^:word:]]}}
|
2015-09-16 02:56:58 +08:00
|
|
|
// BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
|
|
|
|
// BLOCKS: i{{[0-9]+}}* [[SIVAR_PRIVATE_ADDR]]
|
|
|
|
// BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
|
2015-06-30 01:29:50 +08:00
|
|
|
// BLOCKS: call{{.*}} void {{%.+}}(i8
|
2014-12-16 15:00:22 +08:00
|
|
|
^{
|
|
|
|
// BLOCKS: define {{.+}} void {{@.+}}(i8*
|
|
|
|
g = 2;
|
2015-09-16 02:56:58 +08:00
|
|
|
sivar = 40;
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS-NOT: [[G]]{{[[^:word:]]}}
|
2015-07-14 18:32:29 +08:00
|
|
|
// BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}*
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS-NOT: [[G]]{{[[^:word:]]}}
|
2015-09-16 02:56:58 +08:00
|
|
|
// BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
|
|
|
|
// BLOCKS: store i{{[0-9]+}} 40, i{{[0-9]+}}*
|
|
|
|
// BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
|
2014-12-16 15:00:22 +08:00
|
|
|
// BLOCKS: ret
|
|
|
|
}();
|
|
|
|
}
|
|
|
|
}();
|
|
|
|
return 0;
|
2016-02-08 21:47:46 +08:00
|
|
|
// BLOCKS: define {{.+}} @{{.+}}([[SS_TY]]*
|
2016-02-08 17:29:13 +08:00
|
|
|
// BLOCKS: store i{{[0-9]+}} 0, i{{[0-9]+}}* %
|
|
|
|
// BLOCKS: store i8
|
|
|
|
// BLOCKS: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[SS_TY]]*)* [[SS_MICROTASK:@.+]] to void
|
|
|
|
// BLOCKS: ret
|
|
|
|
|
|
|
|
// BLOCKS: define internal void [[SS_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
|
|
|
|
// BLOCKS-NOT: getelementptr {{.*}}[[SS_TY]], [[SS_TY]]* %
|
|
|
|
// BLOCKS: call{{.*}} void
|
|
|
|
// BLOCKS: ret void
|
|
|
|
|
|
|
|
// BLOCKS: define internal void @{{.+}}(i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
|
|
|
|
// BLOCKS: [[A_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// BLOCKS: [[B_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// BLOCKS: [[C_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// BLOCKS: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REFA:%.+]],
|
|
|
|
// BLOCKS: store i{{[0-9]+}}* [[C_PRIV]], i{{[0-9]+}}** [[REFC:%.+]],
|
|
|
|
// BLOCKS-NEXT: [[A_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFA]],
|
|
|
|
// BLOCKS-NEXT: [[A_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// BLOCKS-NEXT: [[INC:%.+]] = add nsw i{{[0-9]+}} [[A_VAL]], 1
|
|
|
|
// BLOCKS-NEXT: store i{{[0-9]+}} [[INC]], i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// BLOCKS-NEXT: [[B_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// BLOCKS-NEXT: [[DEC:%.+]] = add nsw i{{[0-9]+}} [[B_VAL]], -1
|
|
|
|
// BLOCKS-NEXT: store i{{[0-9]+}} [[DEC]], i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// BLOCKS-NEXT: [[C_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFC]],
|
|
|
|
// BLOCKS-NEXT: [[C_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// BLOCKS-NEXT: [[DIV:%.+]] = sdiv i{{[0-9]+}} [[C_VAL]], 1
|
|
|
|
// BLOCKS-NEXT: store i{{[0-9]+}} [[DIV]], i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// BLOCKS-NEXT: ret void
|
2014-12-16 15:00:22 +08:00
|
|
|
#else
|
2014-10-21 11:16:40 +08:00
|
|
|
S<float> test;
|
2014-12-16 15:00:22 +08:00
|
|
|
int t_var = 0;
|
2014-10-21 11:16:40 +08:00
|
|
|
int vec[] = {1, 2};
|
|
|
|
S<float> s_arr[] = {1, 2};
|
|
|
|
S<float> var(3);
|
2015-09-16 02:56:58 +08:00
|
|
|
#pragma omp parallel private(t_var, vec, s_arr, var, sivar)
|
2014-10-21 11:16:40 +08:00
|
|
|
{
|
|
|
|
vec[0] = t_var;
|
|
|
|
s_arr[0] = var;
|
2015-09-16 02:56:58 +08:00
|
|
|
sivar = 3;
|
2014-10-21 11:16:40 +08:00
|
|
|
}
|
|
|
|
return tmain<int>();
|
2014-12-16 15:00:22 +08:00
|
|
|
#endif
|
2014-10-21 11:16:40 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: define i{{[0-9]+}} @main()
|
|
|
|
// CHECK: [[TEST:%.+]] = alloca [[S_FLOAT_TY]],
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]])
|
2015-09-10 16:12:02 +08:00
|
|
|
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 0, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*)* [[MAIN_MICROTASK:@.+]] to void
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: = call i{{.+}} [[TMAIN_INT:@.+]]()
|
|
|
|
// CHECK: call void [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]*
|
|
|
|
// CHECK: ret
|
|
|
|
//
|
2015-09-10 16:12:02 +08:00
|
|
|
// CHECK: define internal void [[MAIN_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}})
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
|
|
|
|
// CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
|
|
|
|
// CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
|
2015-09-16 02:56:58 +08:00
|
|
|
// CHECK: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_REF:%.+]]
|
|
|
|
// CHECK-NOT: [[T_VAR_PRIV]]
|
|
|
|
// CHECK-NOT: [[VEC_PRIV]]
|
|
|
|
// CHECK: {{.+}}:
|
|
|
|
// CHECK: [[S_ARR_PRIV_ITEM:%.+]] = phi [[S_FLOAT_TY]]*
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR]]([[S_FLOAT_TY]]* [[S_ARR_PRIV_ITEM]])
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK-NOT: [[T_VAR_PRIV]]
|
|
|
|
// CHECK-NOT: [[VEC_PRIV]]
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK-DAG: call void [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
|
|
|
|
// CHECK-DAG: call void [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]*
|
|
|
|
// CHECK: ret void
|
|
|
|
|
|
|
|
// CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]()
|
|
|
|
// CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]],
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]])
|
2015-09-10 16:12:02 +08:00
|
|
|
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 0, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*)* [[TMAIN_MICROTASK:@.+]] to void
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: call void [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]*
|
|
|
|
// CHECK: ret
|
|
|
|
//
|
2016-02-17 23:36:39 +08:00
|
|
|
// CHECK: define {{.+}} @{{.+}}([[SS_TY]]*
|
2016-02-08 17:29:13 +08:00
|
|
|
// CHECK: store i{{[0-9]+}} 0, i{{[0-9]+}}* %
|
|
|
|
// CHECK: store i8
|
|
|
|
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[SS_TY]]*)* [[SS_MICROTASK:@.+]] to void
|
|
|
|
// CHECK: ret
|
|
|
|
|
|
|
|
// CHECK: define internal void [[SS_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SS_TY]]* %{{.+}})
|
|
|
|
// CHECK: [[A_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// CHECK: [[B_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// CHECK: [[C_PRIV:%.+]] = alloca i{{[0-9]+}},
|
|
|
|
// CHECK: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REFA:%.+]],
|
|
|
|
// CHECK: store i{{[0-9]+}}* [[C_PRIV]], i{{[0-9]+}}** [[REFC:%.+]],
|
|
|
|
// CHECK-NEXT: [[A_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFA]],
|
|
|
|
// CHECK-NEXT: [[A_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// CHECK-NEXT: [[INC:%.+]] = add nsw i{{[0-9]+}} [[A_VAL]], 1
|
|
|
|
// CHECK-NEXT: store i{{[0-9]+}} [[INC]], i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// CHECK-NEXT: [[B_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// CHECK-NEXT: [[DEC:%.+]] = add nsw i{{[0-9]+}} [[B_VAL]], -1
|
|
|
|
// CHECK-NEXT: store i{{[0-9]+}} [[DEC]], i{{[0-9]+}}* [[B_PRIV]],
|
|
|
|
// CHECK-NEXT: [[C_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REFC]],
|
|
|
|
// CHECK-NEXT: [[C_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// CHECK-NEXT: [[DIV:%.+]] = sdiv i{{[0-9]+}} [[C_VAL]], 1
|
|
|
|
// CHECK-NEXT: store i{{[0-9]+}} [[DIV]], i{{[0-9]+}}* [[C_PRIV]],
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
|
2015-09-10 16:12:02 +08:00
|
|
|
// CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}})
|
2015-09-10 17:48:30 +08:00
|
|
|
// CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}}, align 128
|
|
|
|
// CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}], align 128
|
|
|
|
// CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]], align 128
|
|
|
|
// CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]], align 128
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_REF:%.+]]
|
|
|
|
// CHECK-NOT: [[T_VAR_PRIV]]
|
|
|
|
// CHECK-NOT: [[VEC_PRIV]]
|
2015-09-16 02:56:58 +08:00
|
|
|
// CHECK-NOT: [[SIVAR_PRIV]]
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK: {{.+}}:
|
|
|
|
// CHECK: [[S_ARR_PRIV_ITEM:%.+]] = phi [[S_INT_TY]]*
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR]]([[S_INT_TY]]* [[S_ARR_PRIV_ITEM]])
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK-NOT: [[T_VAR_PRIV]]
|
|
|
|
// CHECK-NOT: [[VEC_PRIV]]
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR]]([[S_INT_TY]]* [[VAR_PRIV]])
|
2014-10-21 11:16:40 +08:00
|
|
|
// CHECK-DAG: call void [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]])
|
|
|
|
// CHECK-DAG: call void [[S_INT_TY_DESTR]]([[S_INT_TY]]*
|
|
|
|
// CHECK: ret void
|
2016-02-08 17:29:13 +08:00
|
|
|
|
2018-10-15 23:43:00 +08:00
|
|
|
// CHECK: define {{.+}} @{{.+}}([[SST_TY]]* %
|
2016-02-08 17:29:13 +08:00
|
|
|
// CHECK: store i{{[0-9]+}} 0, i{{[0-9]+}}* %
|
|
|
|
// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[SST_TY]]*)* [[SST_MICROTASK:@.+]] to void
|
|
|
|
// CHECK: ret
|
|
|
|
|
|
|
|
// CHECK: define internal void [[SST_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SST_TY]]* %{{.+}})
|
2019-04-03 03:44:46 +08:00
|
|
|
// CHECK: [[GTID_ADDR_PTR:%.+]] = alloca i32*,
|
|
|
|
// CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_PTR]],
|
|
|
|
// CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]],
|
2019-04-09 03:06:42 +08:00
|
|
|
// CHECK: [[A_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 4, i8* inttoptr (i64 2 to i8*))
|
2019-04-03 03:44:46 +08:00
|
|
|
// CHECK: [[A_PRIV:%.+]] = bitcast i8* [[A_VOID_PTR]] to i32*
|
2016-02-08 17:29:13 +08:00
|
|
|
// CHECK: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REF:%.+]],
|
|
|
|
// CHECK-NEXT: [[A_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REF]],
|
|
|
|
// CHECK-NEXT: [[A_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A_PRIV]],
|
|
|
|
// CHECK-NEXT: [[INC:%.+]] = add nsw i{{[0-9]+}} [[A_VAL]], 1
|
|
|
|
// CHECK-NEXT: store i{{[0-9]+}} [[INC]], i{{[0-9]+}}* [[A_PRIV]],
|
2019-04-09 03:06:42 +08:00
|
|
|
// CHECK-NEXT: call void @__kmpc_free(i32 [[GTID]], i8* [[A_VOID_PTR]], i8* inttoptr (i64 2 to i8*))
|
2016-02-08 17:29:13 +08:00
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
|
2014-10-21 11:16:40 +08:00
|
|
|
#endif
|
|
|
|
|