Justin Lebar | da9e0bd | 2017-11-07 22:10:54 +0000 | [diff] [blame] | 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) { |
James Y Knight | 8043d5a | 2021-02-11 17:33:43 -0500 | [diff] [blame] | 20 | // CHECK: atomicrmw fadd double* {{.*}} seq_cst, align 8 |
Artem Belevich | 24e8a68 | 2018-04-11 17:51:19 +0000 | [diff] [blame] | 21 | // expected-error@+1 {{'__nvvm_atom_add_gen_d' needs target feature sm_60}} |
Justin Lebar | da9e0bd | 2017-11-07 22:10:54 +0000 | [diff] [blame] | 22 | __nvvm_atom_add_gen_d(double_ptr, d); |
| 23 | } |