blob: 9d92c63416e3775e76b59593c234c15bdb4e96e8 [file] [log] [blame]
Justin Lebarda9e0bd2017-11-07 22:10:54 +00001// 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 Knight8043d5a2021-02-11 17:33:43 -050020 // CHECK: atomicrmw fadd double* {{.*}} seq_cst, align 8
Artem Belevich24e8a682018-04-11 17:51:19 +000021 // expected-error@+1 {{'__nvvm_atom_add_gen_d' needs target feature sm_60}}
Justin Lebarda9e0bd2017-11-07 22:10:54 +000022 __nvvm_atom_add_gen_d(double_ptr, d);
23}