2 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
4 * This file is covered by the GNU general public license, version 2.
5 * see doc/COPYING for details.
8 /* Some basic sanity tests. These do not test the barrier semantics. */
11 #define TA_assert(e) \
12 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \
13 __FILE__, __LINE__), exit(1); }
16 #define MISSING(name) \
17 fprintf(stderr, "Missing: %s\n", #name "")
19 void test_atomic(void)
25 # if defined(AO_HAVE_test_and_set)
26 AO_TS_t z = AO_TS_INITIALIZER;
28 # if defined(AO_HAVE_double_t)
34 # if defined(AO_HAVE_nop)
39 # if defined(AO_HAVE_store)
46 # if defined(AO_HAVE_load)
47 TA_assert(AO_load(&x) == 13);
51 # if defined(AO_HAVE_test_and_set)
52 assert(AO_test_and_set(&z) == AO_TS_CLEAR);
53 assert(AO_test_and_set(&z) == AO_TS_SET);
54 assert(AO_test_and_set(&z) == AO_TS_SET);
57 MISSING(AO_test_and_set);
59 # if defined(AO_HAVE_fetch_and_add)
60 TA_assert(AO_fetch_and_add(&x, 42) == 13);
61 TA_assert(AO_fetch_and_add(&x, -42) == 55);
63 MISSING(AO_fetch_and_add);
65 # if defined(AO_HAVE_fetch_and_add1)
66 TA_assert(AO_fetch_and_add1(&x) == 13);
68 MISSING(AO_fetch_and_add1);
71 # if defined(AO_HAVE_fetch_and_sub1)
72 TA_assert(AO_fetch_and_sub1(&x) == 14);
74 MISSING(AO_fetch_and_sub1);
77 # if defined(AO_HAVE_short_store)
78 AO_short_store(&s, 13);
80 MISSING(AO_short_store);
83 # if defined(AO_HAVE_short_load)
84 TA_assert(AO_short_load(&s) == 13);
86 MISSING(AO_short_load);
88 # if defined(AO_HAVE_short_fetch_and_add)
89 TA_assert(AO_short_fetch_and_add(&s, 42) == 13);
90 TA_assert(AO_short_fetch_and_add(&s, -42) == 55);
92 MISSING(AO_short_fetch_and_add);
94 # if defined(AO_HAVE_short_fetch_and_add1)
95 TA_assert(AO_short_fetch_and_add1(&s) == 13);
97 MISSING(AO_short_fetch_and_add1);
100 # if defined(AO_HAVE_short_fetch_and_sub1)
101 TA_assert(AO_short_fetch_and_sub1(&s) == 14);
103 MISSING(AO_short_fetch_and_sub1);
106 # if defined(AO_HAVE_char_store)
107 AO_char_store(&b, 13);
109 MISSING(AO_char_store);
112 # if defined(AO_HAVE_char_load)
113 TA_assert(AO_char_load(&b) == 13);
115 MISSING(AO_char_load);
117 # if defined(AO_HAVE_char_fetch_and_add)
118 TA_assert(AO_char_fetch_and_add(&b, 42) == 13);
119 TA_assert(AO_char_fetch_and_add(&b, -42) == 55);
121 MISSING(AO_char_fetch_and_add);
123 # if defined(AO_HAVE_char_fetch_and_add1)
124 TA_assert(AO_char_fetch_and_add1(&b) == 13);
126 MISSING(AO_char_fetch_and_add1);
129 # if defined(AO_HAVE_char_fetch_and_sub1)
130 TA_assert(AO_char_fetch_and_sub1(&b) == 14);
132 MISSING(AO_char_fetch_and_sub1);
135 # if defined(AO_HAVE_int_store)
136 AO_int_store(&zz, 13);
138 MISSING(AO_int_store);
141 # if defined(AO_HAVE_int_load)
142 TA_assert(AO_int_load(&zz) == 13);
144 MISSING(AO_int_load);
146 # if defined(AO_HAVE_int_fetch_and_add)
147 TA_assert(AO_int_fetch_and_add(&zz, 42) == 13);
148 TA_assert(AO_int_fetch_and_add(&zz, -42) == 55);
150 MISSING(AO_int_fetch_and_add);
152 # if defined(AO_HAVE_int_fetch_and_add1)
153 TA_assert(AO_int_fetch_and_add1(&zz) == 13);
155 MISSING(AO_int_fetch_and_add1);
158 # if defined(AO_HAVE_int_fetch_and_sub1)
159 TA_assert(AO_int_fetch_and_sub1(&zz) == 14);
161 MISSING(AO_int_fetch_and_sub1);
164 # if defined(AO_HAVE_compare_and_swap)
165 TA_assert(!AO_compare_and_swap(&x, 14, 42));
167 TA_assert(AO_compare_and_swap(&x, 13, 42));
170 MISSING(AO_compare_and_swap);
172 # if defined(AO_HAVE_or)
179 # if defined(AO_HAVE_compare_double_and_swap_double)
180 TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13));
181 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
182 TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13));
183 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
184 TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42));
185 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
186 w.AO_val1 = 0; w.AO_val2 = 0;
188 MISSING(AO_compare_double_and_swap_double);
190 # if defined(AO_HAVE_compare_and_swap_double)
191 TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13));
192 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
193 TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13));
194 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
195 TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42));
196 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
198 MISSING(AO_compare_and_swap_double);
205 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
207 * This file is covered by the GNU general public license, version 2.
208 * see doc/COPYING for details.
211 /* Some basic sanity tests. These do not test the barrier semantics. */
214 #define TA_assert(e) \
215 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \
216 __FILE__, __LINE__), exit(1); }
219 #define MISSING(name) \
220 fprintf(stderr, "Missing: %s\n", #name "_release")
222 void test_atomic_release(void)
228 # if defined(AO_HAVE_test_and_set_release)
229 AO_TS_t z = AO_TS_INITIALIZER;
231 # if defined(AO_HAVE_double_t)
237 # if defined(AO_HAVE_nop_release)
242 # if defined(AO_HAVE_store_release)
243 AO_store_release(&x, 13);
249 # if defined(AO_HAVE_load_release)
250 TA_assert(AO_load_release(&x) == 13);
254 # if defined(AO_HAVE_test_and_set_release)
255 assert(AO_test_and_set_release(&z) == AO_TS_CLEAR);
256 assert(AO_test_and_set_release(&z) == AO_TS_SET);
257 assert(AO_test_and_set_release(&z) == AO_TS_SET);
260 MISSING(AO_test_and_set);
262 # if defined(AO_HAVE_fetch_and_add_release)
263 TA_assert(AO_fetch_and_add_release(&x, 42) == 13);
264 TA_assert(AO_fetch_and_add_release(&x, -42) == 55);
266 MISSING(AO_fetch_and_add);
268 # if defined(AO_HAVE_fetch_and_add1_release)
269 TA_assert(AO_fetch_and_add1_release(&x) == 13);
271 MISSING(AO_fetch_and_add1);
274 # if defined(AO_HAVE_fetch_and_sub1_release)
275 TA_assert(AO_fetch_and_sub1_release(&x) == 14);
277 MISSING(AO_fetch_and_sub1);
280 # if defined(AO_HAVE_short_store_release)
281 AO_short_store_release(&s, 13);
283 MISSING(AO_short_store);
286 # if defined(AO_HAVE_short_load_release)
287 TA_assert(AO_short_load(&s) == 13);
289 MISSING(AO_short_load);
291 # if defined(AO_HAVE_short_fetch_and_add_release)
292 TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13);
293 TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55);
295 MISSING(AO_short_fetch_and_add);
297 # if defined(AO_HAVE_short_fetch_and_add1_release)
298 TA_assert(AO_short_fetch_and_add1_release(&s) == 13);
300 MISSING(AO_short_fetch_and_add1);
303 # if defined(AO_HAVE_short_fetch_and_sub1_release)
304 TA_assert(AO_short_fetch_and_sub1_release(&s) == 14);
306 MISSING(AO_short_fetch_and_sub1);
309 # if defined(AO_HAVE_char_store_release)
310 AO_char_store_release(&b, 13);
312 MISSING(AO_char_store);
315 # if defined(AO_HAVE_char_load_release)
316 TA_assert(AO_char_load(&b) == 13);
318 MISSING(AO_char_load);
320 # if defined(AO_HAVE_char_fetch_and_add_release)
321 TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13);
322 TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55);
324 MISSING(AO_char_fetch_and_add);
326 # if defined(AO_HAVE_char_fetch_and_add1_release)
327 TA_assert(AO_char_fetch_and_add1_release(&b) == 13);
329 MISSING(AO_char_fetch_and_add1);
332 # if defined(AO_HAVE_char_fetch_and_sub1_release)
333 TA_assert(AO_char_fetch_and_sub1_release(&b) == 14);
335 MISSING(AO_char_fetch_and_sub1);
338 # if defined(AO_HAVE_int_store_release)
339 AO_int_store_release(&zz, 13);
341 MISSING(AO_int_store);
344 # if defined(AO_HAVE_int_load_release)
345 TA_assert(AO_int_load(&zz) == 13);
347 MISSING(AO_int_load);
349 # if defined(AO_HAVE_int_fetch_and_add_release)
350 TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13);
351 TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55);
353 MISSING(AO_int_fetch_and_add);
355 # if defined(AO_HAVE_int_fetch_and_add1_release)
356 TA_assert(AO_int_fetch_and_add1_release(&zz) == 13);
358 MISSING(AO_int_fetch_and_add1);
361 # if defined(AO_HAVE_int_fetch_and_sub1_release)
362 TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14);
364 MISSING(AO_int_fetch_and_sub1);
367 # if defined(AO_HAVE_compare_and_swap_release)
368 TA_assert(!AO_compare_and_swap_release(&x, 14, 42));
370 TA_assert(AO_compare_and_swap_release(&x, 13, 42));
373 MISSING(AO_compare_and_swap);
375 # if defined(AO_HAVE_or_release)
376 AO_or_release(&x, 66);
382 # if defined(AO_HAVE_compare_double_and_swap_double_release)
383 TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13));
384 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
385 TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13));
386 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
387 TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42));
388 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
389 w.AO_val1 = 0; w.AO_val2 = 0;
391 MISSING(AO_compare_double_and_swap_double);
393 # if defined(AO_HAVE_compare_and_swap_double_release)
394 TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13));
395 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
396 TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13));
397 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
398 TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42));
399 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
401 MISSING(AO_compare_and_swap_double);
408 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
410 * This file is covered by the GNU general public license, version 2.
411 * see doc/COPYING for details.
414 /* Some basic sanity tests. These do not test the barrier semantics. */
417 #define TA_assert(e) \
418 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \
419 __FILE__, __LINE__), exit(1); }
422 #define MISSING(name) \
423 fprintf(stderr, "Missing: %s\n", #name "_acquire")
425 void test_atomic_acquire(void)
431 # if defined(AO_HAVE_test_and_set_acquire)
432 AO_TS_t z = AO_TS_INITIALIZER;
434 # if defined(AO_HAVE_double_t)
440 # if defined(AO_HAVE_nop_acquire)
445 # if defined(AO_HAVE_store_acquire)
446 AO_store_acquire(&x, 13);
452 # if defined(AO_HAVE_load_acquire)
453 TA_assert(AO_load_acquire(&x) == 13);
457 # if defined(AO_HAVE_test_and_set_acquire)
458 assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR);
459 assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
460 assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
463 MISSING(AO_test_and_set);
465 # if defined(AO_HAVE_fetch_and_add_acquire)
466 TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13);
467 TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55);
469 MISSING(AO_fetch_and_add);
471 # if defined(AO_HAVE_fetch_and_add1_acquire)
472 TA_assert(AO_fetch_and_add1_acquire(&x) == 13);
474 MISSING(AO_fetch_and_add1);
477 # if defined(AO_HAVE_fetch_and_sub1_acquire)
478 TA_assert(AO_fetch_and_sub1_acquire(&x) == 14);
480 MISSING(AO_fetch_and_sub1);
483 # if defined(AO_HAVE_short_store_acquire)
484 AO_short_store_acquire(&s, 13);
486 MISSING(AO_short_store);
489 # if defined(AO_HAVE_short_load_acquire)
490 TA_assert(AO_short_load(&s) == 13);
492 MISSING(AO_short_load);
494 # if defined(AO_HAVE_short_fetch_and_add_acquire)
495 TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13);
496 TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55);
498 MISSING(AO_short_fetch_and_add);
500 # if defined(AO_HAVE_short_fetch_and_add1_acquire)
501 TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13);
503 MISSING(AO_short_fetch_and_add1);
506 # if defined(AO_HAVE_short_fetch_and_sub1_acquire)
507 TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14);
509 MISSING(AO_short_fetch_and_sub1);
512 # if defined(AO_HAVE_char_store_acquire)
513 AO_char_store_acquire(&b, 13);
515 MISSING(AO_char_store);
518 # if defined(AO_HAVE_char_load_acquire)
519 TA_assert(AO_char_load(&b) == 13);
521 MISSING(AO_char_load);
523 # if defined(AO_HAVE_char_fetch_and_add_acquire)
524 TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13);
525 TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55);
527 MISSING(AO_char_fetch_and_add);
529 # if defined(AO_HAVE_char_fetch_and_add1_acquire)
530 TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13);
532 MISSING(AO_char_fetch_and_add1);
535 # if defined(AO_HAVE_char_fetch_and_sub1_acquire)
536 TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14);
538 MISSING(AO_char_fetch_and_sub1);
541 # if defined(AO_HAVE_int_store_acquire)
542 AO_int_store_acquire(&zz, 13);
544 MISSING(AO_int_store);
547 # if defined(AO_HAVE_int_load_acquire)
548 TA_assert(AO_int_load(&zz) == 13);
550 MISSING(AO_int_load);
552 # if defined(AO_HAVE_int_fetch_and_add_acquire)
553 TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13);
554 TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55);
556 MISSING(AO_int_fetch_and_add);
558 # if defined(AO_HAVE_int_fetch_and_add1_acquire)
559 TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13);
561 MISSING(AO_int_fetch_and_add1);
564 # if defined(AO_HAVE_int_fetch_and_sub1_acquire)
565 TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14);
567 MISSING(AO_int_fetch_and_sub1);
570 # if defined(AO_HAVE_compare_and_swap_acquire)
571 TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42));
573 TA_assert(AO_compare_and_swap_acquire(&x, 13, 42));
576 MISSING(AO_compare_and_swap);
578 # if defined(AO_HAVE_or_acquire)
579 AO_or_acquire(&x, 66);
585 # if defined(AO_HAVE_compare_double_and_swap_double_acquire)
586 TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13));
587 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
588 TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13));
589 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
590 TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42));
591 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
592 w.AO_val1 = 0; w.AO_val2 = 0;
594 MISSING(AO_compare_double_and_swap_double);
596 # if defined(AO_HAVE_compare_and_swap_double_acquire)
597 TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13));
598 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
599 TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13));
600 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
601 TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42));
602 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
604 MISSING(AO_compare_and_swap_double);
611 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
613 * This file is covered by the GNU general public license, version 2.
614 * see doc/COPYING for details.
617 /* Some basic sanity tests. These do not test the barrier semantics. */
620 #define TA_assert(e) \
621 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \
622 __FILE__, __LINE__), exit(1); }
625 #define MISSING(name) \
626 fprintf(stderr, "Missing: %s\n", #name "_read")
628 void test_atomic_read(void)
634 # if defined(AO_HAVE_test_and_set_read)
635 AO_TS_t z = AO_TS_INITIALIZER;
637 # if defined(AO_HAVE_double_t)
643 # if defined(AO_HAVE_nop_read)
648 # if defined(AO_HAVE_store_read)
649 AO_store_read(&x, 13);
655 # if defined(AO_HAVE_load_read)
656 TA_assert(AO_load_read(&x) == 13);
660 # if defined(AO_HAVE_test_and_set_read)
661 assert(AO_test_and_set_read(&z) == AO_TS_CLEAR);
662 assert(AO_test_and_set_read(&z) == AO_TS_SET);
663 assert(AO_test_and_set_read(&z) == AO_TS_SET);
666 MISSING(AO_test_and_set);
668 # if defined(AO_HAVE_fetch_and_add_read)
669 TA_assert(AO_fetch_and_add_read(&x, 42) == 13);
670 TA_assert(AO_fetch_and_add_read(&x, -42) == 55);
672 MISSING(AO_fetch_and_add);
674 # if defined(AO_HAVE_fetch_and_add1_read)
675 TA_assert(AO_fetch_and_add1_read(&x) == 13);
677 MISSING(AO_fetch_and_add1);
680 # if defined(AO_HAVE_fetch_and_sub1_read)
681 TA_assert(AO_fetch_and_sub1_read(&x) == 14);
683 MISSING(AO_fetch_and_sub1);
686 # if defined(AO_HAVE_short_store_read)
687 AO_short_store_read(&s, 13);
689 MISSING(AO_short_store);
692 # if defined(AO_HAVE_short_load_read)
693 TA_assert(AO_short_load(&s) == 13);
695 MISSING(AO_short_load);
697 # if defined(AO_HAVE_short_fetch_and_add_read)
698 TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13);
699 TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55);
701 MISSING(AO_short_fetch_and_add);
703 # if defined(AO_HAVE_short_fetch_and_add1_read)
704 TA_assert(AO_short_fetch_and_add1_read(&s) == 13);
706 MISSING(AO_short_fetch_and_add1);
709 # if defined(AO_HAVE_short_fetch_and_sub1_read)
710 TA_assert(AO_short_fetch_and_sub1_read(&s) == 14);
712 MISSING(AO_short_fetch_and_sub1);
715 # if defined(AO_HAVE_char_store_read)
716 AO_char_store_read(&b, 13);
718 MISSING(AO_char_store);
721 # if defined(AO_HAVE_char_load_read)
722 TA_assert(AO_char_load(&b) == 13);
724 MISSING(AO_char_load);
726 # if defined(AO_HAVE_char_fetch_and_add_read)
727 TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13);
728 TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55);
730 MISSING(AO_char_fetch_and_add);
732 # if defined(AO_HAVE_char_fetch_and_add1_read)
733 TA_assert(AO_char_fetch_and_add1_read(&b) == 13);
735 MISSING(AO_char_fetch_and_add1);
738 # if defined(AO_HAVE_char_fetch_and_sub1_read)
739 TA_assert(AO_char_fetch_and_sub1_read(&b) == 14);
741 MISSING(AO_char_fetch_and_sub1);
744 # if defined(AO_HAVE_int_store_read)
745 AO_int_store_read(&zz, 13);
747 MISSING(AO_int_store);
750 # if defined(AO_HAVE_int_load_read)
751 TA_assert(AO_int_load(&zz) == 13);
753 MISSING(AO_int_load);
755 # if defined(AO_HAVE_int_fetch_and_add_read)
756 TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13);
757 TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55);
759 MISSING(AO_int_fetch_and_add);
761 # if defined(AO_HAVE_int_fetch_and_add1_read)
762 TA_assert(AO_int_fetch_and_add1_read(&zz) == 13);
764 MISSING(AO_int_fetch_and_add1);
767 # if defined(AO_HAVE_int_fetch_and_sub1_read)
768 TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14);
770 MISSING(AO_int_fetch_and_sub1);
773 # if defined(AO_HAVE_compare_and_swap_read)
774 TA_assert(!AO_compare_and_swap_read(&x, 14, 42));
776 TA_assert(AO_compare_and_swap_read(&x, 13, 42));
779 MISSING(AO_compare_and_swap);
781 # if defined(AO_HAVE_or_read)
788 # if defined(AO_HAVE_compare_double_and_swap_double_read)
789 TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13));
790 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
791 TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13));
792 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
793 TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42));
794 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
795 w.AO_val1 = 0; w.AO_val2 = 0;
797 MISSING(AO_compare_double_and_swap_double);
799 # if defined(AO_HAVE_compare_and_swap_double_read)
800 TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13));
801 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
802 TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13));
803 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
804 TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42));
805 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
807 MISSING(AO_compare_and_swap_double);
814 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
816 * This file is covered by the GNU general public license, version 2.
817 * see doc/COPYING for details.
820 /* Some basic sanity tests. These do not test the barrier semantics. */
823 #define TA_assert(e) \
824 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \
825 __FILE__, __LINE__), exit(1); }
828 #define MISSING(name) \
829 fprintf(stderr, "Missing: %s\n", #name "_write")
831 void test_atomic_write(void)
837 # if defined(AO_HAVE_test_and_set_write)
838 AO_TS_t z = AO_TS_INITIALIZER;
840 # if defined(AO_HAVE_double_t)
846 # if defined(AO_HAVE_nop_write)
851 # if defined(AO_HAVE_store_write)
852 AO_store_write(&x, 13);
858 # if defined(AO_HAVE_load_write)
859 TA_assert(AO_load_write(&x) == 13);
863 # if defined(AO_HAVE_test_and_set_write)
864 assert(AO_test_and_set_write(&z) == AO_TS_CLEAR);
865 assert(AO_test_and_set_write(&z) == AO_TS_SET);
866 assert(AO_test_and_set_write(&z) == AO_TS_SET);
869 MISSING(AO_test_and_set);
871 # if defined(AO_HAVE_fetch_and_add_write)
872 TA_assert(AO_fetch_and_add_write(&x, 42) == 13);
873 TA_assert(AO_fetch_and_add_write(&x, -42) == 55);
875 MISSING(AO_fetch_and_add);
877 # if defined(AO_HAVE_fetch_and_add1_write)
878 TA_assert(AO_fetch_and_add1_write(&x) == 13);
880 MISSING(AO_fetch_and_add1);
883 # if defined(AO_HAVE_fetch_and_sub1_write)
884 TA_assert(AO_fetch_and_sub1_write(&x) == 14);
886 MISSING(AO_fetch_and_sub1);
889 # if defined(AO_HAVE_short_store_write)
890 AO_short_store_write(&s, 13);
892 MISSING(AO_short_store);
895 # if defined(AO_HAVE_short_load_write)
896 TA_assert(AO_short_load(&s) == 13);
898 MISSING(AO_short_load);
900 # if defined(AO_HAVE_short_fetch_and_add_write)
901 TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13);
902 TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55);
904 MISSING(AO_short_fetch_and_add);
906 # if defined(AO_HAVE_short_fetch_and_add1_write)
907 TA_assert(AO_short_fetch_and_add1_write(&s) == 13);
909 MISSING(AO_short_fetch_and_add1);
912 # if defined(AO_HAVE_short_fetch_and_sub1_write)
913 TA_assert(AO_short_fetch_and_sub1_write(&s) == 14);
915 MISSING(AO_short_fetch_and_sub1);
918 # if defined(AO_HAVE_char_store_write)
919 AO_char_store_write(&b, 13);
921 MISSING(AO_char_store);
924 # if defined(AO_HAVE_char_load_write)
925 TA_assert(AO_char_load(&b) == 13);
927 MISSING(AO_char_load);
929 # if defined(AO_HAVE_char_fetch_and_add_write)
930 TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13);
931 TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55);
933 MISSING(AO_char_fetch_and_add);
935 # if defined(AO_HAVE_char_fetch_and_add1_write)
936 TA_assert(AO_char_fetch_and_add1_write(&b) == 13);
938 MISSING(AO_char_fetch_and_add1);
941 # if defined(AO_HAVE_char_fetch_and_sub1_write)
942 TA_assert(AO_char_fetch_and_sub1_write(&b) == 14);
944 MISSING(AO_char_fetch_and_sub1);
947 # if defined(AO_HAVE_int_store_write)
948 AO_int_store_write(&zz, 13);
950 MISSING(AO_int_store);
953 # if defined(AO_HAVE_int_load_write)
954 TA_assert(AO_int_load(&zz) == 13);
956 MISSING(AO_int_load);
958 # if defined(AO_HAVE_int_fetch_and_add_write)
959 TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13);
960 TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55);
962 MISSING(AO_int_fetch_and_add);
964 # if defined(AO_HAVE_int_fetch_and_add1_write)
965 TA_assert(AO_int_fetch_and_add1_write(&zz) == 13);
967 MISSING(AO_int_fetch_and_add1);
970 # if defined(AO_HAVE_int_fetch_and_sub1_write)
971 TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14);
973 MISSING(AO_int_fetch_and_sub1);
976 # if defined(AO_HAVE_compare_and_swap_write)
977 TA_assert(!AO_compare_and_swap_write(&x, 14, 42));
979 TA_assert(AO_compare_and_swap_write(&x, 13, 42));
982 MISSING(AO_compare_and_swap);
984 # if defined(AO_HAVE_or_write)
991 # if defined(AO_HAVE_compare_double_and_swap_double_write)
992 TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13));
993 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
994 TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13));
995 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
996 TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42));
997 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
998 w.AO_val1 = 0; w.AO_val2 = 0;
1000 MISSING(AO_compare_double_and_swap_double);
1002 # if defined(AO_HAVE_compare_and_swap_double_write)
1003 TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13));
1004 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1005 TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13));
1006 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1007 TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42));
1008 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1010 MISSING(AO_compare_and_swap_double);
1017 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1019 * This file is covered by the GNU general public license, version 2.
1020 * see doc/COPYING for details.
1023 /* Some basic sanity tests. These do not test the barrier semantics. */
1026 #define TA_assert(e) \
1027 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \
1028 __FILE__, __LINE__), exit(1); }
1031 #define MISSING(name) \
1032 fprintf(stderr, "Missing: %s\n", #name "_full")
1034 void test_atomic_full(void)
1040 # if defined(AO_HAVE_test_and_set_full)
1041 AO_TS_t z = AO_TS_INITIALIZER;
1043 # if defined(AO_HAVE_double_t)
1049 # if defined(AO_HAVE_nop_full)
1054 # if defined(AO_HAVE_store_full)
1055 AO_store_full(&x, 13);
1056 TA_assert (x == 13);
1061 # if defined(AO_HAVE_load_full)
1062 TA_assert(AO_load_full(&x) == 13);
1066 # if defined(AO_HAVE_test_and_set_full)
1067 assert(AO_test_and_set_full(&z) == AO_TS_CLEAR);
1068 assert(AO_test_and_set_full(&z) == AO_TS_SET);
1069 assert(AO_test_and_set_full(&z) == AO_TS_SET);
1072 MISSING(AO_test_and_set);
1074 # if defined(AO_HAVE_fetch_and_add_full)
1075 TA_assert(AO_fetch_and_add_full(&x, 42) == 13);
1076 TA_assert(AO_fetch_and_add_full(&x, -42) == 55);
1078 MISSING(AO_fetch_and_add);
1080 # if defined(AO_HAVE_fetch_and_add1_full)
1081 TA_assert(AO_fetch_and_add1_full(&x) == 13);
1083 MISSING(AO_fetch_and_add1);
1086 # if defined(AO_HAVE_fetch_and_sub1_full)
1087 TA_assert(AO_fetch_and_sub1_full(&x) == 14);
1089 MISSING(AO_fetch_and_sub1);
1092 # if defined(AO_HAVE_short_store_full)
1093 AO_short_store_full(&s, 13);
1095 MISSING(AO_short_store);
1098 # if defined(AO_HAVE_short_load_full)
1099 TA_assert(AO_short_load(&s) == 13);
1101 MISSING(AO_short_load);
1103 # if defined(AO_HAVE_short_fetch_and_add_full)
1104 TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13);
1105 TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55);
1107 MISSING(AO_short_fetch_and_add);
1109 # if defined(AO_HAVE_short_fetch_and_add1_full)
1110 TA_assert(AO_short_fetch_and_add1_full(&s) == 13);
1112 MISSING(AO_short_fetch_and_add1);
1115 # if defined(AO_HAVE_short_fetch_and_sub1_full)
1116 TA_assert(AO_short_fetch_and_sub1_full(&s) == 14);
1118 MISSING(AO_short_fetch_and_sub1);
1121 # if defined(AO_HAVE_char_store_full)
1122 AO_char_store_full(&b, 13);
1124 MISSING(AO_char_store);
1127 # if defined(AO_HAVE_char_load_full)
1128 TA_assert(AO_char_load(&b) == 13);
1130 MISSING(AO_char_load);
1132 # if defined(AO_HAVE_char_fetch_and_add_full)
1133 TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13);
1134 TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55);
1136 MISSING(AO_char_fetch_and_add);
1138 # if defined(AO_HAVE_char_fetch_and_add1_full)
1139 TA_assert(AO_char_fetch_and_add1_full(&b) == 13);
1141 MISSING(AO_char_fetch_and_add1);
1144 # if defined(AO_HAVE_char_fetch_and_sub1_full)
1145 TA_assert(AO_char_fetch_and_sub1_full(&b) == 14);
1147 MISSING(AO_char_fetch_and_sub1);
1150 # if defined(AO_HAVE_int_store_full)
1151 AO_int_store_full(&zz, 13);
1153 MISSING(AO_int_store);
1156 # if defined(AO_HAVE_int_load_full)
1157 TA_assert(AO_int_load(&zz) == 13);
1159 MISSING(AO_int_load);
1161 # if defined(AO_HAVE_int_fetch_and_add_full)
1162 TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13);
1163 TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55);
1165 MISSING(AO_int_fetch_and_add);
1167 # if defined(AO_HAVE_int_fetch_and_add1_full)
1168 TA_assert(AO_int_fetch_and_add1_full(&zz) == 13);
1170 MISSING(AO_int_fetch_and_add1);
1173 # if defined(AO_HAVE_int_fetch_and_sub1_full)
1174 TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14);
1176 MISSING(AO_int_fetch_and_sub1);
1179 # if defined(AO_HAVE_compare_and_swap_full)
1180 TA_assert(!AO_compare_and_swap_full(&x, 14, 42));
1182 TA_assert(AO_compare_and_swap_full(&x, 13, 42));
1185 MISSING(AO_compare_and_swap);
1187 # if defined(AO_HAVE_or_full)
1189 TA_assert(x == 106);
1194 # if defined(AO_HAVE_compare_double_and_swap_double_full)
1195 TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13));
1196 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1197 TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13));
1198 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1199 TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42));
1200 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1201 w.AO_val1 = 0; w.AO_val2 = 0;
1203 MISSING(AO_compare_double_and_swap_double);
1205 # if defined(AO_HAVE_compare_and_swap_double_full)
1206 TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13));
1207 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1208 TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13));
1209 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1210 TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42));
1211 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1213 MISSING(AO_compare_and_swap_double);
1220 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1222 * This file is covered by the GNU general public license, version 2.
1223 * see doc/COPYING for details.
1226 /* Some basic sanity tests. These do not test the barrier semantics. */
1229 #define TA_assert(e) \
1230 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \
1231 __FILE__, __LINE__), exit(1); }
1234 #define MISSING(name) \
1235 fprintf(stderr, "Missing: %s\n", #name "_release_write")
1237 void test_atomic_release_write(void)
1243 # if defined(AO_HAVE_test_and_set_release_write)
1244 AO_TS_t z = AO_TS_INITIALIZER;
1246 # if defined(AO_HAVE_double_t)
1252 # if defined(AO_HAVE_nop_release_write)
1253 AO_nop_release_write();
1257 # if defined(AO_HAVE_store_release_write)
1258 AO_store_release_write(&x, 13);
1259 TA_assert (x == 13);
1264 # if defined(AO_HAVE_load_release_write)
1265 TA_assert(AO_load_release_write(&x) == 13);
1269 # if defined(AO_HAVE_test_and_set_release_write)
1270 assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR);
1271 assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1272 assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1275 MISSING(AO_test_and_set);
1277 # if defined(AO_HAVE_fetch_and_add_release_write)
1278 TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13);
1279 TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55);
1281 MISSING(AO_fetch_and_add);
1283 # if defined(AO_HAVE_fetch_and_add1_release_write)
1284 TA_assert(AO_fetch_and_add1_release_write(&x) == 13);
1286 MISSING(AO_fetch_and_add1);
1289 # if defined(AO_HAVE_fetch_and_sub1_release_write)
1290 TA_assert(AO_fetch_and_sub1_release_write(&x) == 14);
1292 MISSING(AO_fetch_and_sub1);
1295 # if defined(AO_HAVE_short_store_release_write)
1296 AO_short_store_release_write(&s, 13);
1298 MISSING(AO_short_store);
1301 # if defined(AO_HAVE_short_load_release_write)
1302 TA_assert(AO_short_load(&s) == 13);
1304 MISSING(AO_short_load);
1306 # if defined(AO_HAVE_short_fetch_and_add_release_write)
1307 TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13);
1308 TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55);
1310 MISSING(AO_short_fetch_and_add);
1312 # if defined(AO_HAVE_short_fetch_and_add1_release_write)
1313 TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13);
1315 MISSING(AO_short_fetch_and_add1);
1318 # if defined(AO_HAVE_short_fetch_and_sub1_release_write)
1319 TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14);
1321 MISSING(AO_short_fetch_and_sub1);
1324 # if defined(AO_HAVE_char_store_release_write)
1325 AO_char_store_release_write(&b, 13);
1327 MISSING(AO_char_store);
1330 # if defined(AO_HAVE_char_load_release_write)
1331 TA_assert(AO_char_load(&b) == 13);
1333 MISSING(AO_char_load);
1335 # if defined(AO_HAVE_char_fetch_and_add_release_write)
1336 TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13);
1337 TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55);
1339 MISSING(AO_char_fetch_and_add);
1341 # if defined(AO_HAVE_char_fetch_and_add1_release_write)
1342 TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13);
1344 MISSING(AO_char_fetch_and_add1);
1347 # if defined(AO_HAVE_char_fetch_and_sub1_release_write)
1348 TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14);
1350 MISSING(AO_char_fetch_and_sub1);
1353 # if defined(AO_HAVE_int_store_release_write)
1354 AO_int_store_release_write(&zz, 13);
1356 MISSING(AO_int_store);
1359 # if defined(AO_HAVE_int_load_release_write)
1360 TA_assert(AO_int_load(&zz) == 13);
1362 MISSING(AO_int_load);
1364 # if defined(AO_HAVE_int_fetch_and_add_release_write)
1365 TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13);
1366 TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55);
1368 MISSING(AO_int_fetch_and_add);
1370 # if defined(AO_HAVE_int_fetch_and_add1_release_write)
1371 TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13);
1373 MISSING(AO_int_fetch_and_add1);
1376 # if defined(AO_HAVE_int_fetch_and_sub1_release_write)
1377 TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14);
1379 MISSING(AO_int_fetch_and_sub1);
1382 # if defined(AO_HAVE_compare_and_swap_release_write)
1383 TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42));
1385 TA_assert(AO_compare_and_swap_release_write(&x, 13, 42));
1388 MISSING(AO_compare_and_swap);
1390 # if defined(AO_HAVE_or_release_write)
1391 AO_or_release_write(&x, 66);
1392 TA_assert(x == 106);
1397 # if defined(AO_HAVE_compare_double_and_swap_double_release_write)
1398 TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13));
1399 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1400 TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13));
1401 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1402 TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42));
1403 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1404 w.AO_val1 = 0; w.AO_val2 = 0;
1406 MISSING(AO_compare_double_and_swap_double);
1408 # if defined(AO_HAVE_compare_and_swap_double_release_write)
1409 TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13));
1410 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1411 TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13));
1412 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1413 TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42));
1414 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1416 MISSING(AO_compare_and_swap_double);
1423 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1425 * This file is covered by the GNU general public license, version 2.
1426 * see doc/COPYING for details.
1429 /* Some basic sanity tests. These do not test the barrier semantics. */
1432 #define TA_assert(e) \
1433 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \
1434 __FILE__, __LINE__), exit(1); }
1437 #define MISSING(name) \
1438 fprintf(stderr, "Missing: %s\n", #name "_acquire_read")
1440 void test_atomic_acquire_read(void)
1446 # if defined(AO_HAVE_test_and_set_acquire_read)
1447 AO_TS_t z = AO_TS_INITIALIZER;
1449 # if defined(AO_HAVE_double_t)
1455 # if defined(AO_HAVE_nop_acquire_read)
1456 AO_nop_acquire_read();
1460 # if defined(AO_HAVE_store_acquire_read)
1461 AO_store_acquire_read(&x, 13);
1462 TA_assert (x == 13);
1467 # if defined(AO_HAVE_load_acquire_read)
1468 TA_assert(AO_load_acquire_read(&x) == 13);
1472 # if defined(AO_HAVE_test_and_set_acquire_read)
1473 assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR);
1474 assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1475 assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1478 MISSING(AO_test_and_set);
1480 # if defined(AO_HAVE_fetch_and_add_acquire_read)
1481 TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13);
1482 TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55);
1484 MISSING(AO_fetch_and_add);
1486 # if defined(AO_HAVE_fetch_and_add1_acquire_read)
1487 TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13);
1489 MISSING(AO_fetch_and_add1);
1492 # if defined(AO_HAVE_fetch_and_sub1_acquire_read)
1493 TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14);
1495 MISSING(AO_fetch_and_sub1);
1498 # if defined(AO_HAVE_short_store_acquire_read)
1499 AO_short_store_acquire_read(&s, 13);
1501 MISSING(AO_short_store);
1504 # if defined(AO_HAVE_short_load_acquire_read)
1505 TA_assert(AO_short_load(&s) == 13);
1507 MISSING(AO_short_load);
1509 # if defined(AO_HAVE_short_fetch_and_add_acquire_read)
1510 TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13);
1511 TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55);
1513 MISSING(AO_short_fetch_and_add);
1515 # if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
1516 TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13);
1518 MISSING(AO_short_fetch_and_add1);
1521 # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
1522 TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14);
1524 MISSING(AO_short_fetch_and_sub1);
1527 # if defined(AO_HAVE_char_store_acquire_read)
1528 AO_char_store_acquire_read(&b, 13);
1530 MISSING(AO_char_store);
1533 # if defined(AO_HAVE_char_load_acquire_read)
1534 TA_assert(AO_char_load(&b) == 13);
1536 MISSING(AO_char_load);
1538 # if defined(AO_HAVE_char_fetch_and_add_acquire_read)
1539 TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13);
1540 TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55);
1542 MISSING(AO_char_fetch_and_add);
1544 # if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
1545 TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13);
1547 MISSING(AO_char_fetch_and_add1);
1550 # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
1551 TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14);
1553 MISSING(AO_char_fetch_and_sub1);
1556 # if defined(AO_HAVE_int_store_acquire_read)
1557 AO_int_store_acquire_read(&zz, 13);
1559 MISSING(AO_int_store);
1562 # if defined(AO_HAVE_int_load_acquire_read)
1563 TA_assert(AO_int_load(&zz) == 13);
1565 MISSING(AO_int_load);
1567 # if defined(AO_HAVE_int_fetch_and_add_acquire_read)
1568 TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13);
1569 TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55);
1571 MISSING(AO_int_fetch_and_add);
1573 # if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
1574 TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13);
1576 MISSING(AO_int_fetch_and_add1);
1579 # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
1580 TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14);
1582 MISSING(AO_int_fetch_and_sub1);
1585 # if defined(AO_HAVE_compare_and_swap_acquire_read)
1586 TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42));
1588 TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42));
1591 MISSING(AO_compare_and_swap);
1593 # if defined(AO_HAVE_or_acquire_read)
1594 AO_or_acquire_read(&x, 66);
1595 TA_assert(x == 106);
1600 # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read)
1601 TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13));
1602 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1603 TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13));
1604 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1605 TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42));
1606 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1607 w.AO_val1 = 0; w.AO_val2 = 0;
1609 MISSING(AO_compare_double_and_swap_double);
1611 # if defined(AO_HAVE_compare_and_swap_double_acquire_read)
1612 TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13));
1613 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1614 TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13));
1615 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1616 TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42));
1617 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1619 MISSING(AO_compare_and_swap_double);