brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 4c00211 Raw
58 lines · cpp
1// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10  -stack-protector 2 -emit-llvm -o - %s | FileCheck %s2 3// RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10  -stack-protector 2 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s4// SIMD-ONLY0-NOT: {{__kmpc|__tgt}}5 6// Check that function attributes are added to the OpenMP runtime functions.7 8template <class T>9struct S {10  T f;11  S(T a) : f(a) {}12  S() : f() {}13  operator T() { return T(); }14  ~S() {}15};16 17// CHECK: define internal void @.omp.copyprivate.copy_func(ptr noundef %0, ptr noundef %1) [[ATTR0:#[0-9]+]] {18 19void foo0();20 21int foo1() {22  char a;23 24#pragma omp parallel25  a = 2;26#pragma omp single copyprivate(a)27  foo0();28 29  return 0;30}31 32// CHECK: define internal void @.omp_task_privates_map.({{.*}}) [[ATTR3:#[0-9]+]] {33// CHECK: define internal noundef i32 @.omp_task_entry.({{.*}}) [[ATTR0]] {34// CHECK: define internal noundef i32 @.omp_task_destructor.({{.*}}) [[ATTR0]] {35 36int foo2() {37  S<double> s_arr[] = {1, 2};38  S<double> var(3);39#pragma omp task private(s_arr, var)40  s_arr[0] = var;41  return 0;42}43 44// CHECK: define internal void @_Z4foo3iPfS_.omp_outlined.omp.reduction.reduction_func(ptr noundef %0, ptr noundef %1) [[ATTR0]] {45 46float foo3(int n, float *a, float *b) {47  int i;48  float result;49 50#pragma omp parallel for private(i) reduction(+:result)51  for (i=0; i < n; i++)52    result = result + (a[i] * b[i]);53  return result;54}55 56// CHECK: attributes [[ATTR0]] = {{{.*}} sspstrong {{.*}}}57// CHECK: attributes [[ATTR3]] = {{{.*}} sspstrong {{.*}}}58