Debian Codegraph @

clang/test/SemaHIP/amdgpu-flat-atomic-fadd-err.hip

raw
1 // RUN: %clang_cc1 -fsyntax-only -triple amdgcn -target-cpu gfx942 -verify %s -fcuda-is-device
2 // RUN: %clang_cc1 -fsyntax-only -triple x86_64 -aux-triple amdgcn -verify %s
3
4 #define __device__ __attribute__((device))
5 #define __shared__ __attribute__((shared))
6
7 __device__ void test_flat_atomic_fadd_f32_valid(float *ptr, float val) {
8 float result;
9 result = __builtin_amdgcn_flat_atomic_fadd_f32(ptr, val);
10 }
11
12 __device__ void test_flat_atomic_fadd_f32_errors(float *ptr, float val,
13 double *ptr_d) {
14 float result;
15 result = __builtin_amdgcn_flat_atomic_fadd_f32(ptr, val, 0); // expected-error{{too many arguments to function call, expected 2, have 3}}
16 result = __builtin_amdgcn_flat_atomic_fadd_f32(ptr_d, val); // expected-error{{cannot initialize a parameter of type}}
17 }
18
19 __device__ void test_flat_atomic_fadd_f64_valid(double *ptr, double val) {
20 double result;
21 result = __builtin_amdgcn_flat_atomic_fadd_f64(ptr, val);
22 }
23
24 __device__ void test_flat_atomic_fadd_f64_errors(double *ptr, double val,
25 float *ptr_f) {
26 double result;
27 result = __builtin_amdgcn_flat_atomic_fadd_f64(ptr, val, 0); // expected-error{{too many arguments to function call, expected 2, have 3}}
28 result = __builtin_amdgcn_flat_atomic_fadd_f64(ptr_f, val); // expected-error{{cannot initialize a parameter of type}}
29 }