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
void test_atomic(void);
9
void test_atomic_release(void);
10
void test_atomic_acquire(void);
11
void test_atomic_read(void);
12
void test_atomic_write(void);
13
void test_atomic_full(void);
14
void test_atomic_release_write(void);
15
void test_atomic_acquire_read(void);
17
/* Some basic sanity tests. These do not test the barrier semantics. */
20
#define TA_assert(e) \
21
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \
22
__FILE__, __LINE__), exit(1); }
25
#define MISSING(name) \
26
fprintf(stderr, "Missing: %s\n", #name "")
28
void test_atomic(void)
34
# if defined(AO_HAVE_test_and_set)
35
AO_TS_t z = AO_TS_INITIALIZER;
37
# if defined(AO_HAVE_double_t)
43
# if defined(AO_HAVE_nop)
48
# if defined(AO_HAVE_store)
55
# if defined(AO_HAVE_load)
56
TA_assert(AO_load(&x) == 13);
60
# if defined(AO_HAVE_test_and_set)
61
assert(AO_test_and_set(&z) == AO_TS_CLEAR);
62
assert(AO_test_and_set(&z) == AO_TS_SET);
63
assert(AO_test_and_set(&z) == AO_TS_SET);
66
MISSING(AO_test_and_set);
68
# if defined(AO_HAVE_fetch_and_add)
69
TA_assert(AO_fetch_and_add(&x, 42) == 13);
70
TA_assert(AO_fetch_and_add(&x, -42) == 55);
72
MISSING(AO_fetch_and_add);
74
# if defined(AO_HAVE_fetch_and_add1)
75
TA_assert(AO_fetch_and_add1(&x) == 13);
77
MISSING(AO_fetch_and_add1);
80
# if defined(AO_HAVE_fetch_and_sub1)
81
TA_assert(AO_fetch_and_sub1(&x) == 14);
83
MISSING(AO_fetch_and_sub1);
86
# if defined(AO_HAVE_short_store)
87
AO_short_store(&s, 13);
89
MISSING(AO_short_store);
92
# if defined(AO_HAVE_short_load)
93
TA_assert(AO_short_load(&s) == 13);
95
MISSING(AO_short_load);
97
# if defined(AO_HAVE_short_fetch_and_add)
98
TA_assert(AO_short_fetch_and_add(&s, 42) == 13);
99
TA_assert(AO_short_fetch_and_add(&s, -42) == 55);
101
MISSING(AO_short_fetch_and_add);
103
# if defined(AO_HAVE_short_fetch_and_add1)
104
TA_assert(AO_short_fetch_and_add1(&s) == 13);
106
MISSING(AO_short_fetch_and_add1);
109
# if defined(AO_HAVE_short_fetch_and_sub1)
110
TA_assert(AO_short_fetch_and_sub1(&s) == 14);
112
MISSING(AO_short_fetch_and_sub1);
115
# if defined(AO_HAVE_char_store)
116
AO_char_store(&b, 13);
118
MISSING(AO_char_store);
121
# if defined(AO_HAVE_char_load)
122
TA_assert(AO_char_load(&b) == 13);
124
MISSING(AO_char_load);
126
# if defined(AO_HAVE_char_fetch_and_add)
127
TA_assert(AO_char_fetch_and_add(&b, 42) == 13);
128
TA_assert(AO_char_fetch_and_add(&b, -42) == 55);
130
MISSING(AO_char_fetch_and_add);
132
# if defined(AO_HAVE_char_fetch_and_add1)
133
TA_assert(AO_char_fetch_and_add1(&b) == 13);
135
MISSING(AO_char_fetch_and_add1);
138
# if defined(AO_HAVE_char_fetch_and_sub1)
139
TA_assert(AO_char_fetch_and_sub1(&b) == 14);
141
MISSING(AO_char_fetch_and_sub1);
144
# if defined(AO_HAVE_int_store)
145
AO_int_store(&zz, 13);
147
MISSING(AO_int_store);
150
# if defined(AO_HAVE_int_load)
151
TA_assert(AO_int_load(&zz) == 13);
153
MISSING(AO_int_load);
155
# if defined(AO_HAVE_int_fetch_and_add)
156
TA_assert(AO_int_fetch_and_add(&zz, 42) == 13);
157
TA_assert(AO_int_fetch_and_add(&zz, -42) == 55);
159
MISSING(AO_int_fetch_and_add);
161
# if defined(AO_HAVE_int_fetch_and_add1)
162
TA_assert(AO_int_fetch_and_add1(&zz) == 13);
164
MISSING(AO_int_fetch_and_add1);
167
# if defined(AO_HAVE_int_fetch_and_sub1)
168
TA_assert(AO_int_fetch_and_sub1(&zz) == 14);
170
MISSING(AO_int_fetch_and_sub1);
173
# if defined(AO_HAVE_compare_and_swap)
174
TA_assert(!AO_compare_and_swap(&x, 14, 42));
176
TA_assert(AO_compare_and_swap(&x, 13, 42));
179
MISSING(AO_compare_and_swap);
181
# if defined(AO_HAVE_or)
188
# if defined(AO_HAVE_compare_double_and_swap_double)
189
TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13));
190
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
191
TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13));
192
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
193
TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42));
194
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
195
w.AO_val1 = 0; w.AO_val2 = 0;
197
MISSING(AO_compare_double_and_swap_double);
199
# if defined(AO_HAVE_compare_and_swap_double)
200
TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13));
201
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
202
TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13));
203
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
204
TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42));
205
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
207
MISSING(AO_compare_and_swap_double);
214
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
216
* This file is covered by the GNU general public license, version 2.
217
* see doc/COPYING for details.
220
/* Some basic sanity tests. These do not test the barrier semantics. */
223
#define TA_assert(e) \
224
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \
225
__FILE__, __LINE__), exit(1); }
228
#define MISSING(name) \
229
fprintf(stderr, "Missing: %s\n", #name "_release")
231
void test_atomic_release(void)
237
# if defined(AO_HAVE_test_and_set_release)
238
AO_TS_t z = AO_TS_INITIALIZER;
240
# if defined(AO_HAVE_double_t)
246
# if defined(AO_HAVE_nop_release)
251
# if defined(AO_HAVE_store_release)
252
AO_store_release(&x, 13);
258
# if defined(AO_HAVE_load_release)
259
TA_assert(AO_load_release(&x) == 13);
263
# if defined(AO_HAVE_test_and_set_release)
264
assert(AO_test_and_set_release(&z) == AO_TS_CLEAR);
265
assert(AO_test_and_set_release(&z) == AO_TS_SET);
266
assert(AO_test_and_set_release(&z) == AO_TS_SET);
269
MISSING(AO_test_and_set);
271
# if defined(AO_HAVE_fetch_and_add_release)
272
TA_assert(AO_fetch_and_add_release(&x, 42) == 13);
273
TA_assert(AO_fetch_and_add_release(&x, -42) == 55);
275
MISSING(AO_fetch_and_add);
277
# if defined(AO_HAVE_fetch_and_add1_release)
278
TA_assert(AO_fetch_and_add1_release(&x) == 13);
280
MISSING(AO_fetch_and_add1);
283
# if defined(AO_HAVE_fetch_and_sub1_release)
284
TA_assert(AO_fetch_and_sub1_release(&x) == 14);
286
MISSING(AO_fetch_and_sub1);
289
# if defined(AO_HAVE_short_store_release)
290
AO_short_store_release(&s, 13);
292
MISSING(AO_short_store);
295
# if defined(AO_HAVE_short_load_release)
296
TA_assert(AO_short_load(&s) == 13);
298
MISSING(AO_short_load);
300
# if defined(AO_HAVE_short_fetch_and_add_release)
301
TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13);
302
TA_assert(AO_short_fetch_and_add_release(&s, -42) == 55);
304
MISSING(AO_short_fetch_and_add);
306
# if defined(AO_HAVE_short_fetch_and_add1_release)
307
TA_assert(AO_short_fetch_and_add1_release(&s) == 13);
309
MISSING(AO_short_fetch_and_add1);
312
# if defined(AO_HAVE_short_fetch_and_sub1_release)
313
TA_assert(AO_short_fetch_and_sub1_release(&s) == 14);
315
MISSING(AO_short_fetch_and_sub1);
318
# if defined(AO_HAVE_char_store_release)
319
AO_char_store_release(&b, 13);
321
MISSING(AO_char_store);
324
# if defined(AO_HAVE_char_load_release)
325
TA_assert(AO_char_load(&b) == 13);
327
MISSING(AO_char_load);
329
# if defined(AO_HAVE_char_fetch_and_add_release)
330
TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13);
331
TA_assert(AO_char_fetch_and_add_release(&b, -42) == 55);
333
MISSING(AO_char_fetch_and_add);
335
# if defined(AO_HAVE_char_fetch_and_add1_release)
336
TA_assert(AO_char_fetch_and_add1_release(&b) == 13);
338
MISSING(AO_char_fetch_and_add1);
341
# if defined(AO_HAVE_char_fetch_and_sub1_release)
342
TA_assert(AO_char_fetch_and_sub1_release(&b) == 14);
344
MISSING(AO_char_fetch_and_sub1);
347
# if defined(AO_HAVE_int_store_release)
348
AO_int_store_release(&zz, 13);
350
MISSING(AO_int_store);
353
# if defined(AO_HAVE_int_load_release)
354
TA_assert(AO_int_load(&zz) == 13);
356
MISSING(AO_int_load);
358
# if defined(AO_HAVE_int_fetch_and_add_release)
359
TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13);
360
TA_assert(AO_int_fetch_and_add_release(&zz, -42) == 55);
362
MISSING(AO_int_fetch_and_add);
364
# if defined(AO_HAVE_int_fetch_and_add1_release)
365
TA_assert(AO_int_fetch_and_add1_release(&zz) == 13);
367
MISSING(AO_int_fetch_and_add1);
370
# if defined(AO_HAVE_int_fetch_and_sub1_release)
371
TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14);
373
MISSING(AO_int_fetch_and_sub1);
376
# if defined(AO_HAVE_compare_and_swap_release)
377
TA_assert(!AO_compare_and_swap_release(&x, 14, 42));
379
TA_assert(AO_compare_and_swap_release(&x, 13, 42));
382
MISSING(AO_compare_and_swap);
384
# if defined(AO_HAVE_or_release)
385
AO_or_release(&x, 66);
391
# if defined(AO_HAVE_compare_double_and_swap_double_release)
392
TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13));
393
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
394
TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13));
395
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
396
TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42));
397
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
398
w.AO_val1 = 0; w.AO_val2 = 0;
400
MISSING(AO_compare_double_and_swap_double);
402
# if defined(AO_HAVE_compare_and_swap_double_release)
403
TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13));
404
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
405
TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13));
406
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
407
TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42));
408
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
410
MISSING(AO_compare_and_swap_double);
417
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
419
* This file is covered by the GNU general public license, version 2.
420
* see doc/COPYING for details.
423
/* Some basic sanity tests. These do not test the barrier semantics. */
426
#define TA_assert(e) \
427
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \
428
__FILE__, __LINE__), exit(1); }
431
#define MISSING(name) \
432
fprintf(stderr, "Missing: %s\n", #name "_acquire")
434
void test_atomic_acquire(void)
440
# if defined(AO_HAVE_test_and_set_acquire)
441
AO_TS_t z = AO_TS_INITIALIZER;
443
# if defined(AO_HAVE_double_t)
449
# if defined(AO_HAVE_nop_acquire)
454
# if defined(AO_HAVE_store_acquire)
455
AO_store_acquire(&x, 13);
461
# if defined(AO_HAVE_load_acquire)
462
TA_assert(AO_load_acquire(&x) == 13);
466
# if defined(AO_HAVE_test_and_set_acquire)
467
assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR);
468
assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
469
assert(AO_test_and_set_acquire(&z) == AO_TS_SET);
472
MISSING(AO_test_and_set);
474
# if defined(AO_HAVE_fetch_and_add_acquire)
475
TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13);
476
TA_assert(AO_fetch_and_add_acquire(&x, -42) == 55);
478
MISSING(AO_fetch_and_add);
480
# if defined(AO_HAVE_fetch_and_add1_acquire)
481
TA_assert(AO_fetch_and_add1_acquire(&x) == 13);
483
MISSING(AO_fetch_and_add1);
486
# if defined(AO_HAVE_fetch_and_sub1_acquire)
487
TA_assert(AO_fetch_and_sub1_acquire(&x) == 14);
489
MISSING(AO_fetch_and_sub1);
492
# if defined(AO_HAVE_short_store_acquire)
493
AO_short_store_acquire(&s, 13);
495
MISSING(AO_short_store);
498
# if defined(AO_HAVE_short_load_acquire)
499
TA_assert(AO_short_load(&s) == 13);
501
MISSING(AO_short_load);
503
# if defined(AO_HAVE_short_fetch_and_add_acquire)
504
TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13);
505
TA_assert(AO_short_fetch_and_add_acquire(&s, -42) == 55);
507
MISSING(AO_short_fetch_and_add);
509
# if defined(AO_HAVE_short_fetch_and_add1_acquire)
510
TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13);
512
MISSING(AO_short_fetch_and_add1);
515
# if defined(AO_HAVE_short_fetch_and_sub1_acquire)
516
TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14);
518
MISSING(AO_short_fetch_and_sub1);
521
# if defined(AO_HAVE_char_store_acquire)
522
AO_char_store_acquire(&b, 13);
524
MISSING(AO_char_store);
527
# if defined(AO_HAVE_char_load_acquire)
528
TA_assert(AO_char_load(&b) == 13);
530
MISSING(AO_char_load);
532
# if defined(AO_HAVE_char_fetch_and_add_acquire)
533
TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13);
534
TA_assert(AO_char_fetch_and_add_acquire(&b, -42) == 55);
536
MISSING(AO_char_fetch_and_add);
538
# if defined(AO_HAVE_char_fetch_and_add1_acquire)
539
TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13);
541
MISSING(AO_char_fetch_and_add1);
544
# if defined(AO_HAVE_char_fetch_and_sub1_acquire)
545
TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14);
547
MISSING(AO_char_fetch_and_sub1);
550
# if defined(AO_HAVE_int_store_acquire)
551
AO_int_store_acquire(&zz, 13);
553
MISSING(AO_int_store);
556
# if defined(AO_HAVE_int_load_acquire)
557
TA_assert(AO_int_load(&zz) == 13);
559
MISSING(AO_int_load);
561
# if defined(AO_HAVE_int_fetch_and_add_acquire)
562
TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13);
563
TA_assert(AO_int_fetch_and_add_acquire(&zz, -42) == 55);
565
MISSING(AO_int_fetch_and_add);
567
# if defined(AO_HAVE_int_fetch_and_add1_acquire)
568
TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13);
570
MISSING(AO_int_fetch_and_add1);
573
# if defined(AO_HAVE_int_fetch_and_sub1_acquire)
574
TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14);
576
MISSING(AO_int_fetch_and_sub1);
579
# if defined(AO_HAVE_compare_and_swap_acquire)
580
TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42));
582
TA_assert(AO_compare_and_swap_acquire(&x, 13, 42));
585
MISSING(AO_compare_and_swap);
587
# if defined(AO_HAVE_or_acquire)
588
AO_or_acquire(&x, 66);
594
# if defined(AO_HAVE_compare_double_and_swap_double_acquire)
595
TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13));
596
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
597
TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13));
598
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
599
TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42));
600
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
601
w.AO_val1 = 0; w.AO_val2 = 0;
603
MISSING(AO_compare_double_and_swap_double);
605
# if defined(AO_HAVE_compare_and_swap_double_acquire)
606
TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13));
607
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
608
TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13));
609
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
610
TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42));
611
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
613
MISSING(AO_compare_and_swap_double);
620
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
622
* This file is covered by the GNU general public license, version 2.
623
* see doc/COPYING for details.
626
/* Some basic sanity tests. These do not test the barrier semantics. */
629
#define TA_assert(e) \
630
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \
631
__FILE__, __LINE__), exit(1); }
634
#define MISSING(name) \
635
fprintf(stderr, "Missing: %s\n", #name "_read")
637
void test_atomic_read(void)
643
# if defined(AO_HAVE_test_and_set_read)
644
AO_TS_t z = AO_TS_INITIALIZER;
646
# if defined(AO_HAVE_double_t)
652
# if defined(AO_HAVE_nop_read)
657
# if defined(AO_HAVE_store_read)
658
AO_store_read(&x, 13);
664
# if defined(AO_HAVE_load_read)
665
TA_assert(AO_load_read(&x) == 13);
669
# if defined(AO_HAVE_test_and_set_read)
670
assert(AO_test_and_set_read(&z) == AO_TS_CLEAR);
671
assert(AO_test_and_set_read(&z) == AO_TS_SET);
672
assert(AO_test_and_set_read(&z) == AO_TS_SET);
675
MISSING(AO_test_and_set);
677
# if defined(AO_HAVE_fetch_and_add_read)
678
TA_assert(AO_fetch_and_add_read(&x, 42) == 13);
679
TA_assert(AO_fetch_and_add_read(&x, -42) == 55);
681
MISSING(AO_fetch_and_add);
683
# if defined(AO_HAVE_fetch_and_add1_read)
684
TA_assert(AO_fetch_and_add1_read(&x) == 13);
686
MISSING(AO_fetch_and_add1);
689
# if defined(AO_HAVE_fetch_and_sub1_read)
690
TA_assert(AO_fetch_and_sub1_read(&x) == 14);
692
MISSING(AO_fetch_and_sub1);
695
# if defined(AO_HAVE_short_store_read)
696
AO_short_store_read(&s, 13);
698
MISSING(AO_short_store);
701
# if defined(AO_HAVE_short_load_read)
702
TA_assert(AO_short_load(&s) == 13);
704
MISSING(AO_short_load);
706
# if defined(AO_HAVE_short_fetch_and_add_read)
707
TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13);
708
TA_assert(AO_short_fetch_and_add_read(&s, -42) == 55);
710
MISSING(AO_short_fetch_and_add);
712
# if defined(AO_HAVE_short_fetch_and_add1_read)
713
TA_assert(AO_short_fetch_and_add1_read(&s) == 13);
715
MISSING(AO_short_fetch_and_add1);
718
# if defined(AO_HAVE_short_fetch_and_sub1_read)
719
TA_assert(AO_short_fetch_and_sub1_read(&s) == 14);
721
MISSING(AO_short_fetch_and_sub1);
724
# if defined(AO_HAVE_char_store_read)
725
AO_char_store_read(&b, 13);
727
MISSING(AO_char_store);
730
# if defined(AO_HAVE_char_load_read)
731
TA_assert(AO_char_load(&b) == 13);
733
MISSING(AO_char_load);
735
# if defined(AO_HAVE_char_fetch_and_add_read)
736
TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13);
737
TA_assert(AO_char_fetch_and_add_read(&b, -42) == 55);
739
MISSING(AO_char_fetch_and_add);
741
# if defined(AO_HAVE_char_fetch_and_add1_read)
742
TA_assert(AO_char_fetch_and_add1_read(&b) == 13);
744
MISSING(AO_char_fetch_and_add1);
747
# if defined(AO_HAVE_char_fetch_and_sub1_read)
748
TA_assert(AO_char_fetch_and_sub1_read(&b) == 14);
750
MISSING(AO_char_fetch_and_sub1);
753
# if defined(AO_HAVE_int_store_read)
754
AO_int_store_read(&zz, 13);
756
MISSING(AO_int_store);
759
# if defined(AO_HAVE_int_load_read)
760
TA_assert(AO_int_load(&zz) == 13);
762
MISSING(AO_int_load);
764
# if defined(AO_HAVE_int_fetch_and_add_read)
765
TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13);
766
TA_assert(AO_int_fetch_and_add_read(&zz, -42) == 55);
768
MISSING(AO_int_fetch_and_add);
770
# if defined(AO_HAVE_int_fetch_and_add1_read)
771
TA_assert(AO_int_fetch_and_add1_read(&zz) == 13);
773
MISSING(AO_int_fetch_and_add1);
776
# if defined(AO_HAVE_int_fetch_and_sub1_read)
777
TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14);
779
MISSING(AO_int_fetch_and_sub1);
782
# if defined(AO_HAVE_compare_and_swap_read)
783
TA_assert(!AO_compare_and_swap_read(&x, 14, 42));
785
TA_assert(AO_compare_and_swap_read(&x, 13, 42));
788
MISSING(AO_compare_and_swap);
790
# if defined(AO_HAVE_or_read)
797
# if defined(AO_HAVE_compare_double_and_swap_double_read)
798
TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13));
799
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
800
TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13));
801
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
802
TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42));
803
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
804
w.AO_val1 = 0; w.AO_val2 = 0;
806
MISSING(AO_compare_double_and_swap_double);
808
# if defined(AO_HAVE_compare_and_swap_double_read)
809
TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13));
810
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
811
TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13));
812
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
813
TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42));
814
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
816
MISSING(AO_compare_and_swap_double);
823
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
825
* This file is covered by the GNU general public license, version 2.
826
* see doc/COPYING for details.
829
/* Some basic sanity tests. These do not test the barrier semantics. */
832
#define TA_assert(e) \
833
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \
834
__FILE__, __LINE__), exit(1); }
837
#define MISSING(name) \
838
fprintf(stderr, "Missing: %s\n", #name "_write")
840
void test_atomic_write(void)
846
# if defined(AO_HAVE_test_and_set_write)
847
AO_TS_t z = AO_TS_INITIALIZER;
849
# if defined(AO_HAVE_double_t)
855
# if defined(AO_HAVE_nop_write)
860
# if defined(AO_HAVE_store_write)
861
AO_store_write(&x, 13);
867
# if defined(AO_HAVE_load_write)
868
TA_assert(AO_load_write(&x) == 13);
872
# if defined(AO_HAVE_test_and_set_write)
873
assert(AO_test_and_set_write(&z) == AO_TS_CLEAR);
874
assert(AO_test_and_set_write(&z) == AO_TS_SET);
875
assert(AO_test_and_set_write(&z) == AO_TS_SET);
878
MISSING(AO_test_and_set);
880
# if defined(AO_HAVE_fetch_and_add_write)
881
TA_assert(AO_fetch_and_add_write(&x, 42) == 13);
882
TA_assert(AO_fetch_and_add_write(&x, -42) == 55);
884
MISSING(AO_fetch_and_add);
886
# if defined(AO_HAVE_fetch_and_add1_write)
887
TA_assert(AO_fetch_and_add1_write(&x) == 13);
889
MISSING(AO_fetch_and_add1);
892
# if defined(AO_HAVE_fetch_and_sub1_write)
893
TA_assert(AO_fetch_and_sub1_write(&x) == 14);
895
MISSING(AO_fetch_and_sub1);
898
# if defined(AO_HAVE_short_store_write)
899
AO_short_store_write(&s, 13);
901
MISSING(AO_short_store);
904
# if defined(AO_HAVE_short_load_write)
905
TA_assert(AO_short_load(&s) == 13);
907
MISSING(AO_short_load);
909
# if defined(AO_HAVE_short_fetch_and_add_write)
910
TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13);
911
TA_assert(AO_short_fetch_and_add_write(&s, -42) == 55);
913
MISSING(AO_short_fetch_and_add);
915
# if defined(AO_HAVE_short_fetch_and_add1_write)
916
TA_assert(AO_short_fetch_and_add1_write(&s) == 13);
918
MISSING(AO_short_fetch_and_add1);
921
# if defined(AO_HAVE_short_fetch_and_sub1_write)
922
TA_assert(AO_short_fetch_and_sub1_write(&s) == 14);
924
MISSING(AO_short_fetch_and_sub1);
927
# if defined(AO_HAVE_char_store_write)
928
AO_char_store_write(&b, 13);
930
MISSING(AO_char_store);
933
# if defined(AO_HAVE_char_load_write)
934
TA_assert(AO_char_load(&b) == 13);
936
MISSING(AO_char_load);
938
# if defined(AO_HAVE_char_fetch_and_add_write)
939
TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13);
940
TA_assert(AO_char_fetch_and_add_write(&b, -42) == 55);
942
MISSING(AO_char_fetch_and_add);
944
# if defined(AO_HAVE_char_fetch_and_add1_write)
945
TA_assert(AO_char_fetch_and_add1_write(&b) == 13);
947
MISSING(AO_char_fetch_and_add1);
950
# if defined(AO_HAVE_char_fetch_and_sub1_write)
951
TA_assert(AO_char_fetch_and_sub1_write(&b) == 14);
953
MISSING(AO_char_fetch_and_sub1);
956
# if defined(AO_HAVE_int_store_write)
957
AO_int_store_write(&zz, 13);
959
MISSING(AO_int_store);
962
# if defined(AO_HAVE_int_load_write)
963
TA_assert(AO_int_load(&zz) == 13);
965
MISSING(AO_int_load);
967
# if defined(AO_HAVE_int_fetch_and_add_write)
968
TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13);
969
TA_assert(AO_int_fetch_and_add_write(&zz, -42) == 55);
971
MISSING(AO_int_fetch_and_add);
973
# if defined(AO_HAVE_int_fetch_and_add1_write)
974
TA_assert(AO_int_fetch_and_add1_write(&zz) == 13);
976
MISSING(AO_int_fetch_and_add1);
979
# if defined(AO_HAVE_int_fetch_and_sub1_write)
980
TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14);
982
MISSING(AO_int_fetch_and_sub1);
985
# if defined(AO_HAVE_compare_and_swap_write)
986
TA_assert(!AO_compare_and_swap_write(&x, 14, 42));
988
TA_assert(AO_compare_and_swap_write(&x, 13, 42));
991
MISSING(AO_compare_and_swap);
993
# if defined(AO_HAVE_or_write)
1000
# if defined(AO_HAVE_compare_double_and_swap_double_write)
1001
TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13));
1002
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1003
TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13));
1004
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1005
TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42));
1006
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1007
w.AO_val1 = 0; w.AO_val2 = 0;
1009
MISSING(AO_compare_double_and_swap_double);
1011
# if defined(AO_HAVE_compare_and_swap_double_write)
1012
TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13));
1013
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1014
TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13));
1015
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1016
TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42));
1017
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1019
MISSING(AO_compare_and_swap_double);
1026
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1028
* This file is covered by the GNU general public license, version 2.
1029
* see doc/COPYING for details.
1032
/* Some basic sanity tests. These do not test the barrier semantics. */
1035
#define TA_assert(e) \
1036
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \
1037
__FILE__, __LINE__), exit(1); }
1040
#define MISSING(name) \
1041
fprintf(stderr, "Missing: %s\n", #name "_full")
1043
void test_atomic_full(void)
1049
# if defined(AO_HAVE_test_and_set_full)
1050
AO_TS_t z = AO_TS_INITIALIZER;
1052
# if defined(AO_HAVE_double_t)
1058
# if defined(AO_HAVE_nop_full)
1063
# if defined(AO_HAVE_store_full)
1064
AO_store_full(&x, 13);
1065
TA_assert (x == 13);
1070
# if defined(AO_HAVE_load_full)
1071
TA_assert(AO_load_full(&x) == 13);
1075
# if defined(AO_HAVE_test_and_set_full)
1076
assert(AO_test_and_set_full(&z) == AO_TS_CLEAR);
1077
assert(AO_test_and_set_full(&z) == AO_TS_SET);
1078
assert(AO_test_and_set_full(&z) == AO_TS_SET);
1081
MISSING(AO_test_and_set);
1083
# if defined(AO_HAVE_fetch_and_add_full)
1084
TA_assert(AO_fetch_and_add_full(&x, 42) == 13);
1085
TA_assert(AO_fetch_and_add_full(&x, -42) == 55);
1087
MISSING(AO_fetch_and_add);
1089
# if defined(AO_HAVE_fetch_and_add1_full)
1090
TA_assert(AO_fetch_and_add1_full(&x) == 13);
1092
MISSING(AO_fetch_and_add1);
1095
# if defined(AO_HAVE_fetch_and_sub1_full)
1096
TA_assert(AO_fetch_and_sub1_full(&x) == 14);
1098
MISSING(AO_fetch_and_sub1);
1101
# if defined(AO_HAVE_short_store_full)
1102
AO_short_store_full(&s, 13);
1104
MISSING(AO_short_store);
1107
# if defined(AO_HAVE_short_load_full)
1108
TA_assert(AO_short_load(&s) == 13);
1110
MISSING(AO_short_load);
1112
# if defined(AO_HAVE_short_fetch_and_add_full)
1113
TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13);
1114
TA_assert(AO_short_fetch_and_add_full(&s, -42) == 55);
1116
MISSING(AO_short_fetch_and_add);
1118
# if defined(AO_HAVE_short_fetch_and_add1_full)
1119
TA_assert(AO_short_fetch_and_add1_full(&s) == 13);
1121
MISSING(AO_short_fetch_and_add1);
1124
# if defined(AO_HAVE_short_fetch_and_sub1_full)
1125
TA_assert(AO_short_fetch_and_sub1_full(&s) == 14);
1127
MISSING(AO_short_fetch_and_sub1);
1130
# if defined(AO_HAVE_char_store_full)
1131
AO_char_store_full(&b, 13);
1133
MISSING(AO_char_store);
1136
# if defined(AO_HAVE_char_load_full)
1137
TA_assert(AO_char_load(&b) == 13);
1139
MISSING(AO_char_load);
1141
# if defined(AO_HAVE_char_fetch_and_add_full)
1142
TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13);
1143
TA_assert(AO_char_fetch_and_add_full(&b, -42) == 55);
1145
MISSING(AO_char_fetch_and_add);
1147
# if defined(AO_HAVE_char_fetch_and_add1_full)
1148
TA_assert(AO_char_fetch_and_add1_full(&b) == 13);
1150
MISSING(AO_char_fetch_and_add1);
1153
# if defined(AO_HAVE_char_fetch_and_sub1_full)
1154
TA_assert(AO_char_fetch_and_sub1_full(&b) == 14);
1156
MISSING(AO_char_fetch_and_sub1);
1159
# if defined(AO_HAVE_int_store_full)
1160
AO_int_store_full(&zz, 13);
1162
MISSING(AO_int_store);
1165
# if defined(AO_HAVE_int_load_full)
1166
TA_assert(AO_int_load(&zz) == 13);
1168
MISSING(AO_int_load);
1170
# if defined(AO_HAVE_int_fetch_and_add_full)
1171
TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13);
1172
TA_assert(AO_int_fetch_and_add_full(&zz, -42) == 55);
1174
MISSING(AO_int_fetch_and_add);
1176
# if defined(AO_HAVE_int_fetch_and_add1_full)
1177
TA_assert(AO_int_fetch_and_add1_full(&zz) == 13);
1179
MISSING(AO_int_fetch_and_add1);
1182
# if defined(AO_HAVE_int_fetch_and_sub1_full)
1183
TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14);
1185
MISSING(AO_int_fetch_and_sub1);
1188
# if defined(AO_HAVE_compare_and_swap_full)
1189
TA_assert(!AO_compare_and_swap_full(&x, 14, 42));
1191
TA_assert(AO_compare_and_swap_full(&x, 13, 42));
1194
MISSING(AO_compare_and_swap);
1196
# if defined(AO_HAVE_or_full)
1198
TA_assert(x == 106);
1203
# if defined(AO_HAVE_compare_double_and_swap_double_full)
1204
TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13));
1205
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1206
TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13));
1207
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1208
TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42));
1209
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1210
w.AO_val1 = 0; w.AO_val2 = 0;
1212
MISSING(AO_compare_double_and_swap_double);
1214
# if defined(AO_HAVE_compare_and_swap_double_full)
1215
TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13));
1216
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1217
TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13));
1218
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1219
TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42));
1220
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1222
MISSING(AO_compare_and_swap_double);
1229
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1231
* This file is covered by the GNU general public license, version 2.
1232
* see doc/COPYING for details.
1235
/* Some basic sanity tests. These do not test the barrier semantics. */
1238
#define TA_assert(e) \
1239
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \
1240
__FILE__, __LINE__), exit(1); }
1243
#define MISSING(name) \
1244
fprintf(stderr, "Missing: %s\n", #name "_release_write")
1246
void test_atomic_release_write(void)
1252
# if defined(AO_HAVE_test_and_set_release_write)
1253
AO_TS_t z = AO_TS_INITIALIZER;
1255
# if defined(AO_HAVE_double_t)
1261
# if defined(AO_HAVE_nop_release_write)
1262
AO_nop_release_write();
1266
# if defined(AO_HAVE_store_release_write)
1267
AO_store_release_write(&x, 13);
1268
TA_assert (x == 13);
1273
# if defined(AO_HAVE_load_release_write)
1274
TA_assert(AO_load_release_write(&x) == 13);
1278
# if defined(AO_HAVE_test_and_set_release_write)
1279
assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR);
1280
assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1281
assert(AO_test_and_set_release_write(&z) == AO_TS_SET);
1284
MISSING(AO_test_and_set);
1286
# if defined(AO_HAVE_fetch_and_add_release_write)
1287
TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13);
1288
TA_assert(AO_fetch_and_add_release_write(&x, -42) == 55);
1290
MISSING(AO_fetch_and_add);
1292
# if defined(AO_HAVE_fetch_and_add1_release_write)
1293
TA_assert(AO_fetch_and_add1_release_write(&x) == 13);
1295
MISSING(AO_fetch_and_add1);
1298
# if defined(AO_HAVE_fetch_and_sub1_release_write)
1299
TA_assert(AO_fetch_and_sub1_release_write(&x) == 14);
1301
MISSING(AO_fetch_and_sub1);
1304
# if defined(AO_HAVE_short_store_release_write)
1305
AO_short_store_release_write(&s, 13);
1307
MISSING(AO_short_store);
1310
# if defined(AO_HAVE_short_load_release_write)
1311
TA_assert(AO_short_load(&s) == 13);
1313
MISSING(AO_short_load);
1315
# if defined(AO_HAVE_short_fetch_and_add_release_write)
1316
TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13);
1317
TA_assert(AO_short_fetch_and_add_release_write(&s, -42) == 55);
1319
MISSING(AO_short_fetch_and_add);
1321
# if defined(AO_HAVE_short_fetch_and_add1_release_write)
1322
TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13);
1324
MISSING(AO_short_fetch_and_add1);
1327
# if defined(AO_HAVE_short_fetch_and_sub1_release_write)
1328
TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14);
1330
MISSING(AO_short_fetch_and_sub1);
1333
# if defined(AO_HAVE_char_store_release_write)
1334
AO_char_store_release_write(&b, 13);
1336
MISSING(AO_char_store);
1339
# if defined(AO_HAVE_char_load_release_write)
1340
TA_assert(AO_char_load(&b) == 13);
1342
MISSING(AO_char_load);
1344
# if defined(AO_HAVE_char_fetch_and_add_release_write)
1345
TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13);
1346
TA_assert(AO_char_fetch_and_add_release_write(&b, -42) == 55);
1348
MISSING(AO_char_fetch_and_add);
1350
# if defined(AO_HAVE_char_fetch_and_add1_release_write)
1351
TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13);
1353
MISSING(AO_char_fetch_and_add1);
1356
# if defined(AO_HAVE_char_fetch_and_sub1_release_write)
1357
TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14);
1359
MISSING(AO_char_fetch_and_sub1);
1362
# if defined(AO_HAVE_int_store_release_write)
1363
AO_int_store_release_write(&zz, 13);
1365
MISSING(AO_int_store);
1368
# if defined(AO_HAVE_int_load_release_write)
1369
TA_assert(AO_int_load(&zz) == 13);
1371
MISSING(AO_int_load);
1373
# if defined(AO_HAVE_int_fetch_and_add_release_write)
1374
TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13);
1375
TA_assert(AO_int_fetch_and_add_release_write(&zz, -42) == 55);
1377
MISSING(AO_int_fetch_and_add);
1379
# if defined(AO_HAVE_int_fetch_and_add1_release_write)
1380
TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13);
1382
MISSING(AO_int_fetch_and_add1);
1385
# if defined(AO_HAVE_int_fetch_and_sub1_release_write)
1386
TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14);
1388
MISSING(AO_int_fetch_and_sub1);
1391
# if defined(AO_HAVE_compare_and_swap_release_write)
1392
TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42));
1394
TA_assert(AO_compare_and_swap_release_write(&x, 13, 42));
1397
MISSING(AO_compare_and_swap);
1399
# if defined(AO_HAVE_or_release_write)
1400
AO_or_release_write(&x, 66);
1401
TA_assert(x == 106);
1406
# if defined(AO_HAVE_compare_double_and_swap_double_release_write)
1407
TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13));
1408
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1409
TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13));
1410
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1411
TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42));
1412
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1413
w.AO_val1 = 0; w.AO_val2 = 0;
1415
MISSING(AO_compare_double_and_swap_double);
1417
# if defined(AO_HAVE_compare_and_swap_double_release_write)
1418
TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13));
1419
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1420
TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13));
1421
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1422
TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42));
1423
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1425
MISSING(AO_compare_and_swap_double);
1432
* Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved.
1434
* This file is covered by the GNU general public license, version 2.
1435
* see doc/COPYING for details.
1438
/* Some basic sanity tests. These do not test the barrier semantics. */
1441
#define TA_assert(e) \
1442
if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \
1443
__FILE__, __LINE__), exit(1); }
1446
#define MISSING(name) \
1447
fprintf(stderr, "Missing: %s\n", #name "_acquire_read")
1449
void test_atomic_acquire_read(void)
1455
# if defined(AO_HAVE_test_and_set_acquire_read)
1456
AO_TS_t z = AO_TS_INITIALIZER;
1458
# if defined(AO_HAVE_double_t)
1464
# if defined(AO_HAVE_nop_acquire_read)
1465
AO_nop_acquire_read();
1469
# if defined(AO_HAVE_store_acquire_read)
1470
AO_store_acquire_read(&x, 13);
1471
TA_assert (x == 13);
1476
# if defined(AO_HAVE_load_acquire_read)
1477
TA_assert(AO_load_acquire_read(&x) == 13);
1481
# if defined(AO_HAVE_test_and_set_acquire_read)
1482
assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR);
1483
assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1484
assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET);
1487
MISSING(AO_test_and_set);
1489
# if defined(AO_HAVE_fetch_and_add_acquire_read)
1490
TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13);
1491
TA_assert(AO_fetch_and_add_acquire_read(&x, -42) == 55);
1493
MISSING(AO_fetch_and_add);
1495
# if defined(AO_HAVE_fetch_and_add1_acquire_read)
1496
TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13);
1498
MISSING(AO_fetch_and_add1);
1501
# if defined(AO_HAVE_fetch_and_sub1_acquire_read)
1502
TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14);
1504
MISSING(AO_fetch_and_sub1);
1507
# if defined(AO_HAVE_short_store_acquire_read)
1508
AO_short_store_acquire_read(&s, 13);
1510
MISSING(AO_short_store);
1513
# if defined(AO_HAVE_short_load_acquire_read)
1514
TA_assert(AO_short_load(&s) == 13);
1516
MISSING(AO_short_load);
1518
# if defined(AO_HAVE_short_fetch_and_add_acquire_read)
1519
TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13);
1520
TA_assert(AO_short_fetch_and_add_acquire_read(&s, -42) == 55);
1522
MISSING(AO_short_fetch_and_add);
1524
# if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
1525
TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13);
1527
MISSING(AO_short_fetch_and_add1);
1530
# if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
1531
TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14);
1533
MISSING(AO_short_fetch_and_sub1);
1536
# if defined(AO_HAVE_char_store_acquire_read)
1537
AO_char_store_acquire_read(&b, 13);
1539
MISSING(AO_char_store);
1542
# if defined(AO_HAVE_char_load_acquire_read)
1543
TA_assert(AO_char_load(&b) == 13);
1545
MISSING(AO_char_load);
1547
# if defined(AO_HAVE_char_fetch_and_add_acquire_read)
1548
TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13);
1549
TA_assert(AO_char_fetch_and_add_acquire_read(&b, -42) == 55);
1551
MISSING(AO_char_fetch_and_add);
1553
# if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
1554
TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13);
1556
MISSING(AO_char_fetch_and_add1);
1559
# if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
1560
TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14);
1562
MISSING(AO_char_fetch_and_sub1);
1565
# if defined(AO_HAVE_int_store_acquire_read)
1566
AO_int_store_acquire_read(&zz, 13);
1568
MISSING(AO_int_store);
1571
# if defined(AO_HAVE_int_load_acquire_read)
1572
TA_assert(AO_int_load(&zz) == 13);
1574
MISSING(AO_int_load);
1576
# if defined(AO_HAVE_int_fetch_and_add_acquire_read)
1577
TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13);
1578
TA_assert(AO_int_fetch_and_add_acquire_read(&zz, -42) == 55);
1580
MISSING(AO_int_fetch_and_add);
1582
# if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
1583
TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13);
1585
MISSING(AO_int_fetch_and_add1);
1588
# if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
1589
TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14);
1591
MISSING(AO_int_fetch_and_sub1);
1594
# if defined(AO_HAVE_compare_and_swap_acquire_read)
1595
TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42));
1597
TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42));
1600
MISSING(AO_compare_and_swap);
1602
# if defined(AO_HAVE_or_acquire_read)
1603
AO_or_acquire_read(&x, 66);
1604
TA_assert(x == 106);
1609
# if defined(AO_HAVE_compare_double_and_swap_double_acquire_read)
1610
TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13));
1611
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1612
TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13));
1613
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1614
TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42));
1615
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1616
w.AO_val1 = 0; w.AO_val2 = 0;
1618
MISSING(AO_compare_double_and_swap_double);
1620
# if defined(AO_HAVE_compare_and_swap_double_acquire_read)
1621
TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13));
1622
TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0);
1623
TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13));
1624
TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13);
1625
TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42));
1626
TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42);
1628
MISSING(AO_compare_and_swap_double);