| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// REQUIRES: nvptx-registered-target |
| 3 |
// REQUIRES: amdgpu-registered-target |
| 4 |
|
| 5 |
// RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm \ |
| 6 |
// RUN: -o - %s | FileCheck %s |
| 7 |
// RUN: %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm -target-sdk-version=10.1 \ |
| 8 |
// RUN: -o - %s | FileCheck %s |
| 9 |
// RUN: %clang_cc1 -fcuda-is-device -triple amdgcn-amd-amdhsa -emit-llvm \ |
| 10 |
// RUN: -o - %s | FileCheck %s |
| 11 |
|
| 12 |
#include "Inputs/cuda.h" |
| 13 |
|
| 14 |
extern "C" { |
| 15 |
__device__ int foo() { return 1; } |
| 16 |
} |
| 17 |
|
| 18 |
[[gnu::alias("foo")]] __device__ int alias(); |
| 19 |
|
| 20 |
// CHECK: @_Z5aliasv = alias i32 (), ptr @foo |
| 21 |
// |
| 22 |
// CHECK: define dso_local i32 @foo() #[[ATTR0:[0-9]+]] { |
| 23 |
// CHECK-NEXT: entry: |
| 24 |
// CHECK: ret i32 1 |
| 25 |
// CHECK-NEXT: } |
| 26 |
|
| 27 |
// RUN: not %clang_cc1 -fcuda-is-device -triple nvptx-nvidia-cuda -emit-llvm -target-sdk-version=9.0 \ |
| 28 |
// RUN: -o - %s 2>&1 | FileCheck %s --check-prefix=NO_SUPPORT |
| 29 |
// NO_SUPPORT: CUDA older than 10.0 does not support .alias |