| 1 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-host.bc |
| 2 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s |
| 3 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=spirv64-intel -emit-llvm-bc %s -o %t-host.bc -DTEAMS |
| 4 |
// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple spirv64-intel -fopenmp-targets=spirv64-intel -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-host.bc -DTEAMS -o - | FileCheck %s |
| 5 |
// expected-no-diagnostics |
| 6 |
|
| 7 |
// CHECK: define weak_odr protected spir_kernel void @__omp_offloading_{{.*}}(ptr addrspace(1) noalias noundef %{{.*}}, ptr addrspace(1) noundef align 4 dereferenceable(128) %{{.*}}) |
| 8 |
|
| 9 |
int main() { |
| 10 |
int x[32] = {0}; |
| 11 |
|
| 12 |
#ifdef TEAMS |
| 13 |
#pragma omp target teams |
| 14 |
#else |
| 15 |
#pragma omp target |
| 16 |
#endif |
| 17 |
for(int i = 0; i < 32; i++) { |
| 18 |
if(i > 0) |
| 19 |
x[i] = x[i-1] + i; |
| 20 |
} |
| 21 |
|
| 22 |
return x[31]; |
| 23 |
} |
| 24 |
|