• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -triple x86_64 -verify=expected,dev \
2 // RUN:            -verify-ignore-unexpected=note \
3 // RUN:            -fopenmp -fopenmp-version=50 -o - %s
4 // RUN: %clang_cc1 -triple x86_64 -verify -verify-ignore-unexpected=note\
5 // RUN:            -fopenmp -fopenmp-version=50 -o - -x c++ %s
6 // RUN: %clang_cc1 -triple x86_64 -verify=dev -verify-ignore-unexpected=note\
7 // RUN:            -fcuda-is-device -o - %s
8 
9 #if __CUDA__
10 #include "Inputs/cuda.h"
11 __device__ void cu_devf();
12 #endif
13 
bazz()14 void bazz() {}
15 #pragma omp declare target to(bazz) device_type(nohost)
bazzz()16 void bazzz() {bazz();}
17 #pragma omp declare target to(bazzz) device_type(nohost)
any()18 void any() {bazz();} // expected-error {{function with 'device_type(nohost)' is not available on host}}
host1()19 void host1() {bazz();} // expected-error {{function with 'device_type(nohost)' is not available on host}}
20 #pragma omp declare target to(host1) device_type(host)
host2()21 void host2() {bazz();} // expected-error {{function with 'device_type(nohost)' is not available on host}}
22 #pragma omp declare target to(host2)
device()23 void device() {host1();}
24 #pragma omp declare target to(device) device_type(nohost)
host3()25 void host3() {host1();}
26 #pragma omp declare target to(host3)
27 
28 #pragma omp declare target
any1()29 void any1() {any();}
any2()30 void any2() {host1();}
any3()31 void any3() {device();} // expected-error {{function with 'device_type(nohost)' is not available on host}}
any4()32 void any4() {any2();}
33 #pragma omp end declare target
34 
any5()35 void any5() {any();}
any6()36 void any6() {host1();}
any7()37 void any7() {device();} // expected-error {{function with 'device_type(nohost)' is not available on host}}
any8()38 void any8() {any2();}
39 
40 #if __CUDA__
cu_hostf()41 void cu_hostf() { cu_devf(); } // dev-error {{no matching function for call to 'cu_devf'}}
cu_devf2()42 __device__ void cu_devf2() { cu_hostf(); } // dev-error{{no matching function for call to 'cu_hostf'}}
43 #endif
44