1 // REQUIRES: amdgpu-registered-target 2 3 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc 4 // RUN: %clang_cc1 -no-opaque-pointers -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s 5 // expected-no-diagnostics 6 #ifndef HEADER 7 #define HEADER 8 9 #define N 1000 10 11 int test_amdgcn_target_tid_threads() { 12 // CHECK-LABEL: define weak_odr amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads 13 14 int arr[N]; 15 16 // CHECK: call i32 @__kmpc_target_init(%struct.ident_t* addrspacecast (%struct.ident_t addrspace(1)* @1 to %struct.ident_t*), i8 1, i1 true, i1 true) 17 #pragma omp target 18 for (int i = 0; i < N; i++) { 19 arr[i] = 1; 20 } 21 22 return arr[0]; 23 } 24 25 int test_amdgcn_target_tid_threads_simd() { 26 // CHECK-LABEL: define weak_odr amdgpu_kernel void @{{.*}}test_amdgcn_target_tid_threads_simd 27 28 int arr[N]; 29 30 // CHECK: call i32 @__kmpc_target_init(%struct.ident_t* addrspacecast (%struct.ident_t addrspace(1)* @1 to %struct.ident_t*), i8 2, i1 false, i1 false) 31 #pragma omp target simd 32 for (int i = 0; i < N; i++) { 33 arr[i] = 1; 34 } 35 return arr[0]; 36 } 37 38 #endif 39