Home | History | Annotate | Download | only in CodeGenCUDA
      1 // RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device -Wno-cuda-compat -emit-llvm -o - | FileCheck %s
      2 
      3 #include "Inputs/cuda.h"
      4 
      5 extern "C"
      6 void host_function() {}
      7 
      8 // CHECK-LABEL: define void @hd_function_a
      9 extern "C"
     10 __host__ __device__ void hd_function_a() {
     11   // CHECK: call void @host_function
     12   host_function();
     13 }
     14 
     15 // CHECK: declare void @host_function
     16 
     17 // CHECK-LABEL: define void @hd_function_b
     18 extern "C"
     19 __host__ __device__ void hd_function_b(bool b) { if (b) host_function(); }
     20 
     21 // CHECK-LABEL: define void @device_function_b
     22 extern "C"
     23 __device__ void device_function_b() { hd_function_b(false); }
     24 
     25 // CHECK-LABEL: define void @global_function
     26 extern "C"
     27 __global__ void global_function() {
     28   // CHECK: call void @device_function_b
     29   device_function_b();
     30 }
     31 
     32 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
     33