1 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions -fcuda-is-device \
2 // RUN: -triple nvptx-nvidia-cuda -emit-llvm -disable-llvm-passes -o - %s | \
3 // RUN: FileCheck -check-prefix DEVICE %s
5 // RUN: %clang_cc1 -std=c++11 -fcxx-exceptions -fexceptions \
6 // RUN: -triple x86_64-unknown-linux-gnu -emit-llvm -disable-llvm-passes -o - %s | \
7 // RUN: FileCheck -check-prefix HOST %s
9 #include "Inputs/cuda.h"
11 __host__ __device__ void f();
13 // HOST: define{{.*}} void @_Z7host_fnv() [[HOST_ATTR:#[0-9]+]]
14 void host_fn() { f(); }
16 // DEVICE: define{{.*}} void @_Z3foov() [[DEVICE_ATTR:#[0-9]+]]
17 __device__ void foo() {
18 // DEVICE: call void @_Z1fv
22 // DEVICE: define{{.*}} void @_Z12foo_noexceptv() [[DEVICE_ATTR:#[0-9]+]]
23 __device__ void foo_noexcept() noexcept {
24 // DEVICE: call void @_Z1fv
28 // This is nounwind only on the device side.
29 // CHECK: define{{.*}} void @_Z3foov() [[DEVICE_ATTR:#[0-9]+]]
30 __host__ __device__ void bar() { f(); }
32 // DEVICE: define{{.*}} void @_Z3bazv() [[DEVICE_ATTR:#[0-9]+]]
33 __global__ void baz() { f(); }
35 // DEVICE: attributes [[DEVICE_ATTR]] = {
36 // DEVICE-SAME: nounwind
37 // HOST: attributes [[HOST_ATTR]] = {