24 lines · plain
1// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_60 \2// RUN: -fcuda-is-device -emit-llvm -o - -x cuda %s \3// RUN: | FileCheck -check-prefix=CHECK %s4//5// RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_50 \6// RUN: -fcuda-is-device -S -o /dev/null -x cuda -verify %s7 8#define __device__ __attribute__((device))9#define __global__ __attribute__((global))10#define __shared__ __attribute__((shared))11#define __constant__ __attribute__((constant))12 13// We have to keep all builtins that depend on particular target feature in the14// same function, because the codegen will stop after the very first function15// that encounters an error, so -verify will not be able to find errors in16// subsequent functions.17 18// CHECK-LABEL: test_fn19__device__ void test_fn(double d, double* double_ptr) {20 // CHECK: atomicrmw fadd ptr {{.*}} seq_cst, align 821 // expected-error@+1 {{'__nvvm_atom_add_gen_d' needs target feature sm_60}}22 __nvvm_atom_add_gen_d(double_ptr, d);23}24