| 1 |
// REQUIRES: x86-registered-target |
| 2 |
// REQUIRES: nvptx-registered-target |
| 3 |
// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda -emit-llvm -disable-llvm-optzns -fno-builtin-printf -fcuda-is-device \ |
| 4 |
// RUN: -o - %s | FileCheck %s |
| 5 |
|
| 6 |
#define __device__ __attribute__((device)) |
| 7 |
|
| 8 |
extern "C" __device__ int printf(const char *format, ...); |
| 9 |
|
| 10 |
// CHECK-LABEL: @_Z4foo1v() |
| 11 |
__device__ int foo1() { |
| 12 |
// CHECK: call i32 @vprintf |
| 13 |
// CHECK-NOT: call i32 (ptr, ...) @printf |
| 14 |
return __builtin_printf("Hello World\n"); |
| 15 |
} |
| 16 |
|
| 17 |
// CHECK-LABEL: @_Z4foo2v() |
| 18 |
__device__ int foo2() { |
| 19 |
// CHECK: call i32 (ptr, ...) @printf |
| 20 |
return printf("Hello World\n"); |
| 21 |
} |