| 1 |
// RUN: %clang_cc1 -fsyntax-only -cl-std=CL2.0 -triple amdgcn -target-cpu gfx90a -verify %s |
| 2 |
|
| 3 |
kernel void test_ds_atomic_fadd_f32_valid(__local float *lds_ptr, float val) { |
| 4 |
float result; |
| 5 |
result = __builtin_amdgcn_ds_atomic_fadd_f32(lds_ptr, val); |
| 6 |
} |
| 7 |
|
| 8 |
kernel void test_ds_atomic_fadd_f32_errors(__local float *lds_ptr, float val, |
| 9 |
__local double *lds_ptr_d, |
| 10 |
__global float *global_ptr) { |
| 11 |
float result; |
| 12 |
result = __builtin_amdgcn_ds_atomic_fadd_f32(lds_ptr, val, 0); // expected-error{{too many arguments to function call, expected 2, have 3}} |
| 13 |
result = __builtin_amdgcn_ds_atomic_fadd_f32(global_ptr, val); // expected-error{{passing '__global float *__private' to parameter of type '__local float *' changes address space of pointer}} |
| 14 |
result = __builtin_amdgcn_ds_atomic_fadd_f32(lds_ptr_d, val); // expected-error{{incompatible pointer types passing '__local double *__private' to parameter of type '__local float *'}} |
| 15 |
} |
| 16 |
|
| 17 |
kernel void test_ds_atomic_fadd_f64_valid(__local double *lds_ptr, double val) { |
| 18 |
double result; |
| 19 |
result = __builtin_amdgcn_ds_atomic_fadd_f64(lds_ptr, val); |
| 20 |
} |
| 21 |
|
| 22 |
kernel void test_ds_atomic_fadd_f64_errors(__local double *lds_ptr, double val, |
| 23 |
__local float *lds_ptr_f, |
| 24 |
__global double *global_ptr) { |
| 25 |
double result; |
| 26 |
result = __builtin_amdgcn_ds_atomic_fadd_f64(lds_ptr, val, 0); // expected-error{{too many arguments to function call, expected 2, have 3}} |
| 27 |
result = __builtin_amdgcn_ds_atomic_fadd_f64(global_ptr, val);// expected-error{{passing '__global double *__private' to parameter of type '__local double *' changes address space of pointer}} |
| 28 |
result = __builtin_amdgcn_ds_atomic_fadd_f64(lds_ptr_f, val); // expected-error{{incompatible pointer types passing '__local float *__private' to parameter of type '__local double *'}} |
| 29 |
} |