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);
173 # if defined(AO_HAVE_or)
180 # if defined(AO_HAVE_compare_double_and_swap_double)
181 TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13));
182 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
183 TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13));
184 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
185 TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42));
186 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
187 w.AO_val1 = 0; w.AO_val2 = 0;
189 MISSING(AO_compare_double_and_swap_double);
191 # if defined(AO_HAVE_compare_and_swap_double)
192 TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13));
193 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
194 TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13));
195 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
196 TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42));
197 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
199 MISSING(AO_compare_and_swap_double);
206 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
208 * This file is covered by the GNU general public license, version 2.
209 * see doc/COPYING for details.
212 /* Some basic sanity tests. These do not test the barrier semantics. */
215 #define TA_assert(e) \
216 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \
217 __FILE__, __LINE__), exit(1); }
220 #define MISSING(name) \
221 fprintf(stderr, "Missing: %s\n", #name "_release")
223 void test_atomic_release(void)
229 # if defined(AO_HAVE_test_and_set_release)
230 AO_TS_t z = AO_TS_INITIALIZER;
232 # if defined(AO_HAVE_double_t)
238 # if defined(AO_HAVE_nop_release)
243 # if defined(AO_HAVE_store_release)
244 AO_store_release(&x, 13);
250 # if defined(AO_HAVE_load_release)
251 TA_assert(AO_load_release(&x) == 13);
255 # if defined(AO_HAVE_test_and_set_release)
256 assert(AO_test_and_set_release(&z) == AO_TS_CLEAR);
257 assert(AO_test_and_set_release(&z) == AO_TS_SET);
258 assert(AO_test_and_set_release(&z) == AO_TS_SET);
261 MISSING(AO_test_and_set);
263 # if defined(AO_HAVE_fetch_and_add_release)
264 TA_assert(AO_fetch_and_add_release(&x, 42) == 13);
265 TA_assert(AO_fetch_and_add_release(&x, -42) == 55);
267 MISSING(AO_fetch_and_add);
269 # if defined(AO_HAVE_fetch_and_add1_release)
270 TA_assert(AO_fetch_and_add1_release(&x) == 13);
272 MISSING(AO_fetch_and_add1);
275 # if defined(AO_HAVE_fetch_and_sub1_release)
276 TA_assert(AO_fetch_and_sub1_release(&x) == 14);
278 MISSING(AO_fetch_and_sub1);
281 # if defined(AO_HAVE_short_store_release)
282 AO_short_store_release(&s, 13);
284 MISSING(AO_short_store);
287 # if defined(AO_HAVE_short_load_release)
288 TA_assert(AO_short_load(&s) == 13);
290 MISSING(AO_short_load);
292 # if defined(AO_HAVE_short_fetch_and_add_release)
293 TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13);
294 TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55);
296 MISSING(AO_short_fetch_and_add);
298 # if defined(AO_HAVE_short_fetch_and_add1_release)
299 TA_assert(AO_short_fetch_and_add1_release(&s) == 13);
301 MISSING(AO_short_fetch_and_add1);
304 # if defined(AO_HAVE_short_fetch_and_sub1_release)
305 TA_assert(AO_short_fetch_and_sub1_release(&s) == 14);
307 MISSING(AO_short_fetch_and_sub1);
310 # if defined(AO_HAVE_char_store_release)
311 AO_char_store_release(&b, 13);
313 MISSING(AO_char_store);
316 # if defined(AO_HAVE_char_load_release)
317 TA_assert(AO_char_load(&b) == 13);
319 MISSING(AO_char_load);
321 # if defined(AO_HAVE_char_fetch_and_add_release)
322 TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13);
323 TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55);
325 MISSING(AO_char_fetch_and_add);
327 # if defined(AO_HAVE_char_fetch_and_add1_release)
328 TA_assert(AO_char_fetch_and_add1_release(&b) == 13);
330 MISSING(AO_char_fetch_and_add1);
333 # if defined(AO_HAVE_char_fetch_and_sub1_release)
334 TA_assert(AO_char_fetch_and_sub1_release(&b) == 14);
336 MISSING(AO_char_fetch_and_sub1);
339 # if defined(AO_HAVE_int_store_release)
340 AO_int_store_release(&zz, 13);
342 MISSING(AO_int_store);
345 # if defined(AO_HAVE_int_load_release)
346 TA_assert(AO_int_load(&zz) == 13);
348 MISSING(AO_int_load);
350 # if defined(AO_HAVE_int_fetch_and_add_release)
351 TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13);
352 TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55);
354 MISSING(AO_int_fetch_and_add);
356 # if defined(AO_HAVE_int_fetch_and_add1_release)
357 TA_assert(AO_int_fetch_and_add1_release(&zz) == 13);
359 MISSING(AO_int_fetch_and_add1);
362 # if defined(AO_HAVE_int_fetch_and_sub1_release)
363 TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14);
365 MISSING(AO_int_fetch_and_sub1);
368 # if defined(AO_HAVE_compare_and_swap_release)
369 TA_assert(!AO_compare_and_swap_release(&x, 14, 42));
371 TA_assert(AO_compare_and_swap_release(&x, 13, 42));
374 MISSING(AO_compare_and_swap);
377 # if defined(AO_HAVE_or_release)
378 AO_or_release(&x, 66);
384 # if defined(AO_HAVE_compare_double_and_swap_double_release)
385 TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13));
386 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
387 TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13));
388 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
389 TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42));
390 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
391 w.AO_val1 = 0; w.AO_val2 = 0;
393 MISSING(AO_compare_double_and_swap_double);
395 # if defined(AO_HAVE_compare_and_swap_double_release)
396 TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13));
397 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
398 TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13));
399 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
400 TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42));
401 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
403 MISSING(AO_compare_and_swap_double);
410 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
412 * This file is covered by the GNU general public license, version 2.
413 * see doc/COPYING for details.
416 /* Some basic sanity tests. These do not test the barrier semantics. */
419 #define TA_assert(e) \
420 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \
421 __FILE__, __LINE__), exit(1); }
424 #define MISSING(name) \
425 fprintf(stderr, "Missing: %s\n", #name "_acquire")
427 void test_atomic_acquire(void)
433 # if defined(AO_HAVE_test_and_set_acquire)
434 AO_TS_t z = AO_TS_INITIALIZER;
436 # if defined(AO_HAVE_double_t)
442 # if defined(AO_HAVE_nop_acquire)
447 # if defined(AO_HAVE_store_acquire)
448 AO_store_acquire(&x, 13);
454 # if defined(AO_HAVE_load_acquire)
455 TA_assert(AO_load_acquire(&x) == 13);
459 # if defined(AO_HAVE_test_and_set_acquire)
460 assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR);
461 assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
462 assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
465 MISSING(AO_test_and_set);
467 # if defined(AO_HAVE_fetch_and_add_acquire)
468 TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13);
469 TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55);
471 MISSING(AO_fetch_and_add);
473 # if defined(AO_HAVE_fetch_and_add1_acquire)
474 TA_assert(AO_fetch_and_add1_acquire(&x) == 13);
476 MISSING(AO_fetch_and_add1);
479 # if defined(AO_HAVE_fetch_and_sub1_acquire)
480 TA_assert(AO_fetch_and_sub1_acquire(&x) == 14);
482 MISSING(AO_fetch_and_sub1);
485 # if defined(AO_HAVE_short_store_acquire)
486 AO_short_store_acquire(&s, 13);
488 MISSING(AO_short_store);
491 # if defined(AO_HAVE_short_load_acquire)
492 TA_assert(AO_short_load(&s) == 13);
494 MISSING(AO_short_load);
496 # if defined(AO_HAVE_short_fetch_and_add_acquire)
497 TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13);
498 TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55);
500 MISSING(AO_short_fetch_and_add);
502 # if defined(AO_HAVE_short_fetch_and_add1_acquire)
503 TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13);
505 MISSING(AO_short_fetch_and_add1);
508 # if defined(AO_HAVE_short_fetch_and_sub1_acquire)
509 TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14);
511 MISSING(AO_short_fetch_and_sub1);
514 # if defined(AO_HAVE_char_store_acquire)
515 AO_char_store_acquire(&b, 13);
517 MISSING(AO_char_store);
520 # if defined(AO_HAVE_char_load_acquire)
521 TA_assert(AO_char_load(&b) == 13);
523 MISSING(AO_char_load);
525 # if defined(AO_HAVE_char_fetch_and_add_acquire)
526 TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13);
527 TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55);
529 MISSING(AO_char_fetch_and_add);
531 # if defined(AO_HAVE_char_fetch_and_add1_acquire)
532 TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13);
534 MISSING(AO_char_fetch_and_add1);
537 # if defined(AO_HAVE_char_fetch_and_sub1_acquire)
538 TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14);
540 MISSING(AO_char_fetch_and_sub1);
543 # if defined(AO_HAVE_int_store_acquire)
544 AO_int_store_acquire(&zz, 13);
546 MISSING(AO_int_store);
549 # if defined(AO_HAVE_int_load_acquire)
550 TA_assert(AO_int_load(&zz) == 13);
552 MISSING(AO_int_load);
554 # if defined(AO_HAVE_int_fetch_and_add_acquire)
555 TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13);
556 TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55);
558 MISSING(AO_int_fetch_and_add);
560 # if defined(AO_HAVE_int_fetch_and_add1_acquire)
561 TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13);
563 MISSING(AO_int_fetch_and_add1);
566 # if defined(AO_HAVE_int_fetch_and_sub1_acquire)
567 TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14);
569 MISSING(AO_int_fetch_and_sub1);
572 # if defined(AO_HAVE_compare_and_swap_acquire)
573 TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42));
575 TA_assert(AO_compare_and_swap_acquire(&x, 13, 42));
578 MISSING(AO_compare_and_swap);
581 # if defined(AO_HAVE_or_acquire)
582 AO_or_acquire(&x, 66);
588 # if defined(AO_HAVE_compare_double_and_swap_double_acquire)
589 TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13));
590 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
591 TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13));
592 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
593 TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42));
594 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
595 w.AO_val1 = 0; w.AO_val2 = 0;
597 MISSING(AO_compare_double_and_swap_double);
599 # if defined(AO_HAVE_compare_and_swap_double_acquire)
600 TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13));
601 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
602 TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13));
603 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
604 TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42));
605 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
607 MISSING(AO_compare_and_swap_double);
614 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
616 * This file is covered by the GNU general public license, version 2.
617 * see doc/COPYING for details.
620 /* Some basic sanity tests. These do not test the barrier semantics. */
623 #define TA_assert(e) \
624 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \
625 __FILE__, __LINE__), exit(1); }
628 #define MISSING(name) \
629 fprintf(stderr, "Missing: %s\n", #name "_read")
631 void test_atomic_read(void)
637 # if defined(AO_HAVE_test_and_set_read)
638 AO_TS_t z = AO_TS_INITIALIZER;
640 # if defined(AO_HAVE_double_t)
646 # if defined(AO_HAVE_nop_read)
651 # if defined(AO_HAVE_store_read)
652 AO_store_read(&x, 13);
658 # if defined(AO_HAVE_load_read)
659 TA_assert(AO_load_read(&x) == 13);
663 # if defined(AO_HAVE_test_and_set_read)
664 assert(AO_test_and_set_read(&z) == AO_TS_CLEAR);
665 assert(AO_test_and_set_read(&z) == AO_TS_SET);
666 assert(AO_test_and_set_read(&z) == AO_TS_SET);
669 MISSING(AO_test_and_set);
671 # if defined(AO_HAVE_fetch_and_add_read)
672 TA_assert(AO_fetch_and_add_read(&x, 42) == 13);
673 TA_assert(AO_fetch_and_add_read(&x, -42) == 55);
675 MISSING(AO_fetch_and_add);
677 # if defined(AO_HAVE_fetch_and_add1_read)
678 TA_assert(AO_fetch_and_add1_read(&x) == 13);
680 MISSING(AO_fetch_and_add1);
683 # if defined(AO_HAVE_fetch_and_sub1_read)
684 TA_assert(AO_fetch_and_sub1_read(&x) == 14);
686 MISSING(AO_fetch_and_sub1);
689 # if defined(AO_HAVE_short_store_read)
690 AO_short_store_read(&s, 13);
692 MISSING(AO_short_store);
695 # if defined(AO_HAVE_short_load_read)
696 TA_assert(AO_short_load(&s) == 13);
698 MISSING(AO_short_load);
700 # if defined(AO_HAVE_short_fetch_and_add_read)
701 TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13);
702 TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55);
704 MISSING(AO_short_fetch_and_add);
706 # if defined(AO_HAVE_short_fetch_and_add1_read)
707 TA_assert(AO_short_fetch_and_add1_read(&s) == 13);
709 MISSING(AO_short_fetch_and_add1);
712 # if defined(AO_HAVE_short_fetch_and_sub1_read)
713 TA_assert(AO_short_fetch_and_sub1_read(&s) == 14);
715 MISSING(AO_short_fetch_and_sub1);
718 # if defined(AO_HAVE_char_store_read)
719 AO_char_store_read(&b, 13);
721 MISSING(AO_char_store);
724 # if defined(AO_HAVE_char_load_read)
725 TA_assert(AO_char_load(&b) == 13);
727 MISSING(AO_char_load);
729 # if defined(AO_HAVE_char_fetch_and_add_read)
730 TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13);
731 TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55);
733 MISSING(AO_char_fetch_and_add);
735 # if defined(AO_HAVE_char_fetch_and_add1_read)
736 TA_assert(AO_char_fetch_and_add1_read(&b) == 13);
738 MISSING(AO_char_fetch_and_add1);
741 # if defined(AO_HAVE_char_fetch_and_sub1_read)
742 TA_assert(AO_char_fetch_and_sub1_read(&b) == 14);
744 MISSING(AO_char_fetch_and_sub1);
747 # if defined(AO_HAVE_int_store_read)
748 AO_int_store_read(&zz, 13);
750 MISSING(AO_int_store);
753 # if defined(AO_HAVE_int_load_read)
754 TA_assert(AO_int_load(&zz) == 13);
756 MISSING(AO_int_load);
758 # if defined(AO_HAVE_int_fetch_and_add_read)
759 TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13);
760 TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55);
762 MISSING(AO_int_fetch_and_add);
764 # if defined(AO_HAVE_int_fetch_and_add1_read)
765 TA_assert(AO_int_fetch_and_add1_read(&zz) == 13);
767 MISSING(AO_int_fetch_and_add1);
770 # if defined(AO_HAVE_int_fetch_and_sub1_read)
771 TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14);
773 MISSING(AO_int_fetch_and_sub1);
776 # if defined(AO_HAVE_compare_and_swap_read)
777 TA_assert(!AO_compare_and_swap_read(&x, 14, 42));
779 TA_assert(AO_compare_and_swap_read(&x, 13, 42));
782 MISSING(AO_compare_and_swap);
785 # if defined(AO_HAVE_or_read)
792 # if defined(AO_HAVE_compare_double_and_swap_double_read)
793 TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13));
794 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
795 TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13));
796 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
797 TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42));
798 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
799 w.AO_val1 = 0; w.AO_val2 = 0;
801 MISSING(AO_compare_double_and_swap_double);
803 # if defined(AO_HAVE_compare_and_swap_double_read)
804 TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13));
805 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
806 TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13));
807 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
808 TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42));
809 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
811 MISSING(AO_compare_and_swap_double);
818 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
820 * This file is covered by the GNU general public license, version 2.
821 * see doc/COPYING for details.
824 /* Some basic sanity tests. These do not test the barrier semantics. */
827 #define TA_assert(e) \
828 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \
829 __FILE__, __LINE__), exit(1); }
832 #define MISSING(name) \
833 fprintf(stderr, "Missing: %s\n", #name "_write")
835 void test_atomic_write(void)
841 # if defined(AO_HAVE_test_and_set_write)
842 AO_TS_t z = AO_TS_INITIALIZER;
844 # if defined(AO_HAVE_double_t)
850 # if defined(AO_HAVE_nop_write)
855 # if defined(AO_HAVE_store_write)
856 AO_store_write(&x, 13);
862 # if defined(AO_HAVE_load_write)
863 TA_assert(AO_load_write(&x) == 13);
867 # if defined(AO_HAVE_test_and_set_write)
868 assert(AO_test_and_set_write(&z) == AO_TS_CLEAR);
869 assert(AO_test_and_set_write(&z) == AO_TS_SET);
870 assert(AO_test_and_set_write(&z) == AO_TS_SET);
873 MISSING(AO_test_and_set);
875 # if defined(AO_HAVE_fetch_and_add_write)
876 TA_assert(AO_fetch_and_add_write(&x, 42) == 13);
877 TA_assert(AO_fetch_and_add_write(&x, -42) == 55);
879 MISSING(AO_fetch_and_add);
881 # if defined(AO_HAVE_fetch_and_add1_write)
882 TA_assert(AO_fetch_and_add1_write(&x) == 13);
884 MISSING(AO_fetch_and_add1);
887 # if defined(AO_HAVE_fetch_and_sub1_write)
888 TA_assert(AO_fetch_and_sub1_write(&x) == 14);
890 MISSING(AO_fetch_and_sub1);
893 # if defined(AO_HAVE_short_store_write)
894 AO_short_store_write(&s, 13);
896 MISSING(AO_short_store);
899 # if defined(AO_HAVE_short_load_write)
900 TA_assert(AO_short_load(&s) == 13);
902 MISSING(AO_short_load);
904 # if defined(AO_HAVE_short_fetch_and_add_write)
905 TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13);
906 TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55);
908 MISSING(AO_short_fetch_and_add);
910 # if defined(AO_HAVE_short_fetch_and_add1_write)
911 TA_assert(AO_short_fetch_and_add1_write(&s) == 13);
913 MISSING(AO_short_fetch_and_add1);
916 # if defined(AO_HAVE_short_fetch_and_sub1_write)
917 TA_assert(AO_short_fetch_and_sub1_write(&s) == 14);
919 MISSING(AO_short_fetch_and_sub1);
922 # if defined(AO_HAVE_char_store_write)
923 AO_char_store_write(&b, 13);
925 MISSING(AO_char_store);
928 # if defined(AO_HAVE_char_load_write)
929 TA_assert(AO_char_load(&b) == 13);
931 MISSING(AO_char_load);
933 # if defined(AO_HAVE_char_fetch_and_add_write)
934 TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13);
935 TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55);
937 MISSING(AO_char_fetch_and_add);
939 # if defined(AO_HAVE_char_fetch_and_add1_write)
940 TA_assert(AO_char_fetch_and_add1_write(&b) == 13);
942 MISSING(AO_char_fetch_and_add1);
945 # if defined(AO_HAVE_char_fetch_and_sub1_write)
946 TA_assert(AO_char_fetch_and_sub1_write(&b) == 14);
948 MISSING(AO_char_fetch_and_sub1);
951 # if defined(AO_HAVE_int_store_write)
952 AO_int_store_write(&zz, 13);
954 MISSING(AO_int_store);
957 # if defined(AO_HAVE_int_load_write)
958 TA_assert(AO_int_load(&zz) == 13);
960 MISSING(AO_int_load);
962 # if defined(AO_HAVE_int_fetch_and_add_write)
963 TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13);
964 TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55);
966 MISSING(AO_int_fetch_and_add);
968 # if defined(AO_HAVE_int_fetch_and_add1_write)
969 TA_assert(AO_int_fetch_and_add1_write(&zz) == 13);
971 MISSING(AO_int_fetch_and_add1);
974 # if defined(AO_HAVE_int_fetch_and_sub1_write)
975 TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14);
977 MISSING(AO_int_fetch_and_sub1);
980 # if defined(AO_HAVE_compare_and_swap_write)
981 TA_assert(!AO_compare_and_swap_write(&x, 14, 42));
983 TA_assert(AO_compare_and_swap_write(&x, 13, 42));
986 MISSING(AO_compare_and_swap);
989 # if defined(AO_HAVE_or_write)
996 # if defined(AO_HAVE_compare_double_and_swap_double_write)
997 TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13));
998 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
999 TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13));
1000 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1001 TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42));
1002 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1003 w.AO_val1 = 0; w.AO_val2 = 0;
1005 MISSING(AO_compare_double_and_swap_double);
1007 # if defined(AO_HAVE_compare_and_swap_double_write)
1008 TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13));
1009 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1010 TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13));
1011 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1012 TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42));
1013 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1015 MISSING(AO_compare_and_swap_double);
1022 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1024 * This file is covered by the GNU general public license, version 2.
1025 * see doc/COPYING for details.
1028 /* Some basic sanity tests. These do not test the barrier semantics. */
1031 #define TA_assert(e) \
1032 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \
1033 __FILE__, __LINE__), exit(1); }
1036 #define MISSING(name) \
1037 fprintf(stderr, "Missing: %s\n", #name "_full")
1039 void test_atomic_full(void)
1045 # if defined(AO_HAVE_test_and_set_full)
1046 AO_TS_t z = AO_TS_INITIALIZER;
1048 # if defined(AO_HAVE_double_t)
1054 # if defined(AO_HAVE_nop_full)
1059 # if defined(AO_HAVE_store_full)
1060 AO_store_full(&x, 13);
1061 TA_assert (x == 13);
1066 # if defined(AO_HAVE_load_full)
1067 TA_assert(AO_load_full(&x) == 13);
1071 # if defined(AO_HAVE_test_and_set_full)
1072 assert(AO_test_and_set_full(&z) == AO_TS_CLEAR);
1073 assert(AO_test_and_set_full(&z) == AO_TS_SET);
1074 assert(AO_test_and_set_full(&z) == AO_TS_SET);
1077 MISSING(AO_test_and_set);
1079 # if defined(AO_HAVE_fetch_and_add_full)
1080 TA_assert(AO_fetch_and_add_full(&x, 42) == 13);
1081 TA_assert(AO_fetch_and_add_full(&x, -42) == 55);
1083 MISSING(AO_fetch_and_add);
1085 # if defined(AO_HAVE_fetch_and_add1_full)
1086 TA_assert(AO_fetch_and_add1_full(&x) == 13);
1088 MISSING(AO_fetch_and_add1);
1091 # if defined(AO_HAVE_fetch_and_sub1_full)
1092 TA_assert(AO_fetch_and_sub1_full(&x) == 14);
1094 MISSING(AO_fetch_and_sub1);
1097 # if defined(AO_HAVE_short_store_full)
1098 AO_short_store_full(&s, 13);
1100 MISSING(AO_short_store);
1103 # if defined(AO_HAVE_short_load_full)
1104 TA_assert(AO_short_load(&s) == 13);
1106 MISSING(AO_short_load);
1108 # if defined(AO_HAVE_short_fetch_and_add_full)
1109 TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13);
1110 TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55);
1112 MISSING(AO_short_fetch_and_add);
1114 # if defined(AO_HAVE_short_fetch_and_add1_full)
1115 TA_assert(AO_short_fetch_and_add1_full(&s) == 13);
1117 MISSING(AO_short_fetch_and_add1);
1120 # if defined(AO_HAVE_short_fetch_and_sub1_full)
1121 TA_assert(AO_short_fetch_and_sub1_full(&s) == 14);
1123 MISSING(AO_short_fetch_and_sub1);
1126 # if defined(AO_HAVE_char_store_full)
1127 AO_char_store_full(&b, 13);
1129 MISSING(AO_char_store);
1132 # if defined(AO_HAVE_char_load_full)
1133 TA_assert(AO_char_load(&b) == 13);
1135 MISSING(AO_char_load);
1137 # if defined(AO_HAVE_char_fetch_and_add_full)
1138 TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13);
1139 TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55);
1141 MISSING(AO_char_fetch_and_add);
1143 # if defined(AO_HAVE_char_fetch_and_add1_full)
1144 TA_assert(AO_char_fetch_and_add1_full(&b) == 13);
1146 MISSING(AO_char_fetch_and_add1);
1149 # if defined(AO_HAVE_char_fetch_and_sub1_full)
1150 TA_assert(AO_char_fetch_and_sub1_full(&b) == 14);
1152 MISSING(AO_char_fetch_and_sub1);
1155 # if defined(AO_HAVE_int_store_full)
1156 AO_int_store_full(&zz, 13);
1158 MISSING(AO_int_store);
1161 # if defined(AO_HAVE_int_load_full)
1162 TA_assert(AO_int_load(&zz) == 13);
1164 MISSING(AO_int_load);
1166 # if defined(AO_HAVE_int_fetch_and_add_full)
1167 TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13);
1168 TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55);
1170 MISSING(AO_int_fetch_and_add);
1172 # if defined(AO_HAVE_int_fetch_and_add1_full)
1173 TA_assert(AO_int_fetch_and_add1_full(&zz) == 13);
1175 MISSING(AO_int_fetch_and_add1);
1178 # if defined(AO_HAVE_int_fetch_and_sub1_full)
1179 TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14);
1181 MISSING(AO_int_fetch_and_sub1);
1184 # if defined(AO_HAVE_compare_and_swap_full)
1185 TA_assert(!AO_compare_and_swap_full(&x, 14, 42));
1187 TA_assert(AO_compare_and_swap_full(&x, 13, 42));
1190 MISSING(AO_compare_and_swap);
1191 if (x == 13) x = 42;
1193 # if defined(AO_HAVE_or_full)
1195 TA_assert(x == 106);
1200 # if defined(AO_HAVE_compare_double_and_swap_double_full)
1201 TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13));
1202 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1203 TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13));
1204 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1205 TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42));
1206 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1207 w.AO_val1 = 0; w.AO_val2 = 0;
1209 MISSING(AO_compare_double_and_swap_double);
1211 # if defined(AO_HAVE_compare_and_swap_double_full)
1212 TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13));
1213 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1214 TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13));
1215 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1216 TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42));
1217 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1219 MISSING(AO_compare_and_swap_double);
1226 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1228 * This file is covered by the GNU general public license, version 2.
1229 * see doc/COPYING for details.
1232 /* Some basic sanity tests. These do not test the barrier semantics. */
1235 #define TA_assert(e) \
1236 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \
1237 __FILE__, __LINE__), exit(1); }
1240 #define MISSING(name) \
1241 fprintf(stderr, "Missing: %s\n", #name "_release_write")
1243 void test_atomic_release_write(void)
1249 # if defined(AO_HAVE_test_and_set_release_write)
1250 AO_TS_t z = AO_TS_INITIALIZER;
1252 # if defined(AO_HAVE_double_t)
1258 # if defined(AO_HAVE_nop_release_write)
1259 AO_nop_release_write();
1263 # if defined(AO_HAVE_store_release_write)
1264 AO_store_release_write(&x, 13);
1265 TA_assert (x == 13);
1270 # if defined(AO_HAVE_load_release_write)
1271 TA_assert(AO_load_release_write(&x) == 13);
1275 # if defined(AO_HAVE_test_and_set_release_write)
1276 assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR);
1277 assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1278 assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1281 MISSING(AO_test_and_set);
1283 # if defined(AO_HAVE_fetch_and_add_release_write)
1284 TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13);
1285 TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55);
1287 MISSING(AO_fetch_and_add);
1289 # if defined(AO_HAVE_fetch_and_add1_release_write)
1290 TA_assert(AO_fetch_and_add1_release_write(&x) == 13);
1292 MISSING(AO_fetch_and_add1);
1295 # if defined(AO_HAVE_fetch_and_sub1_release_write)
1296 TA_assert(AO_fetch_and_sub1_release_write(&x) == 14);
1298 MISSING(AO_fetch_and_sub1);
1301 # if defined(AO_HAVE_short_store_release_write)
1302 AO_short_store_release_write(&s, 13);
1304 MISSING(AO_short_store);
1307 # if defined(AO_HAVE_short_load_release_write)
1308 TA_assert(AO_short_load(&s) == 13);
1310 MISSING(AO_short_load);
1312 # if defined(AO_HAVE_short_fetch_and_add_release_write)
1313 TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13);
1314 TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55);
1316 MISSING(AO_short_fetch_and_add);
1318 # if defined(AO_HAVE_short_fetch_and_add1_release_write)
1319 TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13);
1321 MISSING(AO_short_fetch_and_add1);
1324 # if defined(AO_HAVE_short_fetch_and_sub1_release_write)
1325 TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14);
1327 MISSING(AO_short_fetch_and_sub1);
1330 # if defined(AO_HAVE_char_store_release_write)
1331 AO_char_store_release_write(&b, 13);
1333 MISSING(AO_char_store);
1336 # if defined(AO_HAVE_char_load_release_write)
1337 TA_assert(AO_char_load(&b) == 13);
1339 MISSING(AO_char_load);
1341 # if defined(AO_HAVE_char_fetch_and_add_release_write)
1342 TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13);
1343 TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55);
1345 MISSING(AO_char_fetch_and_add);
1347 # if defined(AO_HAVE_char_fetch_and_add1_release_write)
1348 TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13);
1350 MISSING(AO_char_fetch_and_add1);
1353 # if defined(AO_HAVE_char_fetch_and_sub1_release_write)
1354 TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14);
1356 MISSING(AO_char_fetch_and_sub1);
1359 # if defined(AO_HAVE_int_store_release_write)
1360 AO_int_store_release_write(&zz, 13);
1362 MISSING(AO_int_store);
1365 # if defined(AO_HAVE_int_load_release_write)
1366 TA_assert(AO_int_load(&zz) == 13);
1368 MISSING(AO_int_load);
1370 # if defined(AO_HAVE_int_fetch_and_add_release_write)
1371 TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13);
1372 TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55);
1374 MISSING(AO_int_fetch_and_add);
1376 # if defined(AO_HAVE_int_fetch_and_add1_release_write)
1377 TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13);
1379 MISSING(AO_int_fetch_and_add1);
1382 # if defined(AO_HAVE_int_fetch_and_sub1_release_write)
1383 TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14);
1385 MISSING(AO_int_fetch_and_sub1);
1388 # if defined(AO_HAVE_compare_and_swap_release_write)
1389 TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42));
1391 TA_assert(AO_compare_and_swap_release_write(&x, 13, 42));
1394 MISSING(AO_compare_and_swap);
1395 if (x == 13) x = 42;
1397 # if defined(AO_HAVE_or_release_write)
1398 AO_or_release_write(&x, 66);
1399 TA_assert(x == 106);
1404 # if defined(AO_HAVE_compare_double_and_swap_double_release_write)
1405 TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13));
1406 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1407 TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13));
1408 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1409 TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42));
1410 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1411 w.AO_val1 = 0; w.AO_val2 = 0;
1413 MISSING(AO_compare_double_and_swap_double);
1415 # if defined(AO_HAVE_compare_and_swap_double_release_write)
1416 TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13));
1417 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1418 TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13));
1419 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1420 TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42));
1421 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1423 MISSING(AO_compare_and_swap_double);
1430 * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1432 * This file is covered by the GNU general public license, version 2.
1433 * see doc/COPYING for details.
1436 /* Some basic sanity tests. These do not test the barrier semantics. */
1439 #define TA_assert(e) \
1440 if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \
1441 __FILE__, __LINE__), exit(1); }
1444 #define MISSING(name) \
1445 fprintf(stderr, "Missing: %s\n", #name "_acquire_read")
1447 void test_atomic_acquire_read(void)
1453 # if defined(AO_HAVE_test_and_set_acquire_read)
1454 AO_TS_t z = AO_TS_INITIALIZER;
1456 # if defined(AO_HAVE_double_t)
1462 # if defined(AO_HAVE_nop_acquire_read)
1463 AO_nop_acquire_read();
1467 # if defined(AO_HAVE_store_acquire_read)
1468 AO_store_acquire_read(&x, 13);
1469 TA_assert (x == 13);
1474 # if defined(AO_HAVE_load_acquire_read)
1475 TA_assert(AO_load_acquire_read(&x) == 13);
1479 # if defined(AO_HAVE_test_and_set_acquire_read)
1480 assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR);
1481 assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1482 assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1485 MISSING(AO_test_and_set);
1487 # if defined(AO_HAVE_fetch_and_add_acquire_read)
1488 TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13);
1489 TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55);
1491 MISSING(AO_fetch_and_add);
1493 # if defined(AO_HAVE_fetch_and_add1_acquire_read)
1494 TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13);
1496 MISSING(AO_fetch_and_add1);
1499 # if defined(AO_HAVE_fetch_and_sub1_acquire_read)
1500 TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14);
1502 MISSING(AO_fetch_and_sub1);
1505 # if defined(AO_HAVE_short_store_acquire_read)
1506 AO_short_store_acquire_read(&s, 13);
1508 MISSING(AO_short_store);
1511 # if defined(AO_HAVE_short_load_acquire_read)
1512 TA_assert(AO_short_load(&s) == 13);
1514 MISSING(AO_short_load);
1516 # if defined(AO_HAVE_short_fetch_and_add_acquire_read)
1517 TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13);
1518 TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55);
1520 MISSING(AO_short_fetch_and_add);
1522 # if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
1523 TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13);
1525 MISSING(AO_short_fetch_and_add1);
1528 # if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
1529 TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14);
1531 MISSING(AO_short_fetch_and_sub1);
1534 # if defined(AO_HAVE_char_store_acquire_read)
1535 AO_char_store_acquire_read(&b, 13);
1537 MISSING(AO_char_store);
1540 # if defined(AO_HAVE_char_load_acquire_read)
1541 TA_assert(AO_char_load(&b) == 13);
1543 MISSING(AO_char_load);
1545 # if defined(AO_HAVE_char_fetch_and_add_acquire_read)
1546 TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13);
1547 TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55);
1549 MISSING(AO_char_fetch_and_add);
1551 # if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
1552 TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13);
1554 MISSING(AO_char_fetch_and_add1);
1557 # if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
1558 TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14);
1560 MISSING(AO_char_fetch_and_sub1);
1563 # if defined(AO_HAVE_int_store_acquire_read)
1564 AO_int_store_acquire_read(&zz, 13);
1566 MISSING(AO_int_store);
1569 # if defined(AO_HAVE_int_load_acquire_read)
1570 TA_assert(AO_int_load(&zz) == 13);
1572 MISSING(AO_int_load);
1574 # if defined(AO_HAVE_int_fetch_and_add_acquire_read)
1575 TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13);
1576 TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55);
1578 MISSING(AO_int_fetch_and_add);
1580 # if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
1581 TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13);
1583 MISSING(AO_int_fetch_and_add1);
1586 # if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
1587 TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14);
1589 MISSING(AO_int_fetch_and_sub1);
1592 # if defined(AO_HAVE_compare_and_swap_acquire_read)
1593 TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42));
1595 TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42));
1598 MISSING(AO_compare_and_swap);
1599 if (x == 13) x = 42;
1601 # if defined(AO_HAVE_or_acquire_read)
1602 AO_or_acquire_read(&x, 66);
1603 TA_assert(x == 106);
1608 # if defined(AO_HAVE_compare_double_and_swap_double_acquire_read)
1609 TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13));
1610 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1611 TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13));
1612 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1613 TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42));
1614 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1615 w.AO_val1 = 0; w.AO_val2 = 0;
1617 MISSING(AO_compare_double_and_swap_double);
1619 # if defined(AO_HAVE_compare_and_swap_double_acquire_read)
1620 TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13));
1621 TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1622 TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13));
1623 TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1624 TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42));
1625 TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1627 MISSING(AO_compare_and_swap_double);