Index: lib/Headers/opencl-c.h =================================================================== --- lib/Headers/opencl-c.h +++ lib/Headers/opencl-c.h @@ -13340,6 +13340,10 @@ unsigned int __ovld atomic_add(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_add(volatile __local int *p, int val); unsigned int __ovld atomic_add(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_add(volatile int *p, int val); +unsigned int __ovld atomic_add(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_add(volatile __global int *p, int val); @@ -13366,6 +13370,10 @@ unsigned int __ovld atomic_sub(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_sub(volatile __local int *p, int val); unsigned int __ovld atomic_sub(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_sub(volatile int *p, int val); +unsigned int __ovld atomic_sub(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_sub(volatile __global int *p, int val); @@ -13394,6 +13402,11 @@ unsigned int __ovld atomic_xchg(volatile __local unsigned int *p, unsigned int val); float __ovld atomic_xchg(volatile __global float *p, float val); float __ovld atomic_xchg(volatile __local float *p, float val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_xchg(volatile int *p, int val); +unsigned int __ovld atomic_xchg(volatile unsigned int *p, unsigned int val); +float __ovld atomic_xchg(volatile float *p, float val); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_xchg(volatile __global int *p, int val); @@ -13421,6 +13434,10 @@ unsigned int __ovld atomic_inc(volatile __global unsigned int *p); int __ovld atomic_inc(volatile __local int *p); unsigned int __ovld atomic_inc(volatile __local unsigned int *p); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_inc(volatile int *p); +unsigned int __ovld atomic_inc(volatile unsigned int *p); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_inc(volatile __global int *p); @@ -13448,6 +13465,10 @@ unsigned int __ovld atomic_dec(volatile __global unsigned int *p); int __ovld atomic_dec(volatile __local int *p); unsigned int __ovld atomic_dec(volatile __local unsigned int *p); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_dec(volatile int *p); +unsigned int __ovld atomic_dec(volatile unsigned int *p); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_dec(volatile __global int *p); @@ -13476,6 +13497,10 @@ unsigned int __ovld atomic_cmpxchg(volatile __global unsigned int *p, unsigned int cmp, unsigned int val); int __ovld atomic_cmpxchg(volatile __local int *p, int cmp, int val); unsigned int __ovld atomic_cmpxchg(volatile __local unsigned int *p, unsigned int cmp, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_cmpxchg(volatile int *p, int cmp, int val); +unsigned int __ovld atomic_cmpxchg(volatile unsigned int *p, unsigned int cmp, unsigned int val); +#endif #if defined(cl_khr_global_int32_base_atomics) int __ovld atom_cmpxchg(volatile __global int *p, int cmp, int val); @@ -13504,6 +13529,10 @@ unsigned int __ovld atomic_min(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_min(volatile __local int *p, int val); unsigned int __ovld atomic_min(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_min(volatile int *p, int val); +unsigned int __ovld atomic_min(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_min(volatile __global int *p, int val); @@ -13532,6 +13561,10 @@ unsigned int __ovld atomic_max(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_max(volatile __local int *p, int val); unsigned int __ovld atomic_max(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_max(volatile int *p, int val); +unsigned int __ovld atomic_max(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_max(volatile __global int *p, int val); @@ -13559,6 +13592,10 @@ unsigned int __ovld atomic_and(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_and(volatile __local int *p, int val); unsigned int __ovld atomic_and(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_and(volatile int *p, int val); +unsigned int __ovld atomic_and(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_and(volatile __global int *p, int val); @@ -13586,6 +13623,10 @@ unsigned int __ovld atomic_or(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_or(volatile __local int *p, int val); unsigned int __ovld atomic_or(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_or(volatile int *p, int val); +unsigned int __ovld atomic_or(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_or(volatile __global int *p, int val); @@ -13613,6 +13654,10 @@ unsigned int __ovld atomic_xor(volatile __global unsigned int *p, unsigned int val); int __ovld atomic_xor(volatile __local int *p, int val); unsigned int __ovld atomic_xor(volatile __local unsigned int *p, unsigned int val); +#ifdef __OPENCL_CPP_VERSION__ +int __ovld atomic_xor(volatile int *p, int val); +unsigned int __ovld atomic_xor(volatile unsigned int *p, unsigned int val); +#endif #if defined(cl_khr_global_int32_extended_atomics) int __ovld atom_xor(volatile __global int *p, int val); Index: test/Headers/opencl-c-header.cl =================================================================== --- test/Headers/opencl-c-header.cl +++ test/Headers/opencl-c-header.cl @@ -73,6 +73,14 @@ } #endif //__OPENCL_C_VERSION__ +#if defined(__OPENCL_CPP_VERSION__) +void test_atomics(__generic volatile unsigned int* a) +{ + atomic_add(a, 1); +} +#endif + + // Verify that non-builtin cl_intel_planar_yuv extension is defined from // OpenCL 1.2 onwards. #if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)