3 #define HSAIL_BUILTIN_GPU __attribute__((hc)) 4 #define HSAIL_BUILTIN_CPU __attribute__((cpu)) inline 6 #ifdef __KALMAR_ACCELERATOR__ 9 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_fetch_add_int(
int* dest,
int val);
10 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_fetch_add_unsigned(
unsigned int* dest,
unsigned int val);
11 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_fetch_add_int64(int64_t* dest, int64_t val);
12 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_fetch_add_uint64(uint64_t* dest, uint64_t val);
15 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_fetch_sub_int(
int* dest,
int val);
16 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_fetch_sub_unsigned(
unsigned int* dest,
unsigned int val);
17 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_fetch_sub_int64(int64_t* dest, int64_t val);
18 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_fetch_sub_uint64(uint64_t* dest, uint64_t val);
21 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_fetch_and_int(
int* dest,
int val);
22 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_fetch_and_unsigned(
unsigned int* dest,
unsigned int val);
23 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_fetch_and_int64(int64_t* dest, int64_t val);
24 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_fetch_and_uint64(uint64_t* dest, uint64_t val);
27 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_fetch_or_int(
int* dest,
int val);
28 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_fetch_or_unsigned(
unsigned int* dest,
unsigned int val);
29 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_fetch_or_int64(int64_t* dest, int64_t val);
30 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_fetch_or_uint64(uint64_t* dest, uint64_t val);
33 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_fetch_xor_int(
int* dest,
int val);
34 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_fetch_xor_unsigned(
unsigned int* dest,
unsigned int val);
35 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_fetch_xor_int64(int64_t* dest, int64_t val);
36 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_fetch_xor_uint64(uint64_t* dest, uint64_t val);
39 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_exchange_int(
int* dest,
int val);
40 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_exchange_unsigned(
unsigned int* dest,
unsigned int val);
41 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_exchange_int64(int64_t* dest, int64_t val);
42 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_exchange_uint64(uint64_t* dest, uint64_t val);
45 extern "C" HSAIL_BUILTIN_GPU
int __hsail_atomic_compare_exchange_int(
int* dest,
int compare,
int val);
46 extern "C" HSAIL_BUILTIN_GPU
unsigned int __hsail_atomic_compare_exchange_unsigned(
unsigned int* dest,
unsigned int compare,
unsigned int val);
47 extern "C" HSAIL_BUILTIN_GPU int64_t __hsail_atomic_compare_exchange_int64(int64_t* dest, int64_t compare, int64_t val);
48 extern "C" HSAIL_BUILTIN_GPU uint64_t __hsail_atomic_compare_exchange_uint64(uint64_t* dest, uint64_t compare, uint64_t val);
53 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_fetch_add_int(
int* dest,
int val)
54 {
return __sync_fetch_and_add(dest, val); }
56 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_fetch_add_unsigned(
unsigned int* dest,
unsigned int val)
57 {
return __sync_fetch_and_add(dest, val); }
59 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_fetch_add_int64(int64_t* dest, int64_t val)
60 {
return __sync_fetch_and_add(dest, val); }
62 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_fetch_add_uint64(uint64_t* dest, uint64_t val)
63 {
return __sync_fetch_and_add(dest, val); }
66 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_fetch_sub_int(
int* dest,
int val)
67 {
return __sync_fetch_and_sub(dest, val); }
69 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_fetch_sub_unsigned(
unsigned int* dest,
unsigned int val)
70 {
return __sync_fetch_and_sub(dest, val); }
72 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_fetch_sub_int64(int64_t* dest, int64_t val)
73 {
return __sync_fetch_and_sub(dest, val); }
75 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_fetch_sub_uint64(uint64_t* dest, uint64_t val)
76 {
return __sync_fetch_and_sub(dest, val); }
79 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_fetch_and_int(
int* dest,
int val)
80 {
return __sync_fetch_and_and(dest, val); }
82 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_fetch_and_unsigned(
unsigned int* dest,
unsigned int val)
83 {
return __sync_fetch_and_and(dest, val); }
85 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_fetch_and_int64(int64_t* dest, int64_t val)
86 {
return __sync_fetch_and_and(dest, val); }
88 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_fetch_and_uint64(uint64_t* dest, uint64_t val)
89 {
return __sync_fetch_and_and(dest, val); }
92 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_fetch_or_int(
int* dest,
int val)
93 {
return __sync_fetch_and_or(dest, val); }
95 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_fetch_or_unsigned(
unsigned int* dest,
unsigned int val)
96 {
return __sync_fetch_and_or(dest, val); }
98 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_fetch_or_int64(int64_t* dest, int64_t val)
99 {
return __sync_fetch_and_or(dest, val); }
101 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_fetch_or_uint64(uint64_t* dest, uint64_t val)
102 {
return __sync_fetch_and_or(dest, val); }
105 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_fetch_xor_int(
int* dest,
int val)
106 {
return __sync_fetch_and_xor(dest, val); }
108 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_fetch_xor_unsigned(
unsigned int* dest,
unsigned int val)
109 {
return __sync_fetch_and_xor(dest, val); }
111 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_fetch_xor_int64(int64_t* dest, int64_t val)
112 {
return __sync_fetch_and_xor(dest, val); }
114 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_fetch_xor_uint64(uint64_t* dest, uint64_t val)
115 {
return __sync_fetch_and_xor(dest, val); }
118 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_exchange_int(
int* dest,
int val)
119 {
return __sync_swap(dest, val); }
121 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_exchange_unsigned(
unsigned int* dest,
unsigned int val)
122 {
return __sync_swap(dest, val); }
124 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_exchange_int64(int64_t* dest, int64_t val)
125 {
return __sync_swap(dest, val); }
127 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_exchange_uint64(uint64_t* dest, uint64_t val)
128 {
return __sync_swap(dest, val); }
131 extern "C" HSAIL_BUILTIN_CPU
int __hsail_atomic_compare_exchange_int(
int* dest,
int compare,
int val)
132 {
return __sync_val_compare_and_swap(dest, compare, val); }
134 extern "C" HSAIL_BUILTIN_CPU
unsigned int __hsail_atomic_compare_exchange_unsigned(
unsigned int* dest,
unsigned int compare,
unsigned int val)
135 {
return __sync_val_compare_and_swap(dest, compare, val); }
137 extern "C" HSAIL_BUILTIN_CPU int64_t __hsail_atomic_compare_exchange_int64(int64_t* dest, int64_t compare, int64_t val)
138 {
return __sync_val_compare_and_swap(dest, compare, val); }
140 extern "C" HSAIL_BUILTIN_CPU uint64_t __hsail_atomic_compare_exchange_uint64(uint64_t* dest, uint64_t compare, uint64_t val)
141 {
return __sync_val_compare_and_swap(dest, compare, val); }