filter-decl.cu 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=CHECK-HOST %s
  2. // RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - -fcuda-is-device | FileCheck -check-prefix=CHECK-DEVICE %s
  3. #include "Inputs/cuda.h"
  4. // This has to be at the top of the file as that's where file-scope
  5. // asm ends up.
  6. // CHECK-HOST: module asm "file scope asm is host only"
  7. // CHECK-DEVICE-NOT: module asm "file scope asm is host only"
  8. __asm__("file scope asm is host only");
  9. // CHECK-HOST: constantdata = internal global
  10. // CHECK-DEVICE: constantdata = {{(dso_local )?}}externally_initialized global
  11. __constant__ char constantdata[256];
  12. // CHECK-HOST: devicedata = internal global
  13. // CHECK-DEVICE: devicedata = {{(dso_local )?}}externally_initialized global
  14. __device__ char devicedata[256];
  15. // CHECK-HOST: shareddata = internal global
  16. // CHECK-DEVICE: shareddata = {{(dso_local )?}}global
  17. __shared__ char shareddata[256];
  18. // CHECK-HOST: hostdata = {{(dso_local )?}}global
  19. // CHECK-DEVICE-NOT: hostdata = global
  20. char hostdata[256];
  21. // CHECK-HOST: define{{.*}}implicithostonlyfunc
  22. // CHECK-DEVICE-NOT: define{{.*}}implicithostonlyfunc
  23. void implicithostonlyfunc(void) {}
  24. // CHECK-HOST: define{{.*}}explicithostonlyfunc
  25. // CHECK-DEVICE-NOT: define{{.*}}explicithostonlyfunc
  26. __host__ void explicithostonlyfunc(void) {}
  27. // CHECK-HOST-NOT: define{{.*}}deviceonlyfunc
  28. // CHECK-DEVICE: define{{.*}}deviceonlyfunc
  29. __device__ void deviceonlyfunc(void) {}
  30. // CHECK-HOST: define{{.*}}hostdevicefunc
  31. // CHECK-DEVICE: define{{.*}}hostdevicefunc
  32. __host__ __device__ void hostdevicefunc(void) {}
  33. // CHECK-HOST: define{{.*}}globalfunc
  34. // CHECK-DEVICE: define{{.*}}globalfunc
  35. __global__ void globalfunc(void) {}