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