2016-12-23 08:23:01 +08:00
|
|
|
// RUN: %clang_cc1 -verify -fopenmp -x c -emit-llvm %s -triple %itanium_abi_triple -o - -femit-all-decls -disable-llvm-passes | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c -triple %itanium_abi_triple -emit-pch -o %t %s -femit-all-decls -disable-llvm-passes
|
|
|
|
// RUN: %clang_cc1 -fopenmp -x c -triple %itanium_abi_triple -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls -disable-llvm-passes | FileCheck --check-prefix=CHECK-LOAD %s
|
2017-12-30 02:07:07 +08:00
|
|
|
|
|
|
|
// RUN: %clang_cc1 -verify -fopenmp-simd -x c -emit-llvm %s -triple %itanium_abi_triple -o - -femit-all-decls -disable-llvm-passes | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c -triple %itanium_abi_triple -emit-pch -o %t %s -femit-all-decls -disable-llvm-passes
|
|
|
|
// RUN: %clang_cc1 -fopenmp-simd -x c -triple %itanium_abi_triple -include-pch %t -verify %s -emit-llvm -o - -femit-all-decls -disable-llvm-passes | FileCheck --check-prefix SIMD-ONLY0 %s
|
|
|
|
// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
|
2016-03-04 17:22:22 +08:00
|
|
|
// expected-no-diagnostics
|
|
|
|
|
|
|
|
#ifndef HEADER
|
|
|
|
#define HEADER
|
|
|
|
|
|
|
|
// CHECK: [[SSS_INT:.+]] = type { i32 }
|
|
|
|
// CHECK-LOAD: [[SSS_INT:.+]] = type { i32 }
|
|
|
|
|
|
|
|
#pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(i32* noalias %0, i32* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-NEXT: store i32 [[MUL]], i32*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(i32* noalias %0, i32* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-LOAD-NEXT: store i32 [[MUL]], i32*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(i8* noalias %0, i8* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: sext i8
|
|
|
|
// CHECK: sext i8
|
|
|
|
// CHECK: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-NEXT: [[TRUNC:%.+]] = trunc i32 [[MUL]] to i8
|
|
|
|
// CHECK-NEXT: store i8 [[TRUNC]], i8*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(i8* noalias %0, i8* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: sext i8
|
|
|
|
// CHECK-LOAD: sext i8
|
|
|
|
// CHECK-LOAD: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-LOAD-NEXT: [[TRUNC:%.+]] = trunc i32 [[MUL]] to i8
|
|
|
|
// CHECK-LOAD-NEXT: store i8 [[TRUNC]], i8*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
|
|
|
|
#pragma omp declare reduction(fun : float : omp_out += omp_in) initializer(omp_priv = 15 + omp_orig)
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(float* noalias %0, float* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: [[ADD:%.+]] = fadd float
|
|
|
|
// CHECK-NEXT: store float [[ADD]], float*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(float* noalias %0, float* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: [[ADD:%.+]] = fadd float 1.5
|
|
|
|
// CHECK-NEXT: store float [[ADD]], float*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(float* noalias %0, float* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: [[ADD:%.+]] = fadd float
|
|
|
|
// CHECK-LOAD-NEXT: store float [[ADD]], float*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(float* noalias %0, float* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: [[ADD:%.+]] = fadd float 1.5
|
|
|
|
// CHECK-LOAD-NEXT: store float [[ADD]], float*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
|
|
|
|
struct SSS {
|
|
|
|
int field;
|
|
|
|
#pragma omp declare reduction(+ : int, char : omp_out *= omp_in)
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(i32* noalias %0, i32* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-NEXT: store i32 [[MUL]], i32*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}(i8* noalias %0, i8* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: sext i8
|
|
|
|
// CHECK: sext i8
|
|
|
|
// CHECK: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-NEXT: [[TRUNC:%.+]] = trunc i32 [[MUL]] to i8
|
|
|
|
// CHECK-NEXT: store i8 [[TRUNC]], i8*
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
|
|
|
};
|
|
|
|
|
|
|
|
void init(struct SSS *priv, struct SSS orig);
|
|
|
|
|
|
|
|
#pragma omp declare reduction(fun : struct SSS : omp_out = omp_in) initializer(init(&omp_priv, omp_orig))
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @llvm.memcpy
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @init(
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @llvm.memcpy
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @init(
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
|
|
|
|
// CHECK-LABEL: @main
|
|
|
|
// CHECK-LOAD-LABEL: @main
|
|
|
|
int main() {
|
|
|
|
#pragma omp declare reduction(fun : struct SSS : omp_out = omp_in) initializer(init(&omp_priv, omp_orig))
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @llvm.memcpy
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @init(
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @llvm.memcpy
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @init(
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
{
|
|
|
|
#pragma omp declare reduction(fun : struct SSS : omp_out = omp_in) initializer(init(&omp_priv, omp_orig))
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @llvm.memcpy
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK: call void @init(
|
|
|
|
// CHECK-NEXT: ret void
|
|
|
|
// CHECK-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @llvm.memcpy
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}([[SSS_INT]]* noalias %0, [[SSS_INT]]* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: call void @init(
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(i32* noalias %0, i32* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-LOAD-NEXT: store i32 [[MUL]], i32*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
|
2019-08-03 22:28:34 +08:00
|
|
|
// CHECK-LOAD: define internal {{.*}}void @{{[^(]+}}(i8* noalias %0, i8* noalias %1)
|
2016-03-04 17:22:22 +08:00
|
|
|
// CHECK-LOAD: sext i8
|
|
|
|
// CHECK-LOAD: sext i8
|
|
|
|
// CHECK-LOAD: [[MUL:%.+]] = mul nsw i32
|
|
|
|
// CHECK-LOAD-NEXT: [[TRUNC:%.+]] = trunc i32 [[MUL]] to i8
|
|
|
|
// CHECK-LOAD-NEXT: store i8 [[TRUNC]], i8*
|
|
|
|
// CHECK-LOAD-NEXT: ret void
|
|
|
|
// CHECK-LOAD-NEXT: }
|
|
|
|
#endif
|