2 * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 #if defined(AO_HAVE_char_load_acquire) && !defined(AO_HAVE_char_load)
25 # define AO_char_load(addr) AO_char_load_acquire(addr)
26 # define AO_HAVE_char_load
29 #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_acquire)
30 # define AO_char_load_acquire(addr) AO_char_load_full(addr)
31 # define AO_HAVE_char_load_acquire
34 #if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_read)
35 # define AO_char_load_read(addr) AO_char_load_full(addr)
36 # define AO_HAVE_char_load_read
39 #if !defined(AO_HAVE_char_load_acquire_read) \
40 && defined(AO_HAVE_char_load_acquire)
41 # define AO_char_load_acquire_read(addr) AO_char_load_acquire(addr)
42 # define AO_HAVE_char_load_acquire_read
45 #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_full) \
46 && !defined(AO_HAVE_char_load_acquire)
47 AO_INLINE unsigned char
48 AO_char_load_acquire(const volatile unsigned char *addr)
50 unsigned char result = AO_char_load(addr);
51 /* Acquire barrier would be useless, since the load could be delayed */
56 # define AO_HAVE_char_load_acquire
59 #if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_read) \
60 && !defined(AO_HAVE_char_load_read)
61 AO_INLINE unsigned char
62 AO_char_load_read(const volatile unsigned char *addr)
64 unsigned char result = AO_char_load(addr);
65 /* Acquire barrier would be useless, since the load could be delayed */
70 # define AO_HAVE_char_load_read
73 #if defined(AO_HAVE_char_load_acquire) && defined(AO_HAVE_nop_full) \
74 && !defined(AO_HAVE_char_load_full)
75 # define AO_char_load_full(addr) (AO_nop_full(), AO_char_load_acquire(addr))
76 # define AO_HAVE_char_load_full
79 #if !defined(AO_HAVE_char_load_acquire_read) \
80 && defined(AO_HAVE_char_load_read)
81 # define AO_char_load_acquire_read(addr) AO_char_load_read(addr)
82 # define AO_HAVE_char_load_acquire_read
85 #if defined(AO_HAVE_char_load_acquire_read) && !defined(AO_HAVE_char_load)
86 # define AO_char_load(addr) AO_char_load_acquire_read(addr)
87 # define AO_HAVE_char_load
90 #ifdef AO_NO_DD_ORDERING
91 # if defined(AO_HAVE_char_load_acquire_read)
92 # define AO_char_load_dd_acquire_read(addr) AO_char_load_acquire_read(addr)
93 # define AO_HAVE_char_load_dd_acquire_read
96 # if defined(AO_HAVE_char_load)
97 # define AO_char_load_dd_acquire_read(addr) AO_char_load(addr)
98 # define AO_HAVE_char_load_dd_acquire_read
100 #endif /* !AO_NO_DD_ORDERING */
103 #if defined(AO_HAVE_char_store_release) && !defined(AO_HAVE_char_store)
104 # define AO_char_store(addr, val) AO_char_store_release(addr,val)
105 # define AO_HAVE_char_store
108 #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_release)
109 # define AO_char_store_release(addr,val) AO_char_store_full(addr,val)
110 # define AO_HAVE_char_store_release
113 #if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_write)
114 # define AO_char_store_write(addr,val) AO_char_store_full(addr,val)
115 # define AO_HAVE_char_store_write
118 #if defined(AO_HAVE_char_store_release) \
119 && !defined(AO_HAVE_char_store_release_write)
120 # define AO_char_store_release_write(addr, val) \
121 AO_char_store_release(addr,val)
122 # define AO_HAVE_char_store_release_write
125 #if defined(AO_HAVE_char_store_write) && !defined(AO_HAVE_char_store)
126 # define AO_char_store(addr, val) AO_char_store_write(addr,val)
127 # define AO_HAVE_char_store
130 #if defined(AO_HAVE_char_store) && defined(AO_HAVE_nop_full) \
131 && !defined(AO_HAVE_char_store_release)
132 # define AO_char_store_release(addr,val) \
133 (AO_nop_full(), AO_char_store(addr,val))
134 # define AO_HAVE_char_store_release
137 #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_char_store) \
138 && !defined(AO_HAVE_char_store_write)
139 # define AO_char_store_write(addr, val) \
140 (AO_nop_write(), AO_char_store(addr,val))
141 # define AO_HAVE_char_store_write
144 #if defined(AO_HAVE_char_store_write) \
145 && !defined(AO_HAVE_char_store_release_write)
146 # define AO_char_store_release_write(addr, val) AO_char_store_write(addr,val)
147 # define AO_HAVE_char_store_release_write
150 #if defined(AO_HAVE_char_store_release) && defined(AO_HAVE_nop_full) \
151 && !defined(AO_HAVE_char_store_full)
152 # define AO_char_store_full(addr, val) \
153 (AO_char_store_release(addr, val), AO_nop_full())
154 # define AO_HAVE_char_store_full
157 /* char_fetch_and_add */
158 #if defined(AO_HAVE_char_compare_and_swap_full) \
159 && !defined(AO_HAVE_char_fetch_and_add_full)
160 AO_INLINE unsigned char
161 AO_char_fetch_and_add_full(volatile unsigned char *addr,
169 while (!AO_char_compare_and_swap_full(addr, old, old+incr));
172 # define AO_HAVE_char_fetch_and_add_full
175 #if defined(AO_HAVE_char_compare_and_swap_acquire) \
176 && !defined(AO_HAVE_char_fetch_and_add_acquire)
177 AO_INLINE unsigned char
178 AO_char_fetch_and_add_acquire(volatile unsigned char *addr,
186 while (!AO_char_compare_and_swap_acquire(addr, old, old+incr));
189 # define AO_HAVE_char_fetch_and_add_acquire
192 #if defined(AO_HAVE_char_compare_and_swap_release) \
193 && !defined(AO_HAVE_char_fetch_and_add_release)
194 AO_INLINE unsigned char
195 AO_char_fetch_and_add_release(volatile unsigned char *addr,
203 while (!AO_char_compare_and_swap_release(addr, old, old+incr));
206 # define AO_HAVE_char_fetch_and_add_release
209 #if defined(AO_HAVE_char_fetch_and_add_full)
210 # if !defined(AO_HAVE_char_fetch_and_add_release)
211 # define AO_char_fetch_and_add_release(addr, val) \
212 AO_char_fetch_and_add_full(addr, val)
213 # define AO_HAVE_char_fetch_and_add_release
215 # if !defined(AO_HAVE_char_fetch_and_add_acquire)
216 # define AO_char_fetch_and_add_acquire(addr, val) \
217 AO_char_fetch_and_add_full(addr, val)
218 # define AO_HAVE_char_fetch_and_add_acquire
220 # if !defined(AO_HAVE_char_fetch_and_add_write)
221 # define AO_char_fetch_and_add_write(addr, val) \
222 AO_char_fetch_and_add_full(addr, val)
223 # define AO_HAVE_char_fetch_and_add_write
225 # if !defined(AO_HAVE_char_fetch_and_add_read)
226 # define AO_char_fetch_and_add_read(addr, val) \
227 AO_char_fetch_and_add_full(addr, val)
228 # define AO_HAVE_char_fetch_and_add_read
230 #endif /* AO_HAVE_char_fetch_and_add_full */
232 #if !defined(AO_HAVE_char_fetch_and_add) \
233 && defined(AO_HAVE_char_fetch_and_add_release)
234 # define AO_char_fetch_and_add(addr, val) \
235 AO_char_fetch_and_add_release(addr, val)
236 # define AO_HAVE_char_fetch_and_add
238 #if !defined(AO_HAVE_char_fetch_and_add) \
239 && defined(AO_HAVE_char_fetch_and_add_acquire)
240 # define AO_char_fetch_and_add(addr, val) \
241 AO_char_fetch_and_add_acquire(addr, val)
242 # define AO_HAVE_char_fetch_and_add
244 #if !defined(AO_HAVE_char_fetch_and_add) \
245 && defined(AO_HAVE_char_fetch_and_add_write)
246 # define AO_char_fetch_and_add(addr, val) \
247 AO_char_fetch_and_add_write(addr, val)
248 # define AO_HAVE_char_fetch_and_add
250 #if !defined(AO_HAVE_char_fetch_and_add) \
251 && defined(AO_HAVE_char_fetch_and_add_read)
252 # define AO_char_fetch_and_add(addr, val) \
253 AO_char_fetch_and_add_read(addr, val)
254 # define AO_HAVE_char_fetch_and_add
257 #if defined(AO_HAVE_char_fetch_and_add_acquire) \
258 && defined(AO_HAVE_nop_full) && !defined(AO_HAVE_char_fetch_and_add_full)
259 # define AO_char_fetch_and_add_full(addr, val) \
260 (AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val))
261 # define AO_HAVE_char_fetch_and_add_full
264 #if !defined(AO_HAVE_char_fetch_and_add_release_write) \
265 && defined(AO_HAVE_char_fetch_and_add_write)
266 # define AO_char_fetch_and_add_release_write(addr, val) \
267 AO_char_fetch_and_add_write(addr, val)
268 # define AO_HAVE_char_fetch_and_add_release_write
270 #if !defined(AO_HAVE_char_fetch_and_add_release_write) \
271 && defined(AO_HAVE_char_fetch_and_add_release)
272 # define AO_char_fetch_and_add_release_write(addr, val) \
273 AO_char_fetch_and_add_release(addr, val)
274 # define AO_HAVE_char_fetch_and_add_release_write
277 #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) \
278 && defined(AO_HAVE_char_fetch_and_add_read)
279 # define AO_char_fetch_and_add_acquire_read(addr, val) \
280 AO_char_fetch_and_add_read(addr, val)
281 # define AO_HAVE_char_fetch_and_add_acquire_read
283 #if !defined(AO_HAVE_char_fetch_and_add_acquire_read) \
284 && defined(AO_HAVE_char_fetch_and_add_acquire)
285 # define AO_char_fetch_and_add_acquire_read(addr, val) \
286 AO_char_fetch_and_add_acquire(addr, val)
287 # define AO_HAVE_char_fetch_and_add_acquire_read
290 #ifdef AO_NO_DD_ORDERING
291 # if defined(AO_HAVE_char_fetch_and_add_acquire_read)
292 # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
293 AO_char_fetch_and_add_acquire_read(addr, val)
294 # define AO_HAVE_char_fetch_and_add_dd_acquire_read
297 # if defined(AO_HAVE_char_fetch_and_add)
298 # define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
299 AO_char_fetch_and_add(addr, val)
300 # define AO_HAVE_char_fetch_and_add_dd_acquire_read
302 #endif /* !AO_NO_DD_ORDERING */
304 /* char_fetch_and_add1 */
305 #if defined(AO_HAVE_char_fetch_and_add_full) \
306 && !defined(AO_HAVE_char_fetch_and_add1_full)
307 # define AO_char_fetch_and_add1_full(addr) \
308 AO_char_fetch_and_add_full(addr,1)
309 # define AO_HAVE_char_fetch_and_add1_full
311 #if defined(AO_HAVE_char_fetch_and_add_release) \
312 && !defined(AO_HAVE_char_fetch_and_add1_release)
313 # define AO_char_fetch_and_add1_release(addr) \
314 AO_char_fetch_and_add_release(addr,1)
315 # define AO_HAVE_char_fetch_and_add1_release
317 #if defined(AO_HAVE_char_fetch_and_add_acquire) \
318 && !defined(AO_HAVE_char_fetch_and_add1_acquire)
319 # define AO_char_fetch_and_add1_acquire(addr) \
320 AO_char_fetch_and_add_acquire(addr,1)
321 # define AO_HAVE_char_fetch_and_add1_acquire
323 #if defined(AO_HAVE_char_fetch_and_add_write) \
324 && !defined(AO_HAVE_char_fetch_and_add1_write)
325 # define AO_char_fetch_and_add1_write(addr) \
326 AO_char_fetch_and_add_write(addr,1)
327 # define AO_HAVE_char_fetch_and_add1_write
329 #if defined(AO_HAVE_char_fetch_and_add_read) \
330 && !defined(AO_HAVE_char_fetch_and_add1_read)
331 # define AO_char_fetch_and_add1_read(addr) \
332 AO_char_fetch_and_add_read(addr,1)
333 # define AO_HAVE_char_fetch_and_add1_read
335 #if defined(AO_HAVE_char_fetch_and_add_release_write) \
336 && !defined(AO_HAVE_char_fetch_and_add1_release_write)
337 # define AO_char_fetch_and_add1_release_write(addr) \
338 AO_char_fetch_and_add_release_write(addr,1)
339 # define AO_HAVE_char_fetch_and_add1_release_write
341 #if defined(AO_HAVE_char_fetch_and_add_acquire_read) \
342 && !defined(AO_HAVE_char_fetch_and_add1_acquire_read)
343 # define AO_char_fetch_and_add1_acquire_read(addr) \
344 AO_char_fetch_and_add_acquire_read(addr,1)
345 # define AO_HAVE_char_fetch_and_add1_acquire_read
347 #if defined(AO_HAVE_char_fetch_and_add) \
348 && !defined(AO_HAVE_char_fetch_and_add1)
349 # define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add(addr,1)
350 # define AO_HAVE_char_fetch_and_add1
353 #if defined(AO_HAVE_char_fetch_and_add1_full)
354 # if !defined(AO_HAVE_char_fetch_and_add1_release)
355 # define AO_char_fetch_and_add1_release(addr) \
356 AO_char_fetch_and_add1_full(addr)
357 # define AO_HAVE_char_fetch_and_add1_release
359 # if !defined(AO_HAVE_char_fetch_and_add1_acquire)
360 # define AO_char_fetch_and_add1_acquire(addr) \
361 AO_char_fetch_and_add1_full(addr)
362 # define AO_HAVE_char_fetch_and_add1_acquire
364 # if !defined(AO_HAVE_char_fetch_and_add1_write)
365 # define AO_char_fetch_and_add1_write(addr) \
366 AO_char_fetch_and_add1_full(addr)
367 # define AO_HAVE_char_fetch_and_add1_write
369 # if !defined(AO_HAVE_char_fetch_and_add1_read)
370 # define AO_char_fetch_and_add1_read(addr) \
371 AO_char_fetch_and_add1_full(addr)
372 # define AO_HAVE_char_fetch_and_add1_read
374 #endif /* AO_HAVE_char_fetch_and_add1_full */
376 #if !defined(AO_HAVE_char_fetch_and_add1) \
377 && defined(AO_HAVE_char_fetch_and_add1_release)
378 # define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_release(addr)
379 # define AO_HAVE_char_fetch_and_add1
381 #if !defined(AO_HAVE_char_fetch_and_add1) \
382 && defined(AO_HAVE_char_fetch_and_add1_acquire)
383 # define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_acquire(addr)
384 # define AO_HAVE_char_fetch_and_add1
386 #if !defined(AO_HAVE_char_fetch_and_add1) \
387 && defined(AO_HAVE_char_fetch_and_add1_write)
388 # define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_write(addr)
389 # define AO_HAVE_char_fetch_and_add1
391 #if !defined(AO_HAVE_char_fetch_and_add1) \
392 && defined(AO_HAVE_char_fetch_and_add1_read)
393 # define AO_char_fetch_and_add1(addr) AO_char_fetch_and_add1_read(addr)
394 # define AO_HAVE_char_fetch_and_add1
397 #if defined(AO_HAVE_char_fetch_and_add1_acquire) \
398 && defined(AO_HAVE_nop_full) \
399 && !defined(AO_HAVE_char_fetch_and_add1_full)
400 # define AO_char_fetch_and_add1_full(addr) \
401 (AO_nop_full(), AO_char_fetch_and_add1_acquire(addr))
402 # define AO_HAVE_char_fetch_and_add1_full
405 #if !defined(AO_HAVE_char_fetch_and_add1_release_write) \
406 && defined(AO_HAVE_char_fetch_and_add1_write)
407 # define AO_char_fetch_and_add1_release_write(addr) \
408 AO_char_fetch_and_add1_write(addr)
409 # define AO_HAVE_char_fetch_and_add1_release_write
411 #if !defined(AO_HAVE_char_fetch_and_add1_release_write) \
412 && defined(AO_HAVE_char_fetch_and_add1_release)
413 # define AO_char_fetch_and_add1_release_write(addr) \
414 AO_char_fetch_and_add1_release(addr)
415 # define AO_HAVE_char_fetch_and_add1_release_write
417 #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) \
418 && defined(AO_HAVE_char_fetch_and_add1_read)
419 # define AO_char_fetch_and_add1_acquire_read(addr) \
420 AO_char_fetch_and_add1_read(addr)
421 # define AO_HAVE_char_fetch_and_add1_acquire_read
423 #if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) \
424 && defined(AO_HAVE_char_fetch_and_add1_acquire)
425 # define AO_char_fetch_and_add1_acquire_read(addr) \
426 AO_char_fetch_and_add1_acquire(addr)
427 # define AO_HAVE_char_fetch_and_add1_acquire_read
430 #ifdef AO_NO_DD_ORDERING
431 # if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
432 # define AO_char_fetch_and_add1_dd_acquire_read(addr) \
433 AO_char_fetch_and_add1_acquire_read(addr)
434 # define AO_HAVE_char_fetch_and_add1_dd_acquire_read
437 # if defined(AO_HAVE_char_fetch_and_add1)
438 # define AO_char_fetch_and_add1_dd_acquire_read(addr) \
439 AO_char_fetch_and_add1(addr)
440 # define AO_HAVE_char_fetch_and_add1_dd_acquire_read
442 #endif /* !AO_NO_DD_ORDERING */
444 /* char_fetch_and_sub1 */
445 #if defined(AO_HAVE_char_fetch_and_add_full) \
446 && !defined(AO_HAVE_char_fetch_and_sub1_full)
447 # define AO_char_fetch_and_sub1_full(addr) \
448 AO_char_fetch_and_add_full(addr,(unsigned char)(-1))
449 # define AO_HAVE_char_fetch_and_sub1_full
451 #if defined(AO_HAVE_char_fetch_and_add_release) \
452 && !defined(AO_HAVE_char_fetch_and_sub1_release)
453 # define AO_char_fetch_and_sub1_release(addr) \
454 AO_char_fetch_and_add_release(addr,(unsigned char)(-1))
455 # define AO_HAVE_char_fetch_and_sub1_release
457 #if defined(AO_HAVE_char_fetch_and_add_acquire) \
458 && !defined(AO_HAVE_char_fetch_and_sub1_acquire)
459 # define AO_char_fetch_and_sub1_acquire(addr) \
460 AO_char_fetch_and_add_acquire(addr,(unsigned char)(-1))
461 # define AO_HAVE_char_fetch_and_sub1_acquire
463 #if defined(AO_HAVE_char_fetch_and_add_write) \
464 && !defined(AO_HAVE_char_fetch_and_sub1_write)
465 # define AO_char_fetch_and_sub1_write(addr) \
466 AO_char_fetch_and_add_write(addr,(unsigned char)(-1))
467 # define AO_HAVE_char_fetch_and_sub1_write
469 #if defined(AO_HAVE_char_fetch_and_add_read) \
470 && !defined(AO_HAVE_char_fetch_and_sub1_read)
471 # define AO_char_fetch_and_sub1_read(addr) \
472 AO_char_fetch_and_add_read(addr,(unsigned char)(-1))
473 # define AO_HAVE_char_fetch_and_sub1_read
475 #if defined(AO_HAVE_char_fetch_and_add_release_write) \
476 && !defined(AO_HAVE_char_fetch_and_sub1_release_write)
477 # define AO_char_fetch_and_sub1_release_write(addr) \
478 AO_char_fetch_and_add_release_write(addr,(unsigned char)(-1))
479 # define AO_HAVE_char_fetch_and_sub1_release_write
481 #if defined(AO_HAVE_char_fetch_and_add_acquire_read) \
482 && !defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
483 # define AO_char_fetch_and_sub1_acquire_read(addr) \
484 AO_char_fetch_and_add_acquire_read(addr,(unsigned char)(-1))
485 # define AO_HAVE_char_fetch_and_sub1_acquire_read
487 #if defined(AO_HAVE_char_fetch_and_add) \
488 && !defined(AO_HAVE_char_fetch_and_sub1)
489 # define AO_char_fetch_and_sub1(addr) \
490 AO_char_fetch_and_add(addr,(unsigned char)(-1))
491 # define AO_HAVE_char_fetch_and_sub1
494 #if defined(AO_HAVE_char_fetch_and_sub1_full)
495 # if !defined(AO_HAVE_char_fetch_and_sub1_release)
496 # define AO_char_fetch_and_sub1_release(addr) \
497 AO_char_fetch_and_sub1_full(addr)
498 # define AO_HAVE_char_fetch_and_sub1_release
500 # if !defined(AO_HAVE_char_fetch_and_sub1_acquire)
501 # define AO_char_fetch_and_sub1_acquire(addr) \
502 AO_char_fetch_and_sub1_full(addr)
503 # define AO_HAVE_char_fetch_and_sub1_acquire
505 # if !defined(AO_HAVE_char_fetch_and_sub1_write)
506 # define AO_char_fetch_and_sub1_write(addr) \
507 AO_char_fetch_and_sub1_full(addr)
508 # define AO_HAVE_char_fetch_and_sub1_write
510 # if !defined(AO_HAVE_char_fetch_and_sub1_read)
511 # define AO_char_fetch_and_sub1_read(addr) \
512 AO_char_fetch_and_sub1_full(addr)
513 # define AO_HAVE_char_fetch_and_sub1_read
515 #endif /* AO_HAVE_char_fetch_and_sub1_full */
517 #if !defined(AO_HAVE_char_fetch_and_sub1) \
518 && defined(AO_HAVE_char_fetch_and_sub1_release)
519 # define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_release(addr)
520 # define AO_HAVE_char_fetch_and_sub1
522 #if !defined(AO_HAVE_char_fetch_and_sub1) \
523 && defined(AO_HAVE_char_fetch_and_sub1_acquire)
524 # define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_acquire(addr)
525 # define AO_HAVE_char_fetch_and_sub1
527 #if !defined(AO_HAVE_char_fetch_and_sub1) \
528 && defined(AO_HAVE_char_fetch_and_sub1_write)
529 # define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_write(addr)
530 # define AO_HAVE_char_fetch_and_sub1
532 #if !defined(AO_HAVE_char_fetch_and_sub1) \
533 && defined(AO_HAVE_char_fetch_and_sub1_read)
534 # define AO_char_fetch_and_sub1(addr) AO_char_fetch_and_sub1_read(addr)
535 # define AO_HAVE_char_fetch_and_sub1
538 #if defined(AO_HAVE_char_fetch_and_sub1_acquire) \
539 && defined(AO_HAVE_nop_full) \
540 && !defined(AO_HAVE_char_fetch_and_sub1_full)
541 # define AO_char_fetch_and_sub1_full(addr) \
542 (AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr))
543 # define AO_HAVE_char_fetch_and_sub1_full
546 #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) \
547 && defined(AO_HAVE_char_fetch_and_sub1_write)
548 # define AO_char_fetch_and_sub1_release_write(addr) \
549 AO_char_fetch_and_sub1_write(addr)
550 # define AO_HAVE_char_fetch_and_sub1_release_write
552 #if !defined(AO_HAVE_char_fetch_and_sub1_release_write) \
553 && defined(AO_HAVE_char_fetch_and_sub1_release)
554 # define AO_char_fetch_and_sub1_release_write(addr) \
555 AO_char_fetch_and_sub1_release(addr)
556 # define AO_HAVE_char_fetch_and_sub1_release_write
558 #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) \
559 && defined(AO_HAVE_char_fetch_and_sub1_read)
560 # define AO_char_fetch_and_sub1_acquire_read(addr) \
561 AO_char_fetch_and_sub1_read(addr)
562 # define AO_HAVE_char_fetch_and_sub1_acquire_read
564 #if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) \
565 && defined(AO_HAVE_char_fetch_and_sub1_acquire)
566 # define AO_char_fetch_and_sub1_acquire_read(addr) \
567 AO_char_fetch_and_sub1_acquire(addr)
568 # define AO_HAVE_char_fetch_and_sub1_acquire_read
571 #ifdef AO_NO_DD_ORDERING
572 # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
573 # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
574 AO_char_fetch_and_sub1_acquire_read(addr)
575 # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
578 # if defined(AO_HAVE_char_fetch_and_sub1)
579 # define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
580 AO_char_fetch_and_sub1(addr)
581 # define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
583 #endif /* !AO_NO_DD_ORDERING */
585 * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
587 * Permission is hereby granted, free of charge, to any person obtaining a copy
588 * of this software and associated documentation files (the "Software"), to deal
589 * in the Software without restriction, including without limitation the rights
590 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
591 * copies of the Software, and to permit persons to whom the Software is
592 * furnished to do so, subject to the following conditions:
594 * The above copyright notice and this permission notice shall be included in
595 * all copies or substantial portions of the Software.
597 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
598 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
599 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
600 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
601 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
602 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
607 #if defined(AO_HAVE_short_load_acquire) && !defined(AO_HAVE_short_load)
608 # define AO_short_load(addr) AO_short_load_acquire(addr)
609 # define AO_HAVE_short_load
612 #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_acquire)
613 # define AO_short_load_acquire(addr) AO_short_load_full(addr)
614 # define AO_HAVE_short_load_acquire
617 #if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_read)
618 # define AO_short_load_read(addr) AO_short_load_full(addr)
619 # define AO_HAVE_short_load_read
622 #if !defined(AO_HAVE_short_load_acquire_read) \
623 && defined(AO_HAVE_short_load_acquire)
624 # define AO_short_load_acquire_read(addr) AO_short_load_acquire(addr)
625 # define AO_HAVE_short_load_acquire_read
628 #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_full) \
629 && !defined(AO_HAVE_short_load_acquire)
630 AO_INLINE unsigned short
631 AO_short_load_acquire(const volatile unsigned short *addr)
633 unsigned short result = AO_short_load(addr);
634 /* Acquire barrier would be useless, since the load could be delayed */
639 # define AO_HAVE_short_load_acquire
642 #if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_read) \
643 && !defined(AO_HAVE_short_load_read)
644 AO_INLINE unsigned short
645 AO_short_load_read(const volatile unsigned short *addr)
647 unsigned short result = AO_short_load(addr);
648 /* Acquire barrier would be useless, since the load could be delayed */
653 # define AO_HAVE_short_load_read
656 #if defined(AO_HAVE_short_load_acquire) && defined(AO_HAVE_nop_full) \
657 && !defined(AO_HAVE_short_load_full)
658 # define AO_short_load_full(addr) (AO_nop_full(), AO_short_load_acquire(addr))
659 # define AO_HAVE_short_load_full
662 #if !defined(AO_HAVE_short_load_acquire_read) \
663 && defined(AO_HAVE_short_load_read)
664 # define AO_short_load_acquire_read(addr) AO_short_load_read(addr)
665 # define AO_HAVE_short_load_acquire_read
668 #if defined(AO_HAVE_short_load_acquire_read) && !defined(AO_HAVE_short_load)
669 # define AO_short_load(addr) AO_short_load_acquire_read(addr)
670 # define AO_HAVE_short_load
673 #ifdef AO_NO_DD_ORDERING
674 # if defined(AO_HAVE_short_load_acquire_read)
675 # define AO_short_load_dd_acquire_read(addr) AO_short_load_acquire_read(addr)
676 # define AO_HAVE_short_load_dd_acquire_read
679 # if defined(AO_HAVE_short_load)
680 # define AO_short_load_dd_acquire_read(addr) AO_short_load(addr)
681 # define AO_HAVE_short_load_dd_acquire_read
683 #endif /* !AO_NO_DD_ORDERING */
686 #if defined(AO_HAVE_short_store_release) && !defined(AO_HAVE_short_store)
687 # define AO_short_store(addr, val) AO_short_store_release(addr,val)
688 # define AO_HAVE_short_store
691 #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_release)
692 # define AO_short_store_release(addr,val) AO_short_store_full(addr,val)
693 # define AO_HAVE_short_store_release
696 #if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_write)
697 # define AO_short_store_write(addr,val) AO_short_store_full(addr,val)
698 # define AO_HAVE_short_store_write
701 #if defined(AO_HAVE_short_store_release) \
702 && !defined(AO_HAVE_short_store_release_write)
703 # define AO_short_store_release_write(addr, val) \
704 AO_short_store_release(addr,val)
705 # define AO_HAVE_short_store_release_write
708 #if defined(AO_HAVE_short_store_write) && !defined(AO_HAVE_short_store)
709 # define AO_short_store(addr, val) AO_short_store_write(addr,val)
710 # define AO_HAVE_short_store
713 #if defined(AO_HAVE_short_store) && defined(AO_HAVE_nop_full) \
714 && !defined(AO_HAVE_short_store_release)
715 # define AO_short_store_release(addr,val) \
716 (AO_nop_full(), AO_short_store(addr,val))
717 # define AO_HAVE_short_store_release
720 #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_short_store) \
721 && !defined(AO_HAVE_short_store_write)
722 # define AO_short_store_write(addr, val) \
723 (AO_nop_write(), AO_short_store(addr,val))
724 # define AO_HAVE_short_store_write
727 #if defined(AO_HAVE_short_store_write) \
728 && !defined(AO_HAVE_short_store_release_write)
729 # define AO_short_store_release_write(addr, val) AO_short_store_write(addr,val)
730 # define AO_HAVE_short_store_release_write
733 #if defined(AO_HAVE_short_store_release) && defined(AO_HAVE_nop_full) \
734 && !defined(AO_HAVE_short_store_full)
735 # define AO_short_store_full(addr, val) \
736 (AO_short_store_release(addr, val), AO_nop_full())
737 # define AO_HAVE_short_store_full
740 /* short_fetch_and_add */
741 #if defined(AO_HAVE_short_compare_and_swap_full) \
742 && !defined(AO_HAVE_short_fetch_and_add_full)
743 AO_INLINE unsigned short
744 AO_short_fetch_and_add_full(volatile unsigned short *addr,
752 while (!AO_short_compare_and_swap_full(addr, old, old+incr));
755 # define AO_HAVE_short_fetch_and_add_full
758 #if defined(AO_HAVE_short_compare_and_swap_acquire) \
759 && !defined(AO_HAVE_short_fetch_and_add_acquire)
760 AO_INLINE unsigned short
761 AO_short_fetch_and_add_acquire(volatile unsigned short *addr,
769 while (!AO_short_compare_and_swap_acquire(addr, old, old+incr));
772 # define AO_HAVE_short_fetch_and_add_acquire
775 #if defined(AO_HAVE_short_compare_and_swap_release) \
776 && !defined(AO_HAVE_short_fetch_and_add_release)
777 AO_INLINE unsigned short
778 AO_short_fetch_and_add_release(volatile unsigned short *addr,
786 while (!AO_short_compare_and_swap_release(addr, old, old+incr));
789 # define AO_HAVE_short_fetch_and_add_release
792 #if defined(AO_HAVE_short_fetch_and_add_full)
793 # if !defined(AO_HAVE_short_fetch_and_add_release)
794 # define AO_short_fetch_and_add_release(addr, val) \
795 AO_short_fetch_and_add_full(addr, val)
796 # define AO_HAVE_short_fetch_and_add_release
798 # if !defined(AO_HAVE_short_fetch_and_add_acquire)
799 # define AO_short_fetch_and_add_acquire(addr, val) \
800 AO_short_fetch_and_add_full(addr, val)
801 # define AO_HAVE_short_fetch_and_add_acquire
803 # if !defined(AO_HAVE_short_fetch_and_add_write)
804 # define AO_short_fetch_and_add_write(addr, val) \
805 AO_short_fetch_and_add_full(addr, val)
806 # define AO_HAVE_short_fetch_and_add_write
808 # if !defined(AO_HAVE_short_fetch_and_add_read)
809 # define AO_short_fetch_and_add_read(addr, val) \
810 AO_short_fetch_and_add_full(addr, val)
811 # define AO_HAVE_short_fetch_and_add_read
813 #endif /* AO_HAVE_short_fetch_and_add_full */
815 #if !defined(AO_HAVE_short_fetch_and_add) \
816 && defined(AO_HAVE_short_fetch_and_add_release)
817 # define AO_short_fetch_and_add(addr, val) \
818 AO_short_fetch_and_add_release(addr, val)
819 # define AO_HAVE_short_fetch_and_add
821 #if !defined(AO_HAVE_short_fetch_and_add) \
822 && defined(AO_HAVE_short_fetch_and_add_acquire)
823 # define AO_short_fetch_and_add(addr, val) \
824 AO_short_fetch_and_add_acquire(addr, val)
825 # define AO_HAVE_short_fetch_and_add
827 #if !defined(AO_HAVE_short_fetch_and_add) \
828 && defined(AO_HAVE_short_fetch_and_add_write)
829 # define AO_short_fetch_and_add(addr, val) \
830 AO_short_fetch_and_add_write(addr, val)
831 # define AO_HAVE_short_fetch_and_add
833 #if !defined(AO_HAVE_short_fetch_and_add) \
834 && defined(AO_HAVE_short_fetch_and_add_read)
835 # define AO_short_fetch_and_add(addr, val) \
836 AO_short_fetch_and_add_read(addr, val)
837 # define AO_HAVE_short_fetch_and_add
840 #if defined(AO_HAVE_short_fetch_and_add_acquire) \
841 && defined(AO_HAVE_nop_full) && !defined(AO_HAVE_short_fetch_and_add_full)
842 # define AO_short_fetch_and_add_full(addr, val) \
843 (AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val))
844 # define AO_HAVE_short_fetch_and_add_full
847 #if !defined(AO_HAVE_short_fetch_and_add_release_write) \
848 && defined(AO_HAVE_short_fetch_and_add_write)
849 # define AO_short_fetch_and_add_release_write(addr, val) \
850 AO_short_fetch_and_add_write(addr, val)
851 # define AO_HAVE_short_fetch_and_add_release_write
853 #if !defined(AO_HAVE_short_fetch_and_add_release_write) \
854 && defined(AO_HAVE_short_fetch_and_add_release)
855 # define AO_short_fetch_and_add_release_write(addr, val) \
856 AO_short_fetch_and_add_release(addr, val)
857 # define AO_HAVE_short_fetch_and_add_release_write
860 #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) \
861 && defined(AO_HAVE_short_fetch_and_add_read)
862 # define AO_short_fetch_and_add_acquire_read(addr, val) \
863 AO_short_fetch_and_add_read(addr, val)
864 # define AO_HAVE_short_fetch_and_add_acquire_read
866 #if !defined(AO_HAVE_short_fetch_and_add_acquire_read) \
867 && defined(AO_HAVE_short_fetch_and_add_acquire)
868 # define AO_short_fetch_and_add_acquire_read(addr, val) \
869 AO_short_fetch_and_add_acquire(addr, val)
870 # define AO_HAVE_short_fetch_and_add_acquire_read
873 #ifdef AO_NO_DD_ORDERING
874 # if defined(AO_HAVE_short_fetch_and_add_acquire_read)
875 # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
876 AO_short_fetch_and_add_acquire_read(addr, val)
877 # define AO_HAVE_short_fetch_and_add_dd_acquire_read
880 # if defined(AO_HAVE_short_fetch_and_add)
881 # define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
882 AO_short_fetch_and_add(addr, val)
883 # define AO_HAVE_short_fetch_and_add_dd_acquire_read
885 #endif /* !AO_NO_DD_ORDERING */
887 /* short_fetch_and_add1 */
888 #if defined(AO_HAVE_short_fetch_and_add_full) \
889 && !defined(AO_HAVE_short_fetch_and_add1_full)
890 # define AO_short_fetch_and_add1_full(addr) \
891 AO_short_fetch_and_add_full(addr,1)
892 # define AO_HAVE_short_fetch_and_add1_full
894 #if defined(AO_HAVE_short_fetch_and_add_release) \
895 && !defined(AO_HAVE_short_fetch_and_add1_release)
896 # define AO_short_fetch_and_add1_release(addr) \
897 AO_short_fetch_and_add_release(addr,1)
898 # define AO_HAVE_short_fetch_and_add1_release
900 #if defined(AO_HAVE_short_fetch_and_add_acquire) \
901 && !defined(AO_HAVE_short_fetch_and_add1_acquire)
902 # define AO_short_fetch_and_add1_acquire(addr) \
903 AO_short_fetch_and_add_acquire(addr,1)
904 # define AO_HAVE_short_fetch_and_add1_acquire
906 #if defined(AO_HAVE_short_fetch_and_add_write) \
907 && !defined(AO_HAVE_short_fetch_and_add1_write)
908 # define AO_short_fetch_and_add1_write(addr) \
909 AO_short_fetch_and_add_write(addr,1)
910 # define AO_HAVE_short_fetch_and_add1_write
912 #if defined(AO_HAVE_short_fetch_and_add_read) \
913 && !defined(AO_HAVE_short_fetch_and_add1_read)
914 # define AO_short_fetch_and_add1_read(addr) \
915 AO_short_fetch_and_add_read(addr,1)
916 # define AO_HAVE_short_fetch_and_add1_read
918 #if defined(AO_HAVE_short_fetch_and_add_release_write) \
919 && !defined(AO_HAVE_short_fetch_and_add1_release_write)
920 # define AO_short_fetch_and_add1_release_write(addr) \
921 AO_short_fetch_and_add_release_write(addr,1)
922 # define AO_HAVE_short_fetch_and_add1_release_write
924 #if defined(AO_HAVE_short_fetch_and_add_acquire_read) \
925 && !defined(AO_HAVE_short_fetch_and_add1_acquire_read)
926 # define AO_short_fetch_and_add1_acquire_read(addr) \
927 AO_short_fetch_and_add_acquire_read(addr,1)
928 # define AO_HAVE_short_fetch_and_add1_acquire_read
930 #if defined(AO_HAVE_short_fetch_and_add) \
931 && !defined(AO_HAVE_short_fetch_and_add1)
932 # define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add(addr,1)
933 # define AO_HAVE_short_fetch_and_add1
936 #if defined(AO_HAVE_short_fetch_and_add1_full)
937 # if !defined(AO_HAVE_short_fetch_and_add1_release)
938 # define AO_short_fetch_and_add1_release(addr) \
939 AO_short_fetch_and_add1_full(addr)
940 # define AO_HAVE_short_fetch_and_add1_release
942 # if !defined(AO_HAVE_short_fetch_and_add1_acquire)
943 # define AO_short_fetch_and_add1_acquire(addr) \
944 AO_short_fetch_and_add1_full(addr)
945 # define AO_HAVE_short_fetch_and_add1_acquire
947 # if !defined(AO_HAVE_short_fetch_and_add1_write)
948 # define AO_short_fetch_and_add1_write(addr) \
949 AO_short_fetch_and_add1_full(addr)
950 # define AO_HAVE_short_fetch_and_add1_write
952 # if !defined(AO_HAVE_short_fetch_and_add1_read)
953 # define AO_short_fetch_and_add1_read(addr) \
954 AO_short_fetch_and_add1_full(addr)
955 # define AO_HAVE_short_fetch_and_add1_read
957 #endif /* AO_HAVE_short_fetch_and_add1_full */
959 #if !defined(AO_HAVE_short_fetch_and_add1) \
960 && defined(AO_HAVE_short_fetch_and_add1_release)
961 # define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_release(addr)
962 # define AO_HAVE_short_fetch_and_add1
964 #if !defined(AO_HAVE_short_fetch_and_add1) \
965 && defined(AO_HAVE_short_fetch_and_add1_acquire)
966 # define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_acquire(addr)
967 # define AO_HAVE_short_fetch_and_add1
969 #if !defined(AO_HAVE_short_fetch_and_add1) \
970 && defined(AO_HAVE_short_fetch_and_add1_write)
971 # define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_write(addr)
972 # define AO_HAVE_short_fetch_and_add1
974 #if !defined(AO_HAVE_short_fetch_and_add1) \
975 && defined(AO_HAVE_short_fetch_and_add1_read)
976 # define AO_short_fetch_and_add1(addr) AO_short_fetch_and_add1_read(addr)
977 # define AO_HAVE_short_fetch_and_add1
980 #if defined(AO_HAVE_short_fetch_and_add1_acquire) \
981 && defined(AO_HAVE_nop_full) \
982 && !defined(AO_HAVE_short_fetch_and_add1_full)
983 # define AO_short_fetch_and_add1_full(addr) \
984 (AO_nop_full(), AO_short_fetch_and_add1_acquire(addr))
985 # define AO_HAVE_short_fetch_and_add1_full
988 #if !defined(AO_HAVE_short_fetch_and_add1_release_write) \
989 && defined(AO_HAVE_short_fetch_and_add1_write)
990 # define AO_short_fetch_and_add1_release_write(addr) \
991 AO_short_fetch_and_add1_write(addr)
992 # define AO_HAVE_short_fetch_and_add1_release_write
994 #if !defined(AO_HAVE_short_fetch_and_add1_release_write) \
995 && defined(AO_HAVE_short_fetch_and_add1_release)
996 # define AO_short_fetch_and_add1_release_write(addr) \
997 AO_short_fetch_and_add1_release(addr)
998 # define AO_HAVE_short_fetch_and_add1_release_write
1000 #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) \
1001 && defined(AO_HAVE_short_fetch_and_add1_read)
1002 # define AO_short_fetch_and_add1_acquire_read(addr) \
1003 AO_short_fetch_and_add1_read(addr)
1004 # define AO_HAVE_short_fetch_and_add1_acquire_read
1006 #if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) \
1007 && defined(AO_HAVE_short_fetch_and_add1_acquire)
1008 # define AO_short_fetch_and_add1_acquire_read(addr) \
1009 AO_short_fetch_and_add1_acquire(addr)
1010 # define AO_HAVE_short_fetch_and_add1_acquire_read
1013 #ifdef AO_NO_DD_ORDERING
1014 # if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
1015 # define AO_short_fetch_and_add1_dd_acquire_read(addr) \
1016 AO_short_fetch_and_add1_acquire_read(addr)
1017 # define AO_HAVE_short_fetch_and_add1_dd_acquire_read
1020 # if defined(AO_HAVE_short_fetch_and_add1)
1021 # define AO_short_fetch_and_add1_dd_acquire_read(addr) \
1022 AO_short_fetch_and_add1(addr)
1023 # define AO_HAVE_short_fetch_and_add1_dd_acquire_read
1025 #endif /* !AO_NO_DD_ORDERING */
1027 /* short_fetch_and_sub1 */
1028 #if defined(AO_HAVE_short_fetch_and_add_full) \
1029 && !defined(AO_HAVE_short_fetch_and_sub1_full)
1030 # define AO_short_fetch_and_sub1_full(addr) \
1031 AO_short_fetch_and_add_full(addr,(unsigned short)(-1))
1032 # define AO_HAVE_short_fetch_and_sub1_full
1034 #if defined(AO_HAVE_short_fetch_and_add_release) \
1035 && !defined(AO_HAVE_short_fetch_and_sub1_release)
1036 # define AO_short_fetch_and_sub1_release(addr) \
1037 AO_short_fetch_and_add_release(addr,(unsigned short)(-1))
1038 # define AO_HAVE_short_fetch_and_sub1_release
1040 #if defined(AO_HAVE_short_fetch_and_add_acquire) \
1041 && !defined(AO_HAVE_short_fetch_and_sub1_acquire)
1042 # define AO_short_fetch_and_sub1_acquire(addr) \
1043 AO_short_fetch_and_add_acquire(addr,(unsigned short)(-1))
1044 # define AO_HAVE_short_fetch_and_sub1_acquire
1046 #if defined(AO_HAVE_short_fetch_and_add_write) \
1047 && !defined(AO_HAVE_short_fetch_and_sub1_write)
1048 # define AO_short_fetch_and_sub1_write(addr) \
1049 AO_short_fetch_and_add_write(addr,(unsigned short)(-1))
1050 # define AO_HAVE_short_fetch_and_sub1_write
1052 #if defined(AO_HAVE_short_fetch_and_add_read) \
1053 && !defined(AO_HAVE_short_fetch_and_sub1_read)
1054 # define AO_short_fetch_and_sub1_read(addr) \
1055 AO_short_fetch_and_add_read(addr,(unsigned short)(-1))
1056 # define AO_HAVE_short_fetch_and_sub1_read
1058 #if defined(AO_HAVE_short_fetch_and_add_release_write) \
1059 && !defined(AO_HAVE_short_fetch_and_sub1_release_write)
1060 # define AO_short_fetch_and_sub1_release_write(addr) \
1061 AO_short_fetch_and_add_release_write(addr,(unsigned short)(-1))
1062 # define AO_HAVE_short_fetch_and_sub1_release_write
1064 #if defined(AO_HAVE_short_fetch_and_add_acquire_read) \
1065 && !defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
1066 # define AO_short_fetch_and_sub1_acquire_read(addr) \
1067 AO_short_fetch_and_add_acquire_read(addr,(unsigned short)(-1))
1068 # define AO_HAVE_short_fetch_and_sub1_acquire_read
1070 #if defined(AO_HAVE_short_fetch_and_add) \
1071 && !defined(AO_HAVE_short_fetch_and_sub1)
1072 # define AO_short_fetch_and_sub1(addr) \
1073 AO_short_fetch_and_add(addr,(unsigned short)(-1))
1074 # define AO_HAVE_short_fetch_and_sub1
1077 #if defined(AO_HAVE_short_fetch_and_sub1_full)
1078 # if !defined(AO_HAVE_short_fetch_and_sub1_release)
1079 # define AO_short_fetch_and_sub1_release(addr) \
1080 AO_short_fetch_and_sub1_full(addr)
1081 # define AO_HAVE_short_fetch_and_sub1_release
1083 # if !defined(AO_HAVE_short_fetch_and_sub1_acquire)
1084 # define AO_short_fetch_and_sub1_acquire(addr) \
1085 AO_short_fetch_and_sub1_full(addr)
1086 # define AO_HAVE_short_fetch_and_sub1_acquire
1088 # if !defined(AO_HAVE_short_fetch_and_sub1_write)
1089 # define AO_short_fetch_and_sub1_write(addr) \
1090 AO_short_fetch_and_sub1_full(addr)
1091 # define AO_HAVE_short_fetch_and_sub1_write
1093 # if !defined(AO_HAVE_short_fetch_and_sub1_read)
1094 # define AO_short_fetch_and_sub1_read(addr) \
1095 AO_short_fetch_and_sub1_full(addr)
1096 # define AO_HAVE_short_fetch_and_sub1_read
1098 #endif /* AO_HAVE_short_fetch_and_sub1_full */
1100 #if !defined(AO_HAVE_short_fetch_and_sub1) \
1101 && defined(AO_HAVE_short_fetch_and_sub1_release)
1102 # define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_release(addr)
1103 # define AO_HAVE_short_fetch_and_sub1
1105 #if !defined(AO_HAVE_short_fetch_and_sub1) \
1106 && defined(AO_HAVE_short_fetch_and_sub1_acquire)
1107 # define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_acquire(addr)
1108 # define AO_HAVE_short_fetch_and_sub1
1110 #if !defined(AO_HAVE_short_fetch_and_sub1) \
1111 && defined(AO_HAVE_short_fetch_and_sub1_write)
1112 # define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_write(addr)
1113 # define AO_HAVE_short_fetch_and_sub1
1115 #if !defined(AO_HAVE_short_fetch_and_sub1) \
1116 && defined(AO_HAVE_short_fetch_and_sub1_read)
1117 # define AO_short_fetch_and_sub1(addr) AO_short_fetch_and_sub1_read(addr)
1118 # define AO_HAVE_short_fetch_and_sub1
1121 #if defined(AO_HAVE_short_fetch_and_sub1_acquire) \
1122 && defined(AO_HAVE_nop_full) \
1123 && !defined(AO_HAVE_short_fetch_and_sub1_full)
1124 # define AO_short_fetch_and_sub1_full(addr) \
1125 (AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr))
1126 # define AO_HAVE_short_fetch_and_sub1_full
1129 #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) \
1130 && defined(AO_HAVE_short_fetch_and_sub1_write)
1131 # define AO_short_fetch_and_sub1_release_write(addr) \
1132 AO_short_fetch_and_sub1_write(addr)
1133 # define AO_HAVE_short_fetch_and_sub1_release_write
1135 #if !defined(AO_HAVE_short_fetch_and_sub1_release_write) \
1136 && defined(AO_HAVE_short_fetch_and_sub1_release)
1137 # define AO_short_fetch_and_sub1_release_write(addr) \
1138 AO_short_fetch_and_sub1_release(addr)
1139 # define AO_HAVE_short_fetch_and_sub1_release_write
1141 #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) \
1142 && defined(AO_HAVE_short_fetch_and_sub1_read)
1143 # define AO_short_fetch_and_sub1_acquire_read(addr) \
1144 AO_short_fetch_and_sub1_read(addr)
1145 # define AO_HAVE_short_fetch_and_sub1_acquire_read
1147 #if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) \
1148 && defined(AO_HAVE_short_fetch_and_sub1_acquire)
1149 # define AO_short_fetch_and_sub1_acquire_read(addr) \
1150 AO_short_fetch_and_sub1_acquire(addr)
1151 # define AO_HAVE_short_fetch_and_sub1_acquire_read
1154 #ifdef AO_NO_DD_ORDERING
1155 # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
1156 # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
1157 AO_short_fetch_and_sub1_acquire_read(addr)
1158 # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
1161 # if defined(AO_HAVE_short_fetch_and_sub1)
1162 # define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
1163 AO_short_fetch_and_sub1(addr)
1164 # define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
1166 #endif /* !AO_NO_DD_ORDERING */
1168 * Copyright (c) 2003-2004 Hewlett-Packard Development Company, L.P.
1170 * Permission is hereby granted, free of charge, to any person obtaining a copy
1171 * of this software and associated documentation files (the "Software"), to deal
1172 * in the Software without restriction, including without limitation the rights
1173 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1174 * copies of the Software, and to permit persons to whom the Software is
1175 * furnished to do so, subject to the following conditions:
1177 * The above copyright notice and this permission notice shall be included in
1178 * all copies or substantial portions of the Software.
1180 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1181 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1182 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1183 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1184 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1185 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1190 #if defined(AO_HAVE_int_load_acquire) && !defined(AO_HAVE_int_load)
1191 # define AO_int_load(addr) AO_int_load_acquire(addr)
1192 # define AO_HAVE_int_load
1195 #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_acquire)
1196 # define AO_int_load_acquire(addr) AO_int_load_full(addr)
1197 # define AO_HAVE_int_load_acquire
1200 #if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_read)
1201 # define AO_int_load_read(addr) AO_int_load_full(addr)
1202 # define AO_HAVE_int_load_read
1205 #if !defined(AO_HAVE_int_load_acquire_read) \
1206 && defined(AO_HAVE_int_load_acquire)
1207 # define AO_int_load_acquire_read(addr) AO_int_load_acquire(addr)
1208 # define AO_HAVE_int_load_acquire_read
1211 #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_full) \
1212 && !defined(AO_HAVE_int_load_acquire)
1213 AO_INLINE unsigned int
1214 AO_int_load_acquire(const volatile unsigned int *addr)
1216 unsigned int result = AO_int_load(addr);
1217 /* Acquire barrier would be useless, since the load could be delayed */
1222 # define AO_HAVE_int_load_acquire
1225 #if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_read) \
1226 && !defined(AO_HAVE_int_load_read)
1227 AO_INLINE unsigned int
1228 AO_int_load_read(const volatile unsigned int *addr)
1230 unsigned int result = AO_int_load(addr);
1231 /* Acquire barrier would be useless, since the load could be delayed */
1236 # define AO_HAVE_int_load_read
1239 #if defined(AO_HAVE_int_load_acquire) && defined(AO_HAVE_nop_full) \
1240 && !defined(AO_HAVE_int_load_full)
1241 # define AO_int_load_full(addr) (AO_nop_full(), AO_int_load_acquire(addr))
1242 # define AO_HAVE_int_load_full
1245 #if !defined(AO_HAVE_int_load_acquire_read) \
1246 && defined(AO_HAVE_int_load_read)
1247 # define AO_int_load_acquire_read(addr) AO_int_load_read(addr)
1248 # define AO_HAVE_int_load_acquire_read
1251 #if defined(AO_HAVE_int_load_acquire_read) && !defined(AO_HAVE_int_load)
1252 # define AO_int_load(addr) AO_int_load_acquire_read(addr)
1253 # define AO_HAVE_int_load
1256 #ifdef AO_NO_DD_ORDERING
1257 # if defined(AO_HAVE_int_load_acquire_read)
1258 # define AO_int_load_dd_acquire_read(addr) AO_int_load_acquire_read(addr)
1259 # define AO_HAVE_int_load_dd_acquire_read
1262 # if defined(AO_HAVE_int_load)
1263 # define AO_int_load_dd_acquire_read(addr) AO_int_load(addr)
1264 # define AO_HAVE_int_load_dd_acquire_read
1266 #endif /* !AO_NO_DD_ORDERING */
1269 #if defined(AO_HAVE_int_store_release) && !defined(AO_HAVE_int_store)
1270 # define AO_int_store(addr, val) AO_int_store_release(addr,val)
1271 # define AO_HAVE_int_store
1274 #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_release)
1275 # define AO_int_store_release(addr,val) AO_int_store_full(addr,val)
1276 # define AO_HAVE_int_store_release
1279 #if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_write)
1280 # define AO_int_store_write(addr,val) AO_int_store_full(addr,val)
1281 # define AO_HAVE_int_store_write
1284 #if defined(AO_HAVE_int_store_release) \
1285 && !defined(AO_HAVE_int_store_release_write)
1286 # define AO_int_store_release_write(addr, val) \
1287 AO_int_store_release(addr,val)
1288 # define AO_HAVE_int_store_release_write
1291 #if defined(AO_HAVE_int_store_write) && !defined(AO_HAVE_int_store)
1292 # define AO_int_store(addr, val) AO_int_store_write(addr,val)
1293 # define AO_HAVE_int_store
1296 #if defined(AO_HAVE_int_store) && defined(AO_HAVE_nop_full) \
1297 && !defined(AO_HAVE_int_store_release)
1298 # define AO_int_store_release(addr,val) \
1299 (AO_nop_full(), AO_int_store(addr,val))
1300 # define AO_HAVE_int_store_release
1303 #if defined(AO_HAVE_nop_write) && defined(AO_HAVE_int_store) \
1304 && !defined(AO_HAVE_int_store_write)
1305 # define AO_int_store_write(addr, val) \
1306 (AO_nop_write(), AO_int_store(addr,val))
1307 # define AO_HAVE_int_store_write
1310 #if defined(AO_HAVE_int_store_write) \
1311 && !defined(AO_HAVE_int_store_release_write)
1312 # define AO_int_store_release_write(addr, val) AO_int_store_write(addr,val)
1313 # define AO_HAVE_int_store_release_write
1316 #if defined(AO_HAVE_int_store_release) && defined(AO_HAVE_nop_full) \
1317 && !defined(AO_HAVE_int_store_full)
1318 # define AO_int_store_full(addr, val) \
1319 (AO_int_store_release(addr, val), AO_nop_full())
1320 # define AO_HAVE_int_store_full
1323 /* int_fetch_and_add */
1324 #if defined(AO_HAVE_int_compare_and_swap_full) \
1325 && !defined(AO_HAVE_int_fetch_and_add_full)
1326 AO_INLINE unsigned int
1327 AO_int_fetch_and_add_full(volatile unsigned int *addr,
1335 while (!AO_int_compare_and_swap_full(addr, old, old+incr));
1338 # define AO_HAVE_int_fetch_and_add_full
1341 #if defined(AO_HAVE_int_compare_and_swap_acquire) \
1342 && !defined(AO_HAVE_int_fetch_and_add_acquire)
1343 AO_INLINE unsigned int
1344 AO_int_fetch_and_add_acquire(volatile unsigned int *addr,
1352 while (!AO_int_compare_and_swap_acquire(addr, old, old+incr));
1355 # define AO_HAVE_int_fetch_and_add_acquire
1358 #if defined(AO_HAVE_int_compare_and_swap_release) \
1359 && !defined(AO_HAVE_int_fetch_and_add_release)
1360 AO_INLINE unsigned int
1361 AO_int_fetch_and_add_release(volatile unsigned int *addr,
1369 while (!AO_int_compare_and_swap_release(addr, old, old+incr));
1372 # define AO_HAVE_int_fetch_and_add_release
1375 #if defined(AO_HAVE_int_fetch_and_add_full)
1376 # if !defined(AO_HAVE_int_fetch_and_add_release)
1377 # define AO_int_fetch_and_add_release(addr, val) \
1378 AO_int_fetch_and_add_full(addr, val)
1379 # define AO_HAVE_int_fetch_and_add_release
1381 # if !defined(AO_HAVE_int_fetch_and_add_acquire)
1382 # define AO_int_fetch_and_add_acquire(addr, val) \
1383 AO_int_fetch_and_add_full(addr, val)
1384 # define AO_HAVE_int_fetch_and_add_acquire
1386 # if !defined(AO_HAVE_int_fetch_and_add_write)
1387 # define AO_int_fetch_and_add_write(addr, val) \
1388 AO_int_fetch_and_add_full(addr, val)
1389 # define AO_HAVE_int_fetch_and_add_write
1391 # if !defined(AO_HAVE_int_fetch_and_add_read)
1392 # define AO_int_fetch_and_add_read(addr, val) \
1393 AO_int_fetch_and_add_full(addr, val)
1394 # define AO_HAVE_int_fetch_and_add_read
1396 #endif /* AO_HAVE_int_fetch_and_add_full */
1398 #if !defined(AO_HAVE_int_fetch_and_add) \
1399 && defined(AO_HAVE_int_fetch_and_add_release)
1400 # define AO_int_fetch_and_add(addr, val) \
1401 AO_int_fetch_and_add_release(addr, val)
1402 # define AO_HAVE_int_fetch_and_add
1404 #if !defined(AO_HAVE_int_fetch_and_add) \
1405 && defined(AO_HAVE_int_fetch_and_add_acquire)
1406 # define AO_int_fetch_and_add(addr, val) \
1407 AO_int_fetch_and_add_acquire(addr, val)
1408 # define AO_HAVE_int_fetch_and_add
1410 #if !defined(AO_HAVE_int_fetch_and_add) \
1411 && defined(AO_HAVE_int_fetch_and_add_write)
1412 # define AO_int_fetch_and_add(addr, val) \
1413 AO_int_fetch_and_add_write(addr, val)
1414 # define AO_HAVE_int_fetch_and_add
1416 #if !defined(AO_HAVE_int_fetch_and_add) \
1417 && defined(AO_HAVE_int_fetch_and_add_read)
1418 # define AO_int_fetch_and_add(addr, val) \
1419 AO_int_fetch_and_add_read(addr, val)
1420 # define AO_HAVE_int_fetch_and_add
1423 #if defined(AO_HAVE_int_fetch_and_add_acquire) \
1424 && defined(AO_HAVE_nop_full) && !defined(AO_HAVE_int_fetch_and_add_full)
1425 # define AO_int_fetch_and_add_full(addr, val) \
1426 (AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val))
1427 # define AO_HAVE_int_fetch_and_add_full
1430 #if !defined(AO_HAVE_int_fetch_and_add_release_write) \
1431 && defined(AO_HAVE_int_fetch_and_add_write)
1432 # define AO_int_fetch_and_add_release_write(addr, val) \
1433 AO_int_fetch_and_add_write(addr, val)
1434 # define AO_HAVE_int_fetch_and_add_release_write
1436 #if !defined(AO_HAVE_int_fetch_and_add_release_write) \
1437 && defined(AO_HAVE_int_fetch_and_add_release)
1438 # define AO_int_fetch_and_add_release_write(addr, val) \
1439 AO_int_fetch_and_add_release(addr, val)
1440 # define AO_HAVE_int_fetch_and_add_release_write
1443 #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) \
1444 && defined(AO_HAVE_int_fetch_and_add_read)
1445 # define AO_int_fetch_and_add_acquire_read(addr, val) \
1446 AO_int_fetch_and_add_read(addr, val)
1447 # define AO_HAVE_int_fetch_and_add_acquire_read
1449 #if !defined(AO_HAVE_int_fetch_and_add_acquire_read) \
1450 && defined(AO_HAVE_int_fetch_and_add_acquire)
1451 # define AO_int_fetch_and_add_acquire_read(addr, val) \
1452 AO_int_fetch_and_add_acquire(addr, val)
1453 # define AO_HAVE_int_fetch_and_add_acquire_read
1456 #ifdef AO_NO_DD_ORDERING
1457 # if defined(AO_HAVE_int_fetch_and_add_acquire_read)
1458 # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
1459 AO_int_fetch_and_add_acquire_read(addr, val)
1460 # define AO_HAVE_int_fetch_and_add_dd_acquire_read
1463 # if defined(AO_HAVE_int_fetch_and_add)
1464 # define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
1465 AO_int_fetch_and_add(addr, val)
1466 # define AO_HAVE_int_fetch_and_add_dd_acquire_read
1468 #endif /* !AO_NO_DD_ORDERING */
1470 /* int_fetch_and_add1 */
1471 #if defined(AO_HAVE_int_fetch_and_add_full) \
1472 && !defined(AO_HAVE_int_fetch_and_add1_full)
1473 # define AO_int_fetch_and_add1_full(addr) \
1474 AO_int_fetch_and_add_full(addr,1)
1475 # define AO_HAVE_int_fetch_and_add1_full
1477 #if defined(AO_HAVE_int_fetch_and_add_release) \
1478 && !defined(AO_HAVE_int_fetch_and_add1_release)
1479 # define AO_int_fetch_and_add1_release(addr) \
1480 AO_int_fetch_and_add_release(addr,1)
1481 # define AO_HAVE_int_fetch_and_add1_release
1483 #if defined(AO_HAVE_int_fetch_and_add_acquire) \
1484 && !defined(AO_HAVE_int_fetch_and_add1_acquire)
1485 # define AO_int_fetch_and_add1_acquire(addr) \
1486 AO_int_fetch_and_add_acquire(addr,1)
1487 # define AO_HAVE_int_fetch_and_add1_acquire
1489 #if defined(AO_HAVE_int_fetch_and_add_write) \
1490 && !defined(AO_HAVE_int_fetch_and_add1_write)
1491 # define AO_int_fetch_and_add1_write(addr) \
1492 AO_int_fetch_and_add_write(addr,1)
1493 # define AO_HAVE_int_fetch_and_add1_write
1495 #if defined(AO_HAVE_int_fetch_and_add_read) \
1496 && !defined(AO_HAVE_int_fetch_and_add1_read)
1497 # define AO_int_fetch_and_add1_read(addr) \
1498 AO_int_fetch_and_add_read(addr,1)
1499 # define AO_HAVE_int_fetch_and_add1_read
1501 #if defined(AO_HAVE_int_fetch_and_add_release_write) \
1502 && !defined(AO_HAVE_int_fetch_and_add1_release_write)
1503 # define AO_int_fetch_and_add1_release_write(addr) \
1504 AO_int_fetch_and_add_release_write(addr,1)
1505 # define AO_HAVE_int_fetch_and_add1_release_write
1507 #if defined(AO_HAVE_int_fetch_and_add_acquire_read) \
1508 && !defined(AO_HAVE_int_fetch_and_add1_acquire_read)
1509 # define AO_int_fetch_and_add1_acquire_read(addr) \
1510 AO_int_fetch_and_add_acquire_read(addr,1)
1511 # define AO_HAVE_int_fetch_and_add1_acquire_read
1513 #if defined(AO_HAVE_int_fetch_and_add) \
1514 && !defined(AO_HAVE_int_fetch_and_add1)
1515 # define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add(addr,1)
1516 # define AO_HAVE_int_fetch_and_add1
1519 #if defined(AO_HAVE_int_fetch_and_add1_full)
1520 # if !defined(AO_HAVE_int_fetch_and_add1_release)
1521 # define AO_int_fetch_and_add1_release(addr) \
1522 AO_int_fetch_and_add1_full(addr)
1523 # define AO_HAVE_int_fetch_and_add1_release
1525 # if !defined(AO_HAVE_int_fetch_and_add1_acquire)
1526 # define AO_int_fetch_and_add1_acquire(addr) \
1527 AO_int_fetch_and_add1_full(addr)
1528 # define AO_HAVE_int_fetch_and_add1_acquire
1530 # if !defined(AO_HAVE_int_fetch_and_add1_write)
1531 # define AO_int_fetch_and_add1_write(addr) \
1532 AO_int_fetch_and_add1_full(addr)
1533 # define AO_HAVE_int_fetch_and_add1_write
1535 # if !defined(AO_HAVE_int_fetch_and_add1_read)
1536 # define AO_int_fetch_and_add1_read(addr) \
1537 AO_int_fetch_and_add1_full(addr)
1538 # define AO_HAVE_int_fetch_and_add1_read
1540 #endif /* AO_HAVE_int_fetch_and_add1_full */
1542 #if !defined(AO_HAVE_int_fetch_and_add1) \
1543 && defined(AO_HAVE_int_fetch_and_add1_release)
1544 # define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_release(addr)
1545 # define AO_HAVE_int_fetch_and_add1
1547 #if !defined(AO_HAVE_int_fetch_and_add1) \
1548 && defined(AO_HAVE_int_fetch_and_add1_acquire)
1549 # define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_acquire(addr)
1550 # define AO_HAVE_int_fetch_and_add1
1552 #if !defined(AO_HAVE_int_fetch_and_add1) \
1553 && defined(AO_HAVE_int_fetch_and_add1_write)
1554 # define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_write(addr)
1555 # define AO_HAVE_int_fetch_and_add1
1557 #if !defined(AO_HAVE_int_fetch_and_add1) \
1558 && defined(AO_HAVE_int_fetch_and_add1_read)
1559 # define AO_int_fetch_and_add1(addr) AO_int_fetch_and_add1_read(addr)
1560 # define AO_HAVE_int_fetch_and_add1
1563 #if defined(AO_HAVE_int_fetch_and_add1_acquire) \
1564 && defined(AO_HAVE_nop_full) \
1565 && !defined(AO_HAVE_int_fetch_and_add1_full)
1566 # define AO_int_fetch_and_add1_full(addr) \
1567 (AO_nop_full(), AO_int_fetch_and_add1_acquire(addr))
1568 # define AO_HAVE_int_fetch_and_add1_full
1571 #if !defined(AO_HAVE_int_fetch_and_add1_release_write) \
1572 && defined(AO_HAVE_int_fetch_and_add1_write)
1573 # define AO_int_fetch_and_add1_release_write(addr) \
1574 AO_int_fetch_and_add1_write(addr)
1575 # define AO_HAVE_int_fetch_and_add1_release_write
1577 #if !defined(AO_HAVE_int_fetch_and_add1_release_write) \
1578 && defined(AO_HAVE_int_fetch_and_add1_release)
1579 # define AO_int_fetch_and_add1_release_write(addr) \
1580 AO_int_fetch_and_add1_release(addr)
1581 # define AO_HAVE_int_fetch_and_add1_release_write
1583 #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) \
1584 && defined(AO_HAVE_int_fetch_and_add1_read)
1585 # define AO_int_fetch_and_add1_acquire_read(addr) \
1586 AO_int_fetch_and_add1_read(addr)
1587 # define AO_HAVE_int_fetch_and_add1_acquire_read
1589 #if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) \
1590 && defined(AO_HAVE_int_fetch_and_add1_acquire)
1591 # define AO_int_fetch_and_add1_acquire_read(addr) \
1592 AO_int_fetch_and_add1_acquire(addr)
1593 # define AO_HAVE_int_fetch_and_add1_acquire_read
1596 #ifdef AO_NO_DD_ORDERING
1597 # if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
1598 # define AO_int_fetch_and_add1_dd_acquire_read(addr) \
1599 AO_int_fetch_and_add1_acquire_read(addr)
1600 # define AO_HAVE_int_fetch_and_add1_dd_acquire_read
1603 # if defined(AO_HAVE_int_fetch_and_add1)
1604 # define AO_int_fetch_and_add1_dd_acquire_read(addr) \
1605 AO_int_fetch_and_add1(addr)
1606 # define AO_HAVE_int_fetch_and_add1_dd_acquire_read
1608 #endif /* !AO_NO_DD_ORDERING */
1610 /* int_fetch_and_sub1 */
1611 #if defined(AO_HAVE_int_fetch_and_add_full) \
1612 && !defined(AO_HAVE_int_fetch_and_sub1_full)
1613 # define AO_int_fetch_and_sub1_full(addr) \
1614 AO_int_fetch_and_add_full(addr,(unsigned int)(-1))
1615 # define AO_HAVE_int_fetch_and_sub1_full
1617 #if defined(AO_HAVE_int_fetch_and_add_release) \
1618 && !defined(AO_HAVE_int_fetch_and_sub1_release)
1619 # define AO_int_fetch_and_sub1_release(addr) \
1620 AO_int_fetch_and_add_release(addr,(unsigned int)(-1))
1621 # define AO_HAVE_int_fetch_and_sub1_release
1623 #if defined(AO_HAVE_int_fetch_and_add_acquire) \
1624 && !defined(AO_HAVE_int_fetch_and_sub1_acquire)
1625 # define AO_int_fetch_and_sub1_acquire(addr) \
1626 AO_int_fetch_and_add_acquire(addr,(unsigned int)(-1))
1627 # define AO_HAVE_int_fetch_and_sub1_acquire
1629 #if defined(AO_HAVE_int_fetch_and_add_write) \
1630 && !defined(AO_HAVE_int_fetch_and_sub1_write)
1631 # define AO_int_fetch_and_sub1_write(addr) \
1632 AO_int_fetch_and_add_write(addr,(unsigned int)(-1))
1633 # define AO_HAVE_int_fetch_and_sub1_write
1635 #if defined(AO_HAVE_int_fetch_and_add_read) \
1636 && !defined(AO_HAVE_int_fetch_and_sub1_read)
1637 # define AO_int_fetch_and_sub1_read(addr) \
1638 AO_int_fetch_and_add_read(addr,(unsigned int)(-1))
1639 # define AO_HAVE_int_fetch_and_sub1_read
1641 #if defined(AO_HAVE_int_fetch_and_add_release_write) \
1642 && !defined(AO_HAVE_int_fetch_and_sub1_release_write)
1643 # define AO_int_fetch_and_sub1_release_write(addr) \
1644 AO_int_fetch_and_add_release_write(addr,(unsigned int)(-1))
1645 # define AO_HAVE_int_fetch_and_sub1_release_write
1647 #if defined(AO_HAVE_int_fetch_and_add_acquire_read) \
1648 && !defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
1649 # define AO_int_fetch_and_sub1_acquire_read(addr) \
1650 AO_int_fetch_and_add_acquire_read(addr,(unsigned int)(-1))
1651 # define AO_HAVE_int_fetch_and_sub1_acquire_read
1653 #if defined(AO_HAVE_int_fetch_and_add) \
1654 && !defined(AO_HAVE_int_fetch_and_sub1)
1655 # define AO_int_fetch_and_sub1(addr) \
1656 AO_int_fetch_and_add(addr,(unsigned int)(-1))
1657 # define AO_HAVE_int_fetch_and_sub1
1660 #if defined(AO_HAVE_int_fetch_and_sub1_full)
1661 # if !defined(AO_HAVE_int_fetch_and_sub1_release)
1662 # define AO_int_fetch_and_sub1_release(addr) \
1663 AO_int_fetch_and_sub1_full(addr)
1664 # define AO_HAVE_int_fetch_and_sub1_release
1666 # if !defined(AO_HAVE_int_fetch_and_sub1_acquire)
1667 # define AO_int_fetch_and_sub1_acquire(addr) \
1668 AO_int_fetch_and_sub1_full(addr)
1669 # define AO_HAVE_int_fetch_and_sub1_acquire
1671 # if !defined(AO_HAVE_int_fetch_and_sub1_write)
1672 # define AO_int_fetch_and_sub1_write(addr) \
1673 AO_int_fetch_and_sub1_full(addr)
1674 # define AO_HAVE_int_fetch_and_sub1_write
1676 # if !defined(AO_HAVE_int_fetch_and_sub1_read)
1677 # define AO_int_fetch_and_sub1_read(addr) \
1678 AO_int_fetch_and_sub1_full(addr)
1679 # define AO_HAVE_int_fetch_and_sub1_read
1681 #endif /* AO_HAVE_int_fetch_and_sub1_full */
1683 #if !defined(AO_HAVE_int_fetch_and_sub1) \
1684 && defined(AO_HAVE_int_fetch_and_sub1_release)
1685 # define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_release(addr)
1686 # define AO_HAVE_int_fetch_and_sub1
1688 #if !defined(AO_HAVE_int_fetch_and_sub1) \
1689 && defined(AO_HAVE_int_fetch_and_sub1_acquire)
1690 # define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_acquire(addr)
1691 # define AO_HAVE_int_fetch_and_sub1
1693 #if !defined(AO_HAVE_int_fetch_and_sub1) \
1694 && defined(AO_HAVE_int_fetch_and_sub1_write)
1695 # define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_write(addr)
1696 # define AO_HAVE_int_fetch_and_sub1
1698 #if !defined(AO_HAVE_int_fetch_and_sub1) \
1699 && defined(AO_HAVE_int_fetch_and_sub1_read)
1700 # define AO_int_fetch_and_sub1(addr) AO_int_fetch_and_sub1_read(addr)
1701 # define AO_HAVE_int_fetch_and_sub1
1704 #if defined(AO_HAVE_int_fetch_and_sub1_acquire) \
1705 && defined(AO_HAVE_nop_full) \
1706 && !defined(AO_HAVE_int_fetch_and_sub1_full)
1707 # define AO_int_fetch_and_sub1_full(addr) \
1708 (AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr))
1709 # define AO_HAVE_int_fetch_and_sub1_full
1712 #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) \
1713 && defined(AO_HAVE_int_fetch_and_sub1_write)
1714 # define AO_int_fetch_and_sub1_release_write(addr) \
1715 AO_int_fetch_and_sub1_write(addr)
1716 # define AO_HAVE_int_fetch_and_sub1_release_write
1718 #if !defined(AO_HAVE_int_fetch_and_sub1_release_write) \
1719 && defined(AO_HAVE_int_fetch_and_sub1_release)
1720 # define AO_int_fetch_and_sub1_release_write(addr) \
1721 AO_int_fetch_and_sub1_release(addr)
1722 # define AO_HAVE_int_fetch_and_sub1_release_write
1724 #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) \
1725 && defined(AO_HAVE_int_fetch_and_sub1_read)
1726 # define AO_int_fetch_and_sub1_acquire_read(addr) \
1727 AO_int_fetch_and_sub1_read(addr)
1728 # define AO_HAVE_int_fetch_and_sub1_acquire_read
1730 #if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) \
1731 && defined(AO_HAVE_int_fetch_and_sub1_acquire)
1732 # define AO_int_fetch_and_sub1_acquire_read(addr) \
1733 AO_int_fetch_and_sub1_acquire(addr)
1734 # define AO_HAVE_int_fetch_and_sub1_acquire_read
1737 #ifdef AO_NO_DD_ORDERING
1738 # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
1739 # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
1740 AO_int_fetch_and_sub1_acquire_read(addr)
1741 # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
1744 # if defined(AO_HAVE_int_fetch_and_sub1)
1745 # define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
1746 AO_int_fetch_and_sub1(addr)
1747 # define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
1749 #endif /* !AO_NO_DD_ORDERING */