| 1 | // RUN: %clang_cc1 -triple nvptx64-unknown-unknown -target-cpu sm_60 \ |
| 2 | // RUN: -fcuda-is-device -S -emit-llvm -o - -x cuda %s \ |
| 3 | // RUN: | FileCheck -check-prefix=CHECK %s |
| 4 | // |
| 5 | // RUN: %clang_cc1 -triple nvptx-unknown-unknown -target-cpu sm_50 \ |
| 6 | // RUN: -fcuda-is-device -S -o /dev/null -x cuda -verify %s |
| 7 | |
| 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 the |
| 14 | // same function, because the codegen will stop after the very first function |
| 15 | // that encounters an error, so -verify will not be able to find errors in |
| 16 | // subsequent functions. |
| 17 | |
| 18 | // CHECK-LABEL: test_fn |
| 19 | __device__ void test_fn(double d, double* double_ptr) { |
| 20 | // CHECK: call double @llvm.nvvm.atomic.load.add.f64.p0f64 |
| 21 | // expected-error@+1 {{'__nvvm_atom_add_gen_d' needs target feature sm_60}} |
| 22 | __nvvm_atom_add_gen_d(double_ptr, d); |
| 23 | } |
| 24 | |