Alexey Bataev | 4f4bf7c | 2018-03-15 15:47:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm-bc %s -o %t-ppc-host.bc |
| 2 | // RUN: %clang_cc1 -verify -fopenmp -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 |
| 3 | // RUN: %clang_cc1 -verify -fopenmp -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 -emit-pch -o %t |
| 4 | // RUN: %clang_cc1 -verify -fopenmp -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 -include-pch %t -o - | FileCheck %s |
| 5 | |
| 6 | // 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 |
| 7 | // 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 %s --check-prefix SIMD-ONLY |
| 8 | // 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 -emit-pch -o %t |
| 9 | // 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 -include-pch %t -verify -o - | FileCheck %s --check-prefix SIMD-ONLY |
| 10 | |
| 11 | // expected-no-diagnostics |
| 12 | |
| 13 | // SIMD-ONLY-NOT: {{__kmpc|__tgt}} |
| 14 | |
| 15 | // CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}} |
| 16 | // CHECK-DAG: @{{.*}}maini1{{.*}}aaa = internal global i64 23, |
| 17 | // CHECK-DAG: @b = global i32 15, |
| 18 | // CHECK-DAG: @d = global i32 0, |
| 19 | // CHECK-DAG: @c = external global i32, |
| 20 | |
| 21 | // CHECK-DAG: define {{.*}}i32 @{{.*}}{{foo|bar|baz2|baz3}}{{.*}}() |
| 22 | |
| 23 | #ifndef HEADER |
| 24 | #define HEADER |
| 25 | |
| 26 | int foo(); |
| 27 | |
| 28 | int baz1(); |
| 29 | |
| 30 | int baz2(); |
| 31 | |
| 32 | int baz4() { return 5; } |
| 33 | |
| 34 | #pragma omp declare target |
Alexey Bataev | dadf2d1 | 2018-04-30 18:09:40 +0000 | [diff] [blame^] | 35 | struct S { |
| 36 | int a; |
| 37 | S(int a) : a(a) {} |
| 38 | }; |
| 39 | |
Alexey Bataev | 4f4bf7c | 2018-03-15 15:47:20 +0000 | [diff] [blame] | 40 | int foo() { return 0; } |
| 41 | int b = 15; |
| 42 | int d; |
| 43 | #pragma omp end declare target |
| 44 | int c; |
| 45 | |
| 46 | int bar() { return 1 + foo() + bar() + baz1() + baz2(); } |
| 47 | |
| 48 | int maini1() { |
| 49 | int a; |
| 50 | static long aa = 32; |
| 51 | // CHECK-DAG: define void @__omp_offloading_{{.*}}maini1{{.*}}_l[[@LINE+1]](i32* dereferenceable{{.*}}, i64 {{.*}}, i64 {{.*}}) |
| 52 | #pragma omp target map(tofrom \ |
Alexey Bataev | 2c1dffe | 2018-04-16 20:34:41 +0000 | [diff] [blame] | 53 | : a, b) |
Alexey Bataev | 4f4bf7c | 2018-03-15 15:47:20 +0000 | [diff] [blame] | 54 | { |
Alexey Bataev | dadf2d1 | 2018-04-30 18:09:40 +0000 | [diff] [blame^] | 55 | S s(a); |
Alexey Bataev | 4f4bf7c | 2018-03-15 15:47:20 +0000 | [diff] [blame] | 56 | static long aaa = 23; |
| 57 | a = foo() + bar() + b + c + d + aa + aaa; |
| 58 | } |
| 59 | return baz4(); |
| 60 | } |
| 61 | |
| 62 | int baz3(); |
| 63 | int baz2() { |
| 64 | // CHECK-DAG: define void @__omp_offloading_{{.*}}baz2{{.*}}_l[[@LINE+1]](i64 {{.*}}) |
| 65 | #pragma omp target |
| 66 | ++c; |
| 67 | return 2 + baz3(); |
| 68 | } |
| 69 | int baz3() { return 2 + baz2(); } |
| 70 | |
| 71 | // CHECK-NOT: define {{.*}}{{baz1|baz4|maini1}} |
| 72 | #endif // HEADER |