| 1 |
// REQUIRES: amdgpu-registered-target |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -triple amdgcn -fcuda-is-device -std=c++11 \ |
| 4 |
// RUN: -fgpu-allow-device-init -x hip \ |
| 5 |
// RUN: -fno-threadsafe-statics -emit-llvm -o - %s \ |
| 6 |
// RUN: | FileCheck %s |
| 7 |
// RUN: %clang_cc1 -triple spirv64-amd-amdhsa -fcuda-is-device -std=c++11 \ |
| 8 |
// RUN: -fgpu-allow-device-init -x hip \ |
| 9 |
// RUN: -fno-threadsafe-statics -emit-llvm -o - %s \ |
| 10 |
// RUN: | FileCheck %s --check-prefix=CHECK-SPIRV |
| 11 |
|
| 12 |
#include "Inputs/cuda.h" |
| 13 |
|
| 14 |
// CHECK: define internal amdgpu_kernel void @_GLOBAL__sub_I_device_init_fun.cu() #[[ATTR:[0-9]*]] |
| 15 |
// CHECK: attributes #[[ATTR]] = {{.*}}"device-init" |
| 16 |
// CHECK-SPIRV: define internal spir_kernel void @_GLOBAL__sub_I_device_init_fun.cu(){{.*}} #[[ATTR:[0-9]*]] |
| 17 |
// CHECK-SPIRV: attributes #[[ATTR]] = {{.*}}"device-init" |
| 18 |
|
| 19 |
__device__ void f(); |
| 20 |
|
| 21 |
struct A { |
| 22 |
__device__ A() { f(); } |
| 23 |
}; |
| 24 |
|
| 25 |
__device__ A a; |