1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc -fopenmp-version=45
2 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - -fopenmp-version=45 | FileCheck %s --implicit-check-not='ret i32 {{6|7|8|9|10|12|13|14|15|17|18|19|20|21|22|23|24|26}}'
3 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -emit-pch -o %t -fopenmp-version=45
4 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -o - -fopenmp-version=45 | FileCheck %s --implicit-check-not='ret i32 {{6|7|8|9|10|12|13|14|15|17|18|19|20|21|22|23|24|26}}'
6 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc
7 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --implicit-check-not='ret i32 {{6|7|8|9|10|12|13|14|15|17|18|19|20|21|22|23|24|26}}'
8 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -emit-pch -o %t
9 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -aux-triple powerpc64le-unknown-unknown -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -include-pch %t -o - | FileCheck %s --implicit-check-not='ret i32 {{6|7|8|9|10|12|13|14|15|17|18|19|20|21|22|23|24|26}}'
10 // expected-no-diagnostics
12 // CHECK-DAG: ret i32 2
13 // CHECK-DAG: ret i32 3
14 // CHECK-DAG: ret i32 4
15 // CHECK-DAG: ret i32 5
16 // CHECK-DAG: ret i32 11
17 // CHECK-DAG: ret i32 16
18 // CHECK-DAG: ret i32 19
19 // CHECK-DAG: ret i32 25
20 // CHECK-DAG: ret i32 27
21 // CHECK-DAG: ret i32 28
22 // CHECK-DAG: ret i32 29
27 int foo() { return 2; }
30 static int stat_unused_();
31 static int stat_used_();
33 #pragma omp declare target
35 #pragma omp declare variant(foo) match(implementation = {vendor(llvm)})
36 int bar() { return 3; }
38 #pragma omp declare variant(bazzz) match(implementation = {vendor(llvm)})
39 int baz() { return 4; }
41 #pragma omp declare variant(test) match(implementation = {vendor(llvm)})
42 int call() { return 5; }
44 #pragma omp declare variant(stat_unused_) match(implementation = {vendor(llvm)})
45 static int stat_unused() { return 6; }
47 #pragma omp declare variant(stat_used_) match(implementation = {vendor(llvm)})
48 static int stat_used() { return 7; }
50 #pragma omp end declare target
54 #pragma omp target map(from \
56 res
= bar() + baz() + call();
60 int test() { return 8; }
61 static int stat_unused_() { return 9; }
62 static int stat_used_() { return 10; }
64 #pragma omp declare target
71 int method_() { return 11; }
72 #pragma omp declare variant(SpecialFuncs::method_) \
73 match(implementation = {vendor(llvm)})
74 int method() { return 12; }
75 #pragma omp declare variant(SpecialFuncs::method_) \
76 match(implementation = {vendor(llvm)})
80 int SpecialFuncs::Method() { return 13; }
82 struct SpecSpecialFuncs
{
88 #pragma omp declare variant(SpecSpecialFuncs::method_) \
89 match(implementation = {vendor(llvm)})
90 int method() { return 14; }
91 #pragma omp declare variant(SpecSpecialFuncs::method_) \
92 match(implementation = {vendor(llvm)})
96 #pragma omp end declare target
98 int SpecSpecialFuncs::method_() { return 15; }
99 int SpecSpecialFuncs::Method() { return 16; }
101 int prio() { return 17; }
102 int prio1() { return 18; }
103 static int prio2() { return 19; }
104 static int prio3() { return 20; }
105 static int prio4() { return 21; }
106 int fn_linkage_variant() { return 22; }
107 extern "C" int fn_linkage_variant1() { return 23; }
108 int fn_variant2() { return 24; }
110 #pragma omp declare target
117 #pragma omp declare variant(prio) match(implementation = {vendor(llvm)})
118 #pragma omp declare variant(prio1) match(implementation = {vendor(score(1) \
120 int prio_() { return 25; }
122 #pragma omp declare variant(prio4) match(implementation = {vendor(score(3) \
124 #pragma omp declare variant(prio2) match(implementation = {vendor(score(5) \
126 #pragma omp declare variant(prio3) match(implementation = {vendor(score(1) \
128 static int prio1_() { return 26; }
130 int int_fn() { return prio1_(); }
133 #pragma omp declare variant(fn_linkage_variant) match(implementation = {vendor(llvm)})
134 int fn_linkage() { return 27; }
137 #pragma omp declare variant(fn_linkage_variant1) match(implementation = {vendor(llvm)})
138 int fn_linkage1() { return 28; }
140 #pragma omp declare variant(fn_variant2) match(implementation = {vendor(llvm, ibm)})
141 int fn2() { return 29; }
143 #pragma omp end declare target