~ubuntu-branches/ubuntu/quantal/libgc/quantal

« back to all changes in this revision

Viewing changes to libatomic_ops-1.2/src/atomic_ops/generalize-small.h

  • Committer: Bazaar Package Importer
  • Author(s): Christoph Egger
  • Date: 2011-02-19 12:19:56 UTC
  • mfrom: (1.3.2 upstream) (0.1.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 14.
  • Revision ID: james.westby@ubuntu.com-20110219121956-67rb69xlt5nud3v2
Tags: 1:7.1-5
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* char_load */
 
2
#if defined(AO_HAVE_char_load_acquire) && !defined(AO_HAVE_char_load)
 
3
#  define AO_char_load(addr) AO_char_load_acquire(addr)
 
4
#  define AO_HAVE_char_load
 
5
#endif
 
6
 
 
7
#if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_acquire)
 
8
#  define AO_char_load_acquire(addr) AO_char_load_full(addr)
 
9
#  define AO_HAVE_char_load_acquire
 
10
#endif
 
11
 
 
12
#if defined(AO_HAVE_char_load_full) && !defined(AO_HAVE_char_load_read)
 
13
#  define AO_char_load_read(addr) AO_char_load_full(addr)
 
14
#  define AO_HAVE_char_load_read
 
15
#endif
 
16
 
 
17
#if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_acquire)
 
18
#  define AO_char_load_acquire_read(addr) AO_char_load_acquire(addr)
 
19
#  define AO_HAVE_char_load_acquire_read
 
20
#endif
 
21
 
 
22
#if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_full) && \
 
23
    !defined(AO_HAVE_char_load_acquire)
 
24
   AO_INLINE unsigned char
 
25
   AO_char_load_acquire(volatile unsigned char *addr)
 
26
   {
 
27
     unsigned char result = AO_char_load(addr);
 
28
     /* Acquire barrier would be useless, since the load could be delayed  */
 
29
     /* beyond it.                                                         */
 
30
     AO_nop_full();
 
31
     return result;
 
32
   }
 
33
#  define AO_HAVE_char_load_acquire
 
34
#endif
 
35
 
 
36
#if defined(AO_HAVE_char_load) && defined(AO_HAVE_nop_read) && \
 
37
    !defined(AO_HAVE_char_load_read)
 
38
   AO_INLINE unsigned char
 
39
   AO_char_load_read(volatile unsigned char *addr)
 
40
   {
 
41
     unsigned char result = AO_char_load(addr);
 
42
     /* Acquire barrier would be useless, since the load could be delayed  */
 
43
     /* beyond it.                                                         */
 
44
     AO_nop_read();
 
45
     return result;
 
46
   }
 
47
#  define AO_HAVE_char_load_read
 
48
#endif
 
49
 
 
50
#if defined(AO_HAVE_char_load_acquire) && defined(AO_HAVE_nop_full) && \
 
51
    !defined(AO_HAVE_char_load_full)
 
52
#  define AO_char_load_full(addr) (AO_nop_full(), AO_char_load_acquire(addr))
 
53
#  define AO_HAVE_char_load_full
 
54
#endif
 
55
 
 
56
#if !defined(AO_HAVE_char_load_acquire_read) && defined(AO_HAVE_char_load_read)
 
57
#  define AO_char_load_acquire_read(addr) AO_char_load_read(addr)
 
58
#  define AO_HAVE_char_load_acquire_read
 
59
#endif
 
60
 
 
61
#if defined(AO_HAVE_char_load_acquire_read) && !defined(AO_HAVE_char_load)
 
62
#  define AO_char_load(addr) AO_char_load_acquire_read(addr)
 
63
#  define AO_HAVE_char_load
 
64
#endif
 
65
 
 
66
#ifdef AO_NO_DD_ORDERING
 
67
#  if defined(AO_HAVE_char_load_acquire_read)
 
68
#    define AO_char_load_dd_acquire_read(addr) \
 
69
        AO_char_load_acquire_read(addr)
 
70
#    define AO_HAVE_char_load_dd_acquire_read
 
71
#  endif
 
72
#else
 
73
#  if defined(AO_HAVE_char_load)
 
74
#    define AO_char_load_dd_acquire_read(addr) \
 
75
        AO_char_load(addr)
 
76
#    define AO_HAVE_char_load_dd_acquire_read
 
77
#  endif
 
78
#endif
 
79
 
 
80
 
 
81
/* char_store */
 
82
 
 
83
#if defined(AO_HAVE_char_store_release) && !defined(AO_HAVE_char_store)
 
84
#  define AO_char_store(addr, val) AO_char_store_release(addr,val)
 
85
#  define AO_HAVE_char_store
 
86
#endif
 
87
 
 
88
#if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_release)
 
89
#  define AO_char_store_release(addr,val) AO_char_store_full(addr,val)
 
90
#  define AO_HAVE_char_store_release
 
91
#endif
 
92
 
 
93
#if defined(AO_HAVE_char_store_full) && !defined(AO_HAVE_char_store_write)
 
94
#  define AO_char_store_write(addr,val) AO_char_store_full(addr,val)
 
95
#  define AO_HAVE_char_store_write
 
96
#endif
 
97
 
 
98
#if defined(AO_HAVE_char_store_release) && \
 
99
        !defined(AO_HAVE_char_store_release_write)
 
100
#  define AO_char_store_release_write(addr, val) \
 
101
        AO_char_store_release(addr,val)
 
102
#  define AO_HAVE_char_store_release_write
 
103
#endif
 
104
 
 
105
#if defined(AO_HAVE_char_store_write) && !defined(AO_HAVE_char_store)
 
106
#  define AO_char_store(addr, val) AO_char_store_write(addr,val)
 
107
#  define AO_HAVE_char_store
 
108
#endif
 
109
 
 
110
#if defined(AO_HAVE_char_store) && defined(AO_HAVE_nop_full) && \
 
111
    !defined(AO_HAVE_char_store_release)
 
112
#  define AO_char_store_release(addr,val) \
 
113
        (AO_nop_full(), AO_char_store(addr,val))
 
114
#  define AO_HAVE_char_store_release
 
115
#endif
 
116
 
 
117
#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_char_store) && \
 
118
     !defined(AO_HAVE_char_store_write)
 
119
#  define AO_char_store_write(addr, val) \
 
120
        (AO_nop_write(), AO_char_store(addr,val))
 
121
#  define AO_HAVE_char_store_write
 
122
#endif
 
123
 
 
124
#if defined(AO_HAVE_char_store_write) && \
 
125
     !defined(AO_HAVE_char_store_release_write)
 
126
#  define AO_char_store_release_write(addr, val) AO_char_store_write(addr,val)
 
127
#  define AO_HAVE_char_store_release_write
 
128
#endif
 
129
 
 
130
#if defined(AO_HAVE_char_store_release) && defined(AO_HAVE_nop_full) && \
 
131
    !defined(AO_HAVE_char_store_full)
 
132
#  define AO_char_store_full(addr, val) \
 
133
        (AO_char_store_release(addr, val), AO_nop_full())
 
134
#  define AO_HAVE_char_store_full
 
135
#endif
 
136
 
 
137
 
 
138
/* char_fetch_and_add */
 
139
#if defined(AO_HAVE_char_compare_and_swap_full) && \
 
140
    !defined(AO_HAVE_char_fetch_and_add_full)
 
141
   AO_INLINE AO_t
 
142
   AO_char_fetch_and_add_full(volatile unsigned char *addr,
 
143
                               unsigned char incr)
 
144
   {
 
145
     unsigned char old;
 
146
     do
 
147
       {
 
148
         old = *addr;
 
149
       }
 
150
     while (!AO_char_compare_and_swap_full(addr, old, old+incr));
 
151
     return old;
 
152
   }
 
153
#  define AO_HAVE_char_fetch_and_add_full
 
154
#endif
 
155
 
 
156
#if defined(AO_HAVE_char_compare_and_swap_acquire) && \
 
157
    !defined(AO_HAVE_char_fetch_and_add_acquire)
 
158
   AO_INLINE AO_t
 
159
   AO_char_fetch_and_add_acquire(volatile unsigned char *addr,
 
160
                                  unsigned char incr)
 
161
   {
 
162
     unsigned char old;
 
163
     do
 
164
       {
 
165
         old = *addr;
 
166
       }
 
167
     while (!AO_char_compare_and_swap_acquire(addr, old, old+incr));
 
168
     return old;
 
169
   }
 
170
#  define AO_HAVE_char_fetch_and_add_acquire
 
171
#endif
 
172
 
 
173
#if defined(AO_HAVE_char_compare_and_swap_release) && \
 
174
    !defined(AO_HAVE_char_fetch_and_add_release)
 
175
   AO_INLINE AO_t
 
176
   AO_char_fetch_and_add_release(volatile unsigned char *addr,
 
177
                                  unsigned char incr)
 
178
   {
 
179
     unsigned char old;
 
180
     do
 
181
       {
 
182
         old = *addr;
 
183
       }
 
184
     while (!AO_char_compare_and_swap_release(addr, old, old+incr));
 
185
     return old;
 
186
   }
 
187
#  define AO_HAVE_char_fetch_and_add_release
 
188
#endif
 
189
 
 
190
#if defined(AO_HAVE_char_fetch_and_add_full)
 
191
#  if !defined(AO_HAVE_char_fetch_and_add_release)
 
192
#    define AO_char_fetch_and_add_release(addr, val) \
 
193
         AO_char_fetch_and_add_full(addr, val)
 
194
#    define AO_HAVE_char_fetch_and_add_release
 
195
#  endif
 
196
#  if !defined(AO_HAVE_char_fetch_and_add_acquire)
 
197
#    define AO_char_fetch_and_add_acquire(addr, val) \
 
198
         AO_char_fetch_and_add_full(addr, val)
 
199
#    define AO_HAVE_char_fetch_and_add_acquire
 
200
#  endif
 
201
#  if !defined(AO_HAVE_char_fetch_and_add_write)
 
202
#    define AO_char_fetch_and_add_write(addr, val) \
 
203
         AO_char_fetch_and_add_full(addr, val)
 
204
#    define AO_HAVE_char_fetch_and_add_write
 
205
#  endif
 
206
#  if !defined(AO_HAVE_char_fetch_and_add_read)
 
207
#    define AO_char_fetch_and_add_read(addr, val) \
 
208
         AO_char_fetch_and_add_full(addr, val)
 
209
#    define AO_HAVE_char_fetch_and_add_read
 
210
#  endif
 
211
#endif /* AO_HAVE_char_fetch_and_add_full */
 
212
 
 
213
#if !defined(AO_HAVE_char_fetch_and_add) && \
 
214
    defined(AO_HAVE_char_fetch_and_add_release)
 
215
#  define AO_char_fetch_and_add(addr, val) \
 
216
        AO_char_fetch_and_add_release(addr, val)
 
217
#  define AO_HAVE_char_fetch_and_add
 
218
#endif
 
219
#if !defined(AO_HAVE_char_fetch_and_add) && \
 
220
    defined(AO_HAVE_char_fetch_and_add_acquire)
 
221
#  define AO_char_fetch_and_add(addr, val) \
 
222
        AO_char_fetch_and_add_acquire(addr, val)
 
223
#  define AO_HAVE_char_fetch_and_add
 
224
#endif
 
225
#if !defined(AO_HAVE_char_fetch_and_add) && \
 
226
    defined(AO_HAVE_char_fetch_and_add_write)
 
227
#  define AO_char_fetch_and_add(addr, val) \
 
228
        AO_char_fetch_and_add_write(addr, val)
 
229
#  define AO_HAVE_char_fetch_and_add
 
230
#endif
 
231
#if !defined(AO_HAVE_char_fetch_and_add) && \
 
232
    defined(AO_HAVE_char_fetch_and_add_read)
 
233
#  define AO_char_fetch_and_add(addr, val) \
 
234
        AO_char_fetch_and_add_read(addr, val)
 
235
#  define AO_HAVE_char_fetch_and_add
 
236
#endif
 
237
 
 
238
#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
 
239
    defined(AO_HAVE_nop_full) && \
 
240
    !defined(AO_HAVE_char_fetch_and_add_full)
 
241
#  define AO_char_fetch_and_add_full(addr, val) \
 
242
        (AO_nop_full(), AO_char_fetch_and_add_acquire(addr, val))
 
243
#endif
 
244
 
 
245
#if !defined(AO_HAVE_char_fetch_and_add_release_write) && \
 
246
    defined(AO_HAVE_char_fetch_and_add_write)
 
247
#  define AO_char_fetch_and_add_release_write(addr, val) \
 
248
        AO_char_fetch_and_add_write(addr, val)
 
249
#  define AO_HAVE_char_fetch_and_add_release_write
 
250
#endif
 
251
#if !defined(AO_HAVE_char_fetch_and_add_release_write) && \
 
252
    defined(AO_HAVE_char_fetch_and_add_release)
 
253
#  define AO_char_fetch_and_add_release_write(addr, val) \
 
254
        AO_char_fetch_and_add_release(addr, val)
 
255
#  define AO_HAVE_char_fetch_and_add_release_write
 
256
#endif
 
257
#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \
 
258
    defined(AO_HAVE_char_fetch_and_add_read)
 
259
#  define AO_char_fetch_and_add_acquire_read(addr, val) \
 
260
        AO_char_fetch_and_add_read(addr, val)
 
261
#  define AO_HAVE_char_fetch_and_add_acquire_read
 
262
#endif
 
263
#if !defined(AO_HAVE_char_fetch_and_add_acquire_read) && \
 
264
    defined(AO_HAVE_char_fetch_and_add_acquire)
 
265
#  define AO_char_fetch_and_add_acquire_read(addr, val) \
 
266
        AO_char_fetch_and_add_acquire(addr, val)
 
267
#  define AO_HAVE_char_fetch_and_add_acquire_read
 
268
#endif
 
269
 
 
270
#ifdef AO_NO_DD_ORDERING
 
271
#  if defined(AO_HAVE_char_fetch_and_add_acquire_read)
 
272
#    define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
 
273
        AO_char_fetch_and_add_acquire_read(addr, val)
 
274
#    define AO_HAVE_char_fetch_and_add_dd_acquire_read
 
275
#  endif
 
276
#else
 
277
#  if defined(AO_HAVE_char_fetch_and_add)
 
278
#    define AO_char_fetch_and_add_dd_acquire_read(addr, val) \
 
279
        AO_char_fetch_and_add(addr, val)
 
280
#    define AO_HAVE_char_fetch_and_add_dd_acquire_read
 
281
#  endif
 
282
#endif
 
283
  
 
284
/* char_fetch_and_add1 */
 
285
 
 
286
#if defined(AO_HAVE_char_fetch_and_add_full) &&\
 
287
    !defined(AO_HAVE_char_fetch_and_add1_full)
 
288
#  define AO_char_fetch_and_add1_full(addr) \
 
289
        AO_char_fetch_and_add_full(addr,1)
 
290
#  define AO_HAVE_char_fetch_and_add1_full
 
291
#endif
 
292
#if defined(AO_HAVE_char_fetch_and_add_release) &&\
 
293
    !defined(AO_HAVE_char_fetch_and_add1_release)
 
294
#  define AO_char_fetch_and_add1_release(addr) \
 
295
        AO_char_fetch_and_add_release(addr,1)
 
296
#  define AO_HAVE_char_fetch_and_add1_release
 
297
#endif
 
298
#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
 
299
    !defined(AO_HAVE_char_fetch_and_add1_acquire)
 
300
#  define AO_char_fetch_and_add1_acquire(addr) \
 
301
        AO_char_fetch_and_add_acquire(addr,1)
 
302
#  define AO_HAVE_char_fetch_and_add1_acquire
 
303
#endif
 
304
#if defined(AO_HAVE_char_fetch_and_add_write) &&\
 
305
    !defined(AO_HAVE_char_fetch_and_add1_write)
 
306
#  define AO_char_fetch_and_add1_write(addr) \
 
307
        AO_char_fetch_and_add_write(addr,1)
 
308
#  define AO_HAVE_char_fetch_and_add1_write
 
309
#endif
 
310
#if defined(AO_HAVE_char_fetch_and_add_read) &&\
 
311
    !defined(AO_HAVE_char_fetch_and_add1_read)
 
312
#  define AO_char_fetch_and_add1_read(addr) \
 
313
        AO_char_fetch_and_add_read(addr,1)
 
314
#  define AO_HAVE_char_fetch_and_add1_read
 
315
#endif
 
316
#if defined(AO_HAVE_char_fetch_and_add_release_write) &&\
 
317
    !defined(AO_HAVE_char_fetch_and_add1_release_write)
 
318
#  define AO_char_fetch_and_add1_release_write(addr) \
 
319
        AO_char_fetch_and_add_release_write(addr,1)
 
320
#  define AO_HAVE_char_fetch_and_add1_release_write
 
321
#endif
 
322
#if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\
 
323
    !defined(AO_HAVE_char_fetch_and_add1_acquire_read)
 
324
#  define AO_char_fetch_and_add1_acquire_read(addr) \
 
325
        AO_char_fetch_and_add_acquire_read(addr,1)
 
326
#  define AO_HAVE_char_fetch_and_add1_acquire_read
 
327
#endif
 
328
#if defined(AO_HAVE_char_fetch_and_add) &&\
 
329
    !defined(AO_HAVE_char_fetch_and_add1)
 
330
#  define AO_char_fetch_and_add1(addr) \
 
331
        AO_char_fetch_and_add(addr,1)
 
332
#  define AO_HAVE_char_fetch_and_add1
 
333
#endif
 
334
 
 
335
#if defined(AO_HAVE_char_fetch_and_add1_full)
 
336
#  if !defined(AO_HAVE_char_fetch_and_add1_release)
 
337
#    define AO_char_fetch_and_add1_release(addr) \
 
338
         AO_char_fetch_and_add1_full(addr)
 
339
#    define AO_HAVE_char_fetch_and_add1_release
 
340
#  endif
 
341
#  if !defined(AO_HAVE_char_fetch_and_add1_acquire)
 
342
#    define AO_char_fetch_and_add1_acquire(addr) \
 
343
         AO_char_fetch_and_add1_full(addr)
 
344
#    define AO_HAVE_char_fetch_and_add1_acquire
 
345
#  endif
 
346
#  if !defined(AO_HAVE_char_fetch_and_add1_write)
 
347
#    define AO_char_fetch_and_add1_write(addr) \
 
348
         AO_char_fetch_and_add1_full(addr)
 
349
#    define AO_HAVE_char_fetch_and_add1_write
 
350
#  endif
 
351
#  if !defined(AO_HAVE_char_fetch_and_add1_read)
 
352
#    define AO_char_fetch_and_add1_read(addr) \
 
353
         AO_char_fetch_and_add1_full(addr)
 
354
#    define AO_HAVE_char_fetch_and_add1_read
 
355
#  endif
 
356
#endif /* AO_HAVE_char_fetch_and_add1_full */
 
357
 
 
358
#if !defined(AO_HAVE_char_fetch_and_add1) && \
 
359
    defined(AO_HAVE_char_fetch_and_add1_release)
 
360
#  define AO_char_fetch_and_add1(addr) \
 
361
        AO_char_fetch_and_add1_release(addr)
 
362
#  define AO_HAVE_char_fetch_and_add1
 
363
#endif
 
364
#if !defined(AO_HAVE_char_fetch_and_add1) && \
 
365
    defined(AO_HAVE_char_fetch_and_add1_acquire)
 
366
#  define AO_char_fetch_and_add1(addr) \
 
367
        AO_char_fetch_and_add1_acquire(addr)
 
368
#  define AO_HAVE_char_fetch_and_add1
 
369
#endif
 
370
#if !defined(AO_HAVE_char_fetch_and_add1) && \
 
371
    defined(AO_HAVE_char_fetch_and_add1_write)
 
372
#  define AO_char_fetch_and_add1(addr) \
 
373
        AO_char_fetch_and_add1_write(addr)
 
374
#  define AO_HAVE_char_fetch_and_add1
 
375
#endif
 
376
#if !defined(AO_HAVE_char_fetch_and_add1) && \
 
377
    defined(AO_HAVE_char_fetch_and_add1_read)
 
378
#  define AO_char_fetch_and_add1(addr) \
 
379
        AO_char_fetch_and_add1_read(addr)
 
380
#  define AO_HAVE_char_fetch_and_add1
 
381
#endif
 
382
 
 
383
#if defined(AO_HAVE_char_fetch_and_add1_acquire) &&\
 
384
    defined(AO_HAVE_nop_full) && \
 
385
    !defined(AO_HAVE_char_fetch_and_add1_full)
 
386
#  define AO_char_fetch_and_add1_full(addr) \
 
387
        (AO_nop_full(), AO_char_fetch_and_add1_acquire(addr))
 
388
#  define AO_HAVE_char_fetch_and_add1_full
 
389
#endif
 
390
 
 
391
#if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \
 
392
    defined(AO_HAVE_char_fetch_and_add1_write)
 
393
#  define AO_char_fetch_and_add1_release_write(addr) \
 
394
        AO_char_fetch_and_add1_write(addr)
 
395
#  define AO_HAVE_char_fetch_and_add1_release_write
 
396
#endif
 
397
#if !defined(AO_HAVE_char_fetch_and_add1_release_write) && \
 
398
    defined(AO_HAVE_char_fetch_and_add1_release)
 
399
#  define AO_char_fetch_and_add1_release_write(addr) \
 
400
        AO_char_fetch_and_add1_release(addr)
 
401
#  define AO_HAVE_char_fetch_and_add1_release_write
 
402
#endif
 
403
#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \
 
404
    defined(AO_HAVE_char_fetch_and_add1_read)
 
405
#  define AO_char_fetch_and_add1_acquire_read(addr) \
 
406
        AO_char_fetch_and_add1_read(addr)
 
407
#  define AO_HAVE_char_fetch_and_add1_acquire_read
 
408
#endif
 
409
#if !defined(AO_HAVE_char_fetch_and_add1_acquire_read) && \
 
410
    defined(AO_HAVE_char_fetch_and_add1_acquire)
 
411
#  define AO_char_fetch_and_add1_acquire_read(addr) \
 
412
        AO_char_fetch_and_add1_acquire(addr)
 
413
#  define AO_HAVE_char_fetch_and_add1_acquire_read
 
414
#endif
 
415
 
 
416
#ifdef AO_NO_DD_ORDERING
 
417
#  if defined(AO_HAVE_char_fetch_and_add1_acquire_read)
 
418
#    define AO_char_fetch_and_add1_dd_acquire_read(addr) \
 
419
        AO_char_fetch_and_add1_acquire_read(addr)
 
420
#    define AO_HAVE_char_fetch_and_add1_dd_acquire_read
 
421
#  endif
 
422
#else
 
423
#  if defined(AO_HAVE_char_fetch_and_add1)
 
424
#    define AO_char_fetch_and_add1_dd_acquire_read(addr) \
 
425
        AO_char_fetch_and_add1(addr)
 
426
#    define AO_HAVE_char_fetch_and_add1_dd_acquire_read
 
427
#  endif
 
428
#endif
 
429
 
 
430
/* char_fetch_and_sub1 */
 
431
 
 
432
#if defined(AO_HAVE_char_fetch_and_add_full) &&\
 
433
    !defined(AO_HAVE_char_fetch_and_sub1_full)
 
434
#  define AO_char_fetch_and_sub1_full(addr) \
 
435
        AO_char_fetch_and_add_full(addr,(unsigned char)(-1))
 
436
#  define AO_HAVE_char_fetch_and_sub1_full
 
437
#endif
 
438
#if defined(AO_HAVE_char_fetch_and_add_release) &&\
 
439
    !defined(AO_HAVE_char_fetch_and_sub1_release)
 
440
#  define AO_char_fetch_and_sub1_release(addr) \
 
441
        AO_char_fetch_and_add_release(addr,(unsigned char)(-1))
 
442
#  define AO_HAVE_char_fetch_and_sub1_release
 
443
#endif
 
444
#if defined(AO_HAVE_char_fetch_and_add_acquire) &&\
 
445
    !defined(AO_HAVE_char_fetch_and_sub1_acquire)
 
446
#  define AO_char_fetch_and_sub1_acquire(addr) \
 
447
        AO_char_fetch_and_add_acquire(addr,(unsigned char)(-1))
 
448
#  define AO_HAVE_char_fetch_and_sub1_acquire
 
449
#endif
 
450
#if defined(AO_HAVE_char_fetch_and_add_write) &&\
 
451
    !defined(AO_HAVE_char_fetch_and_sub1_write)
 
452
#  define AO_char_fetch_and_sub1_write(addr) \
 
453
        AO_char_fetch_and_add_write(addr,(unsigned char)(-1))
 
454
#  define AO_HAVE_char_fetch_and_sub1_write
 
455
#endif
 
456
#if defined(AO_HAVE_char_fetch_and_add_read) &&\
 
457
    !defined(AO_HAVE_char_fetch_and_sub1_read)
 
458
#  define AO_char_fetch_and_sub1_read(addr) \
 
459
        AO_char_fetch_and_add_read(addr,(unsigned char)(-1))
 
460
#  define AO_HAVE_char_fetch_and_sub1_read
 
461
#endif
 
462
#if defined(AO_HAVE_char_fetch_and_add_release_write) &&\
 
463
    !defined(AO_HAVE_char_fetch_and_sub1_release_write)
 
464
#  define AO_char_fetch_and_sub1_release_write(addr) \
 
465
        AO_char_fetch_and_add_release_write(addr,(unsigned char)(-1))
 
466
#  define AO_HAVE_char_fetch_and_sub1_release_write
 
467
#endif
 
468
#if defined(AO_HAVE_char_fetch_and_add_acquire_read) &&\
 
469
    !defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
 
470
#  define AO_char_fetch_and_sub1_acquire_read(addr) \
 
471
        AO_char_fetch_and_add_acquire_read(addr,(unsigned char)(-1))
 
472
#  define AO_HAVE_char_fetch_and_sub1_acquire_read
 
473
#endif
 
474
#if defined(AO_HAVE_char_fetch_and_add) &&\
 
475
    !defined(AO_HAVE_char_fetch_and_sub1)
 
476
#  define AO_char_fetch_and_sub1(addr) \
 
477
        AO_char_fetch_and_add(addr,(unsigned char)(-1))
 
478
#  define AO_HAVE_char_fetch_and_sub1
 
479
#endif
 
480
 
 
481
#if defined(AO_HAVE_char_fetch_and_sub1_full)
 
482
#  if !defined(AO_HAVE_char_fetch_and_sub1_release)
 
483
#    define AO_char_fetch_and_sub1_release(addr) \
 
484
         AO_char_fetch_and_sub1_full(addr)
 
485
#    define AO_HAVE_char_fetch_and_sub1_release
 
486
#  endif
 
487
#  if !defined(AO_HAVE_char_fetch_and_sub1_acquire)
 
488
#    define AO_char_fetch_and_sub1_acquire(addr) \
 
489
         AO_char_fetch_and_sub1_full(addr)
 
490
#    define AO_HAVE_char_fetch_and_sub1_acquire
 
491
#  endif
 
492
#  if !defined(AO_HAVE_char_fetch_and_sub1_write)
 
493
#    define AO_char_fetch_and_sub1_write(addr) \
 
494
         AO_char_fetch_and_sub1_full(addr)
 
495
#    define AO_HAVE_char_fetch_and_sub1_write
 
496
#  endif
 
497
#  if !defined(AO_HAVE_char_fetch_and_sub1_read)
 
498
#    define AO_char_fetch_and_sub1_read(addr) \
 
499
         AO_char_fetch_and_sub1_full(addr)
 
500
#    define AO_HAVE_char_fetch_and_sub1_read
 
501
#  endif
 
502
#endif /* AO_HAVE_char_fetch_and_sub1_full */
 
503
 
 
504
#if !defined(AO_HAVE_char_fetch_and_sub1) && \
 
505
    defined(AO_HAVE_char_fetch_and_sub1_release)
 
506
#  define AO_char_fetch_and_sub1(addr) \
 
507
        AO_char_fetch_and_sub1_release(addr)
 
508
#  define AO_HAVE_char_fetch_and_sub1
 
509
#endif
 
510
#if !defined(AO_HAVE_char_fetch_and_sub1) && \
 
511
    defined(AO_HAVE_char_fetch_and_sub1_acquire)
 
512
#  define AO_char_fetch_and_sub1(addr) \
 
513
        AO_char_fetch_and_sub1_acquire(addr)
 
514
#  define AO_HAVE_char_fetch_and_sub1
 
515
#endif
 
516
#if !defined(AO_HAVE_char_fetch_and_sub1) && \
 
517
    defined(AO_HAVE_char_fetch_and_sub1_write)
 
518
#  define AO_char_fetch_and_sub1(addr) \
 
519
        AO_char_fetch_and_sub1_write(addr)
 
520
#  define AO_HAVE_char_fetch_and_sub1
 
521
#endif
 
522
#if !defined(AO_HAVE_char_fetch_and_sub1) && \
 
523
    defined(AO_HAVE_char_fetch_and_sub1_read)
 
524
#  define AO_char_fetch_and_sub1(addr) \
 
525
        AO_char_fetch_and_sub1_read(addr)
 
526
#  define AO_HAVE_char_fetch_and_sub1
 
527
#endif
 
528
 
 
529
#if defined(AO_HAVE_char_fetch_and_sub1_acquire) &&\
 
530
    defined(AO_HAVE_nop_full) && \
 
531
    !defined(AO_HAVE_char_fetch_and_sub1_full)
 
532
#  define AO_char_fetch_and_sub1_full(addr) \
 
533
        (AO_nop_full(), AO_char_fetch_and_sub1_acquire(addr))
 
534
#  define AO_HAVE_char_fetch_and_sub1_full
 
535
#endif
 
536
 
 
537
#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \
 
538
    defined(AO_HAVE_char_fetch_and_sub1_write)
 
539
#  define AO_char_fetch_and_sub1_release_write(addr) \
 
540
        AO_char_fetch_and_sub1_write(addr)
 
541
#  define AO_HAVE_char_fetch_and_sub1_release_write
 
542
#endif
 
543
#if !defined(AO_HAVE_char_fetch_and_sub1_release_write) && \
 
544
    defined(AO_HAVE_char_fetch_and_sub1_release)
 
545
#  define AO_char_fetch_and_sub1_release_write(addr) \
 
546
        AO_char_fetch_and_sub1_release(addr)
 
547
#  define AO_HAVE_char_fetch_and_sub1_release_write
 
548
#endif
 
549
#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \
 
550
    defined(AO_HAVE_char_fetch_and_sub1_read)
 
551
#  define AO_char_fetch_and_sub1_acquire_read(addr) \
 
552
        AO_char_fetch_and_sub1_read(addr)
 
553
#  define AO_HAVE_char_fetch_and_sub1_acquire_read
 
554
#endif
 
555
#if !defined(AO_HAVE_char_fetch_and_sub1_acquire_read) && \
 
556
    defined(AO_HAVE_char_fetch_and_sub1_acquire)
 
557
#  define AO_char_fetch_and_sub1_acquire_read(addr) \
 
558
        AO_char_fetch_and_sub1_acquire(addr)
 
559
#  define AO_HAVE_char_fetch_and_sub1_acquire_read
 
560
#endif
 
561
 
 
562
#ifdef AO_NO_DD_ORDERING
 
563
#  if defined(AO_HAVE_char_fetch_and_sub1_acquire_read)
 
564
#    define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
 
565
        AO_char_fetch_and_sub1_acquire_read(addr)
 
566
#    define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
 
567
#  endif
 
568
#else
 
569
#  if defined(AO_HAVE_char_fetch_and_sub1)
 
570
#    define AO_char_fetch_and_sub1_dd_acquire_read(addr) \
 
571
        AO_char_fetch_and_sub1(addr)
 
572
#    define AO_HAVE_char_fetch_and_sub1_dd_acquire_read
 
573
#  endif
 
574
#endif
 
575
 
 
576
/* short_load */
 
577
#if defined(AO_HAVE_short_load_acquire) && !defined(AO_HAVE_short_load)
 
578
#  define AO_short_load(addr) AO_short_load_acquire(addr)
 
579
#  define AO_HAVE_short_load
 
580
#endif
 
581
 
 
582
#if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_acquire)
 
583
#  define AO_short_load_acquire(addr) AO_short_load_full(addr)
 
584
#  define AO_HAVE_short_load_acquire
 
585
#endif
 
586
 
 
587
#if defined(AO_HAVE_short_load_full) && !defined(AO_HAVE_short_load_read)
 
588
#  define AO_short_load_read(addr) AO_short_load_full(addr)
 
589
#  define AO_HAVE_short_load_read
 
590
#endif
 
591
 
 
592
#if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_acquire)
 
593
#  define AO_short_load_acquire_read(addr) AO_short_load_acquire(addr)
 
594
#  define AO_HAVE_short_load_acquire_read
 
595
#endif
 
596
 
 
597
#if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_full) && \
 
598
    !defined(AO_HAVE_short_load_acquire)
 
599
   AO_INLINE unsigned short
 
600
   AO_short_load_acquire(volatile unsigned short *addr)
 
601
   {
 
602
     unsigned short result = AO_short_load(addr);
 
603
     /* Acquire barrier would be useless, since the load could be delayed  */
 
604
     /* beyond it.                                                         */
 
605
     AO_nop_full();
 
606
     return result;
 
607
   }
 
608
#  define AO_HAVE_short_load_acquire
 
609
#endif
 
610
 
 
611
#if defined(AO_HAVE_short_load) && defined(AO_HAVE_nop_read) && \
 
612
    !defined(AO_HAVE_short_load_read)
 
613
   AO_INLINE unsigned short
 
614
   AO_short_load_read(volatile unsigned short *addr)
 
615
   {
 
616
     unsigned short result = AO_short_load(addr);
 
617
     /* Acquire barrier would be useless, since the load could be delayed  */
 
618
     /* beyond it.                                                         */
 
619
     AO_nop_read();
 
620
     return result;
 
621
   }
 
622
#  define AO_HAVE_short_load_read
 
623
#endif
 
624
 
 
625
#if defined(AO_HAVE_short_load_acquire) && defined(AO_HAVE_nop_full) && \
 
626
    !defined(AO_HAVE_short_load_full)
 
627
#  define AO_short_load_full(addr) (AO_nop_full(), AO_short_load_acquire(addr))
 
628
#  define AO_HAVE_short_load_full
 
629
#endif
 
630
 
 
631
#if !defined(AO_HAVE_short_load_acquire_read) && defined(AO_HAVE_short_load_read)
 
632
#  define AO_short_load_acquire_read(addr) AO_short_load_read(addr)
 
633
#  define AO_HAVE_short_load_acquire_read
 
634
#endif
 
635
 
 
636
#if defined(AO_HAVE_short_load_acquire_read) && !defined(AO_HAVE_short_load)
 
637
#  define AO_short_load(addr) AO_short_load_acquire_read(addr)
 
638
#  define AO_HAVE_short_load
 
639
#endif
 
640
 
 
641
#ifdef AO_NO_DD_ORDERING
 
642
#  if defined(AO_HAVE_short_load_acquire_read)
 
643
#    define AO_short_load_dd_acquire_read(addr) \
 
644
        AO_short_load_acquire_read(addr)
 
645
#    define AO_HAVE_short_load_dd_acquire_read
 
646
#  endif
 
647
#else
 
648
#  if defined(AO_HAVE_short_load)
 
649
#    define AO_short_load_dd_acquire_read(addr) \
 
650
        AO_short_load(addr)
 
651
#    define AO_HAVE_short_load_dd_acquire_read
 
652
#  endif
 
653
#endif
 
654
 
 
655
 
 
656
/* short_store */
 
657
 
 
658
#if defined(AO_HAVE_short_store_release) && !defined(AO_HAVE_short_store)
 
659
#  define AO_short_store(addr, val) AO_short_store_release(addr,val)
 
660
#  define AO_HAVE_short_store
 
661
#endif
 
662
 
 
663
#if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_release)
 
664
#  define AO_short_store_release(addr,val) AO_short_store_full(addr,val)
 
665
#  define AO_HAVE_short_store_release
 
666
#endif
 
667
 
 
668
#if defined(AO_HAVE_short_store_full) && !defined(AO_HAVE_short_store_write)
 
669
#  define AO_short_store_write(addr,val) AO_short_store_full(addr,val)
 
670
#  define AO_HAVE_short_store_write
 
671
#endif
 
672
 
 
673
#if defined(AO_HAVE_short_store_release) && \
 
674
        !defined(AO_HAVE_short_store_release_write)
 
675
#  define AO_short_store_release_write(addr, val) \
 
676
        AO_short_store_release(addr,val)
 
677
#  define AO_HAVE_short_store_release_write
 
678
#endif
 
679
 
 
680
#if defined(AO_HAVE_short_store_write) && !defined(AO_HAVE_short_store)
 
681
#  define AO_short_store(addr, val) AO_short_store_write(addr,val)
 
682
#  define AO_HAVE_short_store
 
683
#endif
 
684
 
 
685
#if defined(AO_HAVE_short_store) && defined(AO_HAVE_nop_full) && \
 
686
    !defined(AO_HAVE_short_store_release)
 
687
#  define AO_short_store_release(addr,val) \
 
688
        (AO_nop_full(), AO_short_store(addr,val))
 
689
#  define AO_HAVE_short_store_release
 
690
#endif
 
691
 
 
692
#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_short_store) && \
 
693
     !defined(AO_HAVE_short_store_write)
 
694
#  define AO_short_store_write(addr, val) \
 
695
        (AO_nop_write(), AO_short_store(addr,val))
 
696
#  define AO_HAVE_short_store_write
 
697
#endif
 
698
 
 
699
#if defined(AO_HAVE_short_store_write) && \
 
700
     !defined(AO_HAVE_short_store_release_write)
 
701
#  define AO_short_store_release_write(addr, val) AO_short_store_write(addr,val)
 
702
#  define AO_HAVE_short_store_release_write
 
703
#endif
 
704
 
 
705
#if defined(AO_HAVE_short_store_release) && defined(AO_HAVE_nop_full) && \
 
706
    !defined(AO_HAVE_short_store_full)
 
707
#  define AO_short_store_full(addr, val) \
 
708
        (AO_short_store_release(addr, val), AO_nop_full())
 
709
#  define AO_HAVE_short_store_full
 
710
#endif
 
711
 
 
712
 
 
713
/* short_fetch_and_add */
 
714
#if defined(AO_HAVE_short_compare_and_swap_full) && \
 
715
    !defined(AO_HAVE_short_fetch_and_add_full)
 
716
   AO_INLINE AO_t
 
717
   AO_short_fetch_and_add_full(volatile unsigned short *addr,
 
718
                               unsigned short incr)
 
719
   {
 
720
     unsigned short old;
 
721
     do
 
722
       {
 
723
         old = *addr;
 
724
       }
 
725
     while (!AO_short_compare_and_swap_full(addr, old, old+incr));
 
726
     return old;
 
727
   }
 
728
#  define AO_HAVE_short_fetch_and_add_full
 
729
#endif
 
730
 
 
731
#if defined(AO_HAVE_short_compare_and_swap_acquire) && \
 
732
    !defined(AO_HAVE_short_fetch_and_add_acquire)
 
733
   AO_INLINE AO_t
 
734
   AO_short_fetch_and_add_acquire(volatile unsigned short *addr,
 
735
                                  unsigned short incr)
 
736
   {
 
737
     unsigned short old;
 
738
     do
 
739
       {
 
740
         old = *addr;
 
741
       }
 
742
     while (!AO_short_compare_and_swap_acquire(addr, old, old+incr));
 
743
     return old;
 
744
   }
 
745
#  define AO_HAVE_short_fetch_and_add_acquire
 
746
#endif
 
747
 
 
748
#if defined(AO_HAVE_short_compare_and_swap_release) && \
 
749
    !defined(AO_HAVE_short_fetch_and_add_release)
 
750
   AO_INLINE AO_t
 
751
   AO_short_fetch_and_add_release(volatile unsigned short *addr,
 
752
                                  unsigned short incr)
 
753
   {
 
754
     unsigned short old;
 
755
     do
 
756
       {
 
757
         old = *addr;
 
758
       }
 
759
     while (!AO_short_compare_and_swap_release(addr, old, old+incr));
 
760
     return old;
 
761
   }
 
762
#  define AO_HAVE_short_fetch_and_add_release
 
763
#endif
 
764
 
 
765
#if defined(AO_HAVE_short_fetch_and_add_full)
 
766
#  if !defined(AO_HAVE_short_fetch_and_add_release)
 
767
#    define AO_short_fetch_and_add_release(addr, val) \
 
768
         AO_short_fetch_and_add_full(addr, val)
 
769
#    define AO_HAVE_short_fetch_and_add_release
 
770
#  endif
 
771
#  if !defined(AO_HAVE_short_fetch_and_add_acquire)
 
772
#    define AO_short_fetch_and_add_acquire(addr, val) \
 
773
         AO_short_fetch_and_add_full(addr, val)
 
774
#    define AO_HAVE_short_fetch_and_add_acquire
 
775
#  endif
 
776
#  if !defined(AO_HAVE_short_fetch_and_add_write)
 
777
#    define AO_short_fetch_and_add_write(addr, val) \
 
778
         AO_short_fetch_and_add_full(addr, val)
 
779
#    define AO_HAVE_short_fetch_and_add_write
 
780
#  endif
 
781
#  if !defined(AO_HAVE_short_fetch_and_add_read)
 
782
#    define AO_short_fetch_and_add_read(addr, val) \
 
783
         AO_short_fetch_and_add_full(addr, val)
 
784
#    define AO_HAVE_short_fetch_and_add_read
 
785
#  endif
 
786
#endif /* AO_HAVE_short_fetch_and_add_full */
 
787
 
 
788
#if !defined(AO_HAVE_short_fetch_and_add) && \
 
789
    defined(AO_HAVE_short_fetch_and_add_release)
 
790
#  define AO_short_fetch_and_add(addr, val) \
 
791
        AO_short_fetch_and_add_release(addr, val)
 
792
#  define AO_HAVE_short_fetch_and_add
 
793
#endif
 
794
#if !defined(AO_HAVE_short_fetch_and_add) && \
 
795
    defined(AO_HAVE_short_fetch_and_add_acquire)
 
796
#  define AO_short_fetch_and_add(addr, val) \
 
797
        AO_short_fetch_and_add_acquire(addr, val)
 
798
#  define AO_HAVE_short_fetch_and_add
 
799
#endif
 
800
#if !defined(AO_HAVE_short_fetch_and_add) && \
 
801
    defined(AO_HAVE_short_fetch_and_add_write)
 
802
#  define AO_short_fetch_and_add(addr, val) \
 
803
        AO_short_fetch_and_add_write(addr, val)
 
804
#  define AO_HAVE_short_fetch_and_add
 
805
#endif
 
806
#if !defined(AO_HAVE_short_fetch_and_add) && \
 
807
    defined(AO_HAVE_short_fetch_and_add_read)
 
808
#  define AO_short_fetch_and_add(addr, val) \
 
809
        AO_short_fetch_and_add_read(addr, val)
 
810
#  define AO_HAVE_short_fetch_and_add
 
811
#endif
 
812
 
 
813
#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
 
814
    defined(AO_HAVE_nop_full) && \
 
815
    !defined(AO_HAVE_short_fetch_and_add_full)
 
816
#  define AO_short_fetch_and_add_full(addr, val) \
 
817
        (AO_nop_full(), AO_short_fetch_and_add_acquire(addr, val))
 
818
#endif
 
819
 
 
820
#if !defined(AO_HAVE_short_fetch_and_add_release_write) && \
 
821
    defined(AO_HAVE_short_fetch_and_add_write)
 
822
#  define AO_short_fetch_and_add_release_write(addr, val) \
 
823
        AO_short_fetch_and_add_write(addr, val)
 
824
#  define AO_HAVE_short_fetch_and_add_release_write
 
825
#endif
 
826
#if !defined(AO_HAVE_short_fetch_and_add_release_write) && \
 
827
    defined(AO_HAVE_short_fetch_and_add_release)
 
828
#  define AO_short_fetch_and_add_release_write(addr, val) \
 
829
        AO_short_fetch_and_add_release(addr, val)
 
830
#  define AO_HAVE_short_fetch_and_add_release_write
 
831
#endif
 
832
#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \
 
833
    defined(AO_HAVE_short_fetch_and_add_read)
 
834
#  define AO_short_fetch_and_add_acquire_read(addr, val) \
 
835
        AO_short_fetch_and_add_read(addr, val)
 
836
#  define AO_HAVE_short_fetch_and_add_acquire_read
 
837
#endif
 
838
#if !defined(AO_HAVE_short_fetch_and_add_acquire_read) && \
 
839
    defined(AO_HAVE_short_fetch_and_add_acquire)
 
840
#  define AO_short_fetch_and_add_acquire_read(addr, val) \
 
841
        AO_short_fetch_and_add_acquire(addr, val)
 
842
#  define AO_HAVE_short_fetch_and_add_acquire_read
 
843
#endif
 
844
 
 
845
#ifdef AO_NO_DD_ORDERING
 
846
#  if defined(AO_HAVE_short_fetch_and_add_acquire_read)
 
847
#    define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
 
848
        AO_short_fetch_and_add_acquire_read(addr, val)
 
849
#    define AO_HAVE_short_fetch_and_add_dd_acquire_read
 
850
#  endif
 
851
#else
 
852
#  if defined(AO_HAVE_short_fetch_and_add)
 
853
#    define AO_short_fetch_and_add_dd_acquire_read(addr, val) \
 
854
        AO_short_fetch_and_add(addr, val)
 
855
#    define AO_HAVE_short_fetch_and_add_dd_acquire_read
 
856
#  endif
 
857
#endif
 
858
  
 
859
/* short_fetch_and_add1 */
 
860
 
 
861
#if defined(AO_HAVE_short_fetch_and_add_full) &&\
 
862
    !defined(AO_HAVE_short_fetch_and_add1_full)
 
863
#  define AO_short_fetch_and_add1_full(addr) \
 
864
        AO_short_fetch_and_add_full(addr,1)
 
865
#  define AO_HAVE_short_fetch_and_add1_full
 
866
#endif
 
867
#if defined(AO_HAVE_short_fetch_and_add_release) &&\
 
868
    !defined(AO_HAVE_short_fetch_and_add1_release)
 
869
#  define AO_short_fetch_and_add1_release(addr) \
 
870
        AO_short_fetch_and_add_release(addr,1)
 
871
#  define AO_HAVE_short_fetch_and_add1_release
 
872
#endif
 
873
#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
 
874
    !defined(AO_HAVE_short_fetch_and_add1_acquire)
 
875
#  define AO_short_fetch_and_add1_acquire(addr) \
 
876
        AO_short_fetch_and_add_acquire(addr,1)
 
877
#  define AO_HAVE_short_fetch_and_add1_acquire
 
878
#endif
 
879
#if defined(AO_HAVE_short_fetch_and_add_write) &&\
 
880
    !defined(AO_HAVE_short_fetch_and_add1_write)
 
881
#  define AO_short_fetch_and_add1_write(addr) \
 
882
        AO_short_fetch_and_add_write(addr,1)
 
883
#  define AO_HAVE_short_fetch_and_add1_write
 
884
#endif
 
885
#if defined(AO_HAVE_short_fetch_and_add_read) &&\
 
886
    !defined(AO_HAVE_short_fetch_and_add1_read)
 
887
#  define AO_short_fetch_and_add1_read(addr) \
 
888
        AO_short_fetch_and_add_read(addr,1)
 
889
#  define AO_HAVE_short_fetch_and_add1_read
 
890
#endif
 
891
#if defined(AO_HAVE_short_fetch_and_add_release_write) &&\
 
892
    !defined(AO_HAVE_short_fetch_and_add1_release_write)
 
893
#  define AO_short_fetch_and_add1_release_write(addr) \
 
894
        AO_short_fetch_and_add_release_write(addr,1)
 
895
#  define AO_HAVE_short_fetch_and_add1_release_write
 
896
#endif
 
897
#if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\
 
898
    !defined(AO_HAVE_short_fetch_and_add1_acquire_read)
 
899
#  define AO_short_fetch_and_add1_acquire_read(addr) \
 
900
        AO_short_fetch_and_add_acquire_read(addr,1)
 
901
#  define AO_HAVE_short_fetch_and_add1_acquire_read
 
902
#endif
 
903
#if defined(AO_HAVE_short_fetch_and_add) &&\
 
904
    !defined(AO_HAVE_short_fetch_and_add1)
 
905
#  define AO_short_fetch_and_add1(addr) \
 
906
        AO_short_fetch_and_add(addr,1)
 
907
#  define AO_HAVE_short_fetch_and_add1
 
908
#endif
 
909
 
 
910
#if defined(AO_HAVE_short_fetch_and_add1_full)
 
911
#  if !defined(AO_HAVE_short_fetch_and_add1_release)
 
912
#    define AO_short_fetch_and_add1_release(addr) \
 
913
         AO_short_fetch_and_add1_full(addr)
 
914
#    define AO_HAVE_short_fetch_and_add1_release
 
915
#  endif
 
916
#  if !defined(AO_HAVE_short_fetch_and_add1_acquire)
 
917
#    define AO_short_fetch_and_add1_acquire(addr) \
 
918
         AO_short_fetch_and_add1_full(addr)
 
919
#    define AO_HAVE_short_fetch_and_add1_acquire
 
920
#  endif
 
921
#  if !defined(AO_HAVE_short_fetch_and_add1_write)
 
922
#    define AO_short_fetch_and_add1_write(addr) \
 
923
         AO_short_fetch_and_add1_full(addr)
 
924
#    define AO_HAVE_short_fetch_and_add1_write
 
925
#  endif
 
926
#  if !defined(AO_HAVE_short_fetch_and_add1_read)
 
927
#    define AO_short_fetch_and_add1_read(addr) \
 
928
         AO_short_fetch_and_add1_full(addr)
 
929
#    define AO_HAVE_short_fetch_and_add1_read
 
930
#  endif
 
931
#endif /* AO_HAVE_short_fetch_and_add1_full */
 
932
 
 
933
#if !defined(AO_HAVE_short_fetch_and_add1) && \
 
934
    defined(AO_HAVE_short_fetch_and_add1_release)
 
935
#  define AO_short_fetch_and_add1(addr) \
 
936
        AO_short_fetch_and_add1_release(addr)
 
937
#  define AO_HAVE_short_fetch_and_add1
 
938
#endif
 
939
#if !defined(AO_HAVE_short_fetch_and_add1) && \
 
940
    defined(AO_HAVE_short_fetch_and_add1_acquire)
 
941
#  define AO_short_fetch_and_add1(addr) \
 
942
        AO_short_fetch_and_add1_acquire(addr)
 
943
#  define AO_HAVE_short_fetch_and_add1
 
944
#endif
 
945
#if !defined(AO_HAVE_short_fetch_and_add1) && \
 
946
    defined(AO_HAVE_short_fetch_and_add1_write)
 
947
#  define AO_short_fetch_and_add1(addr) \
 
948
        AO_short_fetch_and_add1_write(addr)
 
949
#  define AO_HAVE_short_fetch_and_add1
 
950
#endif
 
951
#if !defined(AO_HAVE_short_fetch_and_add1) && \
 
952
    defined(AO_HAVE_short_fetch_and_add1_read)
 
953
#  define AO_short_fetch_and_add1(addr) \
 
954
        AO_short_fetch_and_add1_read(addr)
 
955
#  define AO_HAVE_short_fetch_and_add1
 
956
#endif
 
957
 
 
958
#if defined(AO_HAVE_short_fetch_and_add1_acquire) &&\
 
959
    defined(AO_HAVE_nop_full) && \
 
960
    !defined(AO_HAVE_short_fetch_and_add1_full)
 
961
#  define AO_short_fetch_and_add1_full(addr) \
 
962
        (AO_nop_full(), AO_short_fetch_and_add1_acquire(addr))
 
963
#  define AO_HAVE_short_fetch_and_add1_full
 
964
#endif
 
965
 
 
966
#if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \
 
967
    defined(AO_HAVE_short_fetch_and_add1_write)
 
968
#  define AO_short_fetch_and_add1_release_write(addr) \
 
969
        AO_short_fetch_and_add1_write(addr)
 
970
#  define AO_HAVE_short_fetch_and_add1_release_write
 
971
#endif
 
972
#if !defined(AO_HAVE_short_fetch_and_add1_release_write) && \
 
973
    defined(AO_HAVE_short_fetch_and_add1_release)
 
974
#  define AO_short_fetch_and_add1_release_write(addr) \
 
975
        AO_short_fetch_and_add1_release(addr)
 
976
#  define AO_HAVE_short_fetch_and_add1_release_write
 
977
#endif
 
978
#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \
 
979
    defined(AO_HAVE_short_fetch_and_add1_read)
 
980
#  define AO_short_fetch_and_add1_acquire_read(addr) \
 
981
        AO_short_fetch_and_add1_read(addr)
 
982
#  define AO_HAVE_short_fetch_and_add1_acquire_read
 
983
#endif
 
984
#if !defined(AO_HAVE_short_fetch_and_add1_acquire_read) && \
 
985
    defined(AO_HAVE_short_fetch_and_add1_acquire)
 
986
#  define AO_short_fetch_and_add1_acquire_read(addr) \
 
987
        AO_short_fetch_and_add1_acquire(addr)
 
988
#  define AO_HAVE_short_fetch_and_add1_acquire_read
 
989
#endif
 
990
 
 
991
#ifdef AO_NO_DD_ORDERING
 
992
#  if defined(AO_HAVE_short_fetch_and_add1_acquire_read)
 
993
#    define AO_short_fetch_and_add1_dd_acquire_read(addr) \
 
994
        AO_short_fetch_and_add1_acquire_read(addr)
 
995
#    define AO_HAVE_short_fetch_and_add1_dd_acquire_read
 
996
#  endif
 
997
#else
 
998
#  if defined(AO_HAVE_short_fetch_and_add1)
 
999
#    define AO_short_fetch_and_add1_dd_acquire_read(addr) \
 
1000
        AO_short_fetch_and_add1(addr)
 
1001
#    define AO_HAVE_short_fetch_and_add1_dd_acquire_read
 
1002
#  endif
 
1003
#endif
 
1004
 
 
1005
/* short_fetch_and_sub1 */
 
1006
 
 
1007
#if defined(AO_HAVE_short_fetch_and_add_full) &&\
 
1008
    !defined(AO_HAVE_short_fetch_and_sub1_full)
 
1009
#  define AO_short_fetch_and_sub1_full(addr) \
 
1010
        AO_short_fetch_and_add_full(addr,(unsigned short)(-1))
 
1011
#  define AO_HAVE_short_fetch_and_sub1_full
 
1012
#endif
 
1013
#if defined(AO_HAVE_short_fetch_and_add_release) &&\
 
1014
    !defined(AO_HAVE_short_fetch_and_sub1_release)
 
1015
#  define AO_short_fetch_and_sub1_release(addr) \
 
1016
        AO_short_fetch_and_add_release(addr,(unsigned short)(-1))
 
1017
#  define AO_HAVE_short_fetch_and_sub1_release
 
1018
#endif
 
1019
#if defined(AO_HAVE_short_fetch_and_add_acquire) &&\
 
1020
    !defined(AO_HAVE_short_fetch_and_sub1_acquire)
 
1021
#  define AO_short_fetch_and_sub1_acquire(addr) \
 
1022
        AO_short_fetch_and_add_acquire(addr,(unsigned short)(-1))
 
1023
#  define AO_HAVE_short_fetch_and_sub1_acquire
 
1024
#endif
 
1025
#if defined(AO_HAVE_short_fetch_and_add_write) &&\
 
1026
    !defined(AO_HAVE_short_fetch_and_sub1_write)
 
1027
#  define AO_short_fetch_and_sub1_write(addr) \
 
1028
        AO_short_fetch_and_add_write(addr,(unsigned short)(-1))
 
1029
#  define AO_HAVE_short_fetch_and_sub1_write
 
1030
#endif
 
1031
#if defined(AO_HAVE_short_fetch_and_add_read) &&\
 
1032
    !defined(AO_HAVE_short_fetch_and_sub1_read)
 
1033
#  define AO_short_fetch_and_sub1_read(addr) \
 
1034
        AO_short_fetch_and_add_read(addr,(unsigned short)(-1))
 
1035
#  define AO_HAVE_short_fetch_and_sub1_read
 
1036
#endif
 
1037
#if defined(AO_HAVE_short_fetch_and_add_release_write) &&\
 
1038
    !defined(AO_HAVE_short_fetch_and_sub1_release_write)
 
1039
#  define AO_short_fetch_and_sub1_release_write(addr) \
 
1040
        AO_short_fetch_and_add_release_write(addr,(unsigned short)(-1))
 
1041
#  define AO_HAVE_short_fetch_and_sub1_release_write
 
1042
#endif
 
1043
#if defined(AO_HAVE_short_fetch_and_add_acquire_read) &&\
 
1044
    !defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
 
1045
#  define AO_short_fetch_and_sub1_acquire_read(addr) \
 
1046
        AO_short_fetch_and_add_acquire_read(addr,(unsigned short)(-1))
 
1047
#  define AO_HAVE_short_fetch_and_sub1_acquire_read
 
1048
#endif
 
1049
#if defined(AO_HAVE_short_fetch_and_add) &&\
 
1050
    !defined(AO_HAVE_short_fetch_and_sub1)
 
1051
#  define AO_short_fetch_and_sub1(addr) \
 
1052
        AO_short_fetch_and_add(addr,(unsigned short)(-1))
 
1053
#  define AO_HAVE_short_fetch_and_sub1
 
1054
#endif
 
1055
 
 
1056
#if defined(AO_HAVE_short_fetch_and_sub1_full)
 
1057
#  if !defined(AO_HAVE_short_fetch_and_sub1_release)
 
1058
#    define AO_short_fetch_and_sub1_release(addr) \
 
1059
         AO_short_fetch_and_sub1_full(addr)
 
1060
#    define AO_HAVE_short_fetch_and_sub1_release
 
1061
#  endif
 
1062
#  if !defined(AO_HAVE_short_fetch_and_sub1_acquire)
 
1063
#    define AO_short_fetch_and_sub1_acquire(addr) \
 
1064
         AO_short_fetch_and_sub1_full(addr)
 
1065
#    define AO_HAVE_short_fetch_and_sub1_acquire
 
1066
#  endif
 
1067
#  if !defined(AO_HAVE_short_fetch_and_sub1_write)
 
1068
#    define AO_short_fetch_and_sub1_write(addr) \
 
1069
         AO_short_fetch_and_sub1_full(addr)
 
1070
#    define AO_HAVE_short_fetch_and_sub1_write
 
1071
#  endif
 
1072
#  if !defined(AO_HAVE_short_fetch_and_sub1_read)
 
1073
#    define AO_short_fetch_and_sub1_read(addr) \
 
1074
         AO_short_fetch_and_sub1_full(addr)
 
1075
#    define AO_HAVE_short_fetch_and_sub1_read
 
1076
#  endif
 
1077
#endif /* AO_HAVE_short_fetch_and_sub1_full */
 
1078
 
 
1079
#if !defined(AO_HAVE_short_fetch_and_sub1) && \
 
1080
    defined(AO_HAVE_short_fetch_and_sub1_release)
 
1081
#  define AO_short_fetch_and_sub1(addr) \
 
1082
        AO_short_fetch_and_sub1_release(addr)
 
1083
#  define AO_HAVE_short_fetch_and_sub1
 
1084
#endif
 
1085
#if !defined(AO_HAVE_short_fetch_and_sub1) && \
 
1086
    defined(AO_HAVE_short_fetch_and_sub1_acquire)
 
1087
#  define AO_short_fetch_and_sub1(addr) \
 
1088
        AO_short_fetch_and_sub1_acquire(addr)
 
1089
#  define AO_HAVE_short_fetch_and_sub1
 
1090
#endif
 
1091
#if !defined(AO_HAVE_short_fetch_and_sub1) && \
 
1092
    defined(AO_HAVE_short_fetch_and_sub1_write)
 
1093
#  define AO_short_fetch_and_sub1(addr) \
 
1094
        AO_short_fetch_and_sub1_write(addr)
 
1095
#  define AO_HAVE_short_fetch_and_sub1
 
1096
#endif
 
1097
#if !defined(AO_HAVE_short_fetch_and_sub1) && \
 
1098
    defined(AO_HAVE_short_fetch_and_sub1_read)
 
1099
#  define AO_short_fetch_and_sub1(addr) \
 
1100
        AO_short_fetch_and_sub1_read(addr)
 
1101
#  define AO_HAVE_short_fetch_and_sub1
 
1102
#endif
 
1103
 
 
1104
#if defined(AO_HAVE_short_fetch_and_sub1_acquire) &&\
 
1105
    defined(AO_HAVE_nop_full) && \
 
1106
    !defined(AO_HAVE_short_fetch_and_sub1_full)
 
1107
#  define AO_short_fetch_and_sub1_full(addr) \
 
1108
        (AO_nop_full(), AO_short_fetch_and_sub1_acquire(addr))
 
1109
#  define AO_HAVE_short_fetch_and_sub1_full
 
1110
#endif
 
1111
 
 
1112
#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \
 
1113
    defined(AO_HAVE_short_fetch_and_sub1_write)
 
1114
#  define AO_short_fetch_and_sub1_release_write(addr) \
 
1115
        AO_short_fetch_and_sub1_write(addr)
 
1116
#  define AO_HAVE_short_fetch_and_sub1_release_write
 
1117
#endif
 
1118
#if !defined(AO_HAVE_short_fetch_and_sub1_release_write) && \
 
1119
    defined(AO_HAVE_short_fetch_and_sub1_release)
 
1120
#  define AO_short_fetch_and_sub1_release_write(addr) \
 
1121
        AO_short_fetch_and_sub1_release(addr)
 
1122
#  define AO_HAVE_short_fetch_and_sub1_release_write
 
1123
#endif
 
1124
#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \
 
1125
    defined(AO_HAVE_short_fetch_and_sub1_read)
 
1126
#  define AO_short_fetch_and_sub1_acquire_read(addr) \
 
1127
        AO_short_fetch_and_sub1_read(addr)
 
1128
#  define AO_HAVE_short_fetch_and_sub1_acquire_read
 
1129
#endif
 
1130
#if !defined(AO_HAVE_short_fetch_and_sub1_acquire_read) && \
 
1131
    defined(AO_HAVE_short_fetch_and_sub1_acquire)
 
1132
#  define AO_short_fetch_and_sub1_acquire_read(addr) \
 
1133
        AO_short_fetch_and_sub1_acquire(addr)
 
1134
#  define AO_HAVE_short_fetch_and_sub1_acquire_read
 
1135
#endif
 
1136
 
 
1137
#ifdef AO_NO_DD_ORDERING
 
1138
#  if defined(AO_HAVE_short_fetch_and_sub1_acquire_read)
 
1139
#    define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
 
1140
        AO_short_fetch_and_sub1_acquire_read(addr)
 
1141
#    define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
 
1142
#  endif
 
1143
#else
 
1144
#  if defined(AO_HAVE_short_fetch_and_sub1)
 
1145
#    define AO_short_fetch_and_sub1_dd_acquire_read(addr) \
 
1146
        AO_short_fetch_and_sub1(addr)
 
1147
#    define AO_HAVE_short_fetch_and_sub1_dd_acquire_read
 
1148
#  endif
 
1149
#endif
 
1150
 
 
1151
/* int_load */
 
1152
#if defined(AO_HAVE_int_load_acquire) && !defined(AO_HAVE_int_load)
 
1153
#  define AO_int_load(addr) AO_int_load_acquire(addr)
 
1154
#  define AO_HAVE_int_load
 
1155
#endif
 
1156
 
 
1157
#if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_acquire)
 
1158
#  define AO_int_load_acquire(addr) AO_int_load_full(addr)
 
1159
#  define AO_HAVE_int_load_acquire
 
1160
#endif
 
1161
 
 
1162
#if defined(AO_HAVE_int_load_full) && !defined(AO_HAVE_int_load_read)
 
1163
#  define AO_int_load_read(addr) AO_int_load_full(addr)
 
1164
#  define AO_HAVE_int_load_read
 
1165
#endif
 
1166
 
 
1167
#if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_acquire)
 
1168
#  define AO_int_load_acquire_read(addr) AO_int_load_acquire(addr)
 
1169
#  define AO_HAVE_int_load_acquire_read
 
1170
#endif
 
1171
 
 
1172
#if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_full) && \
 
1173
    !defined(AO_HAVE_int_load_acquire)
 
1174
   AO_INLINE unsigned int
 
1175
   AO_int_load_acquire(volatile unsigned int *addr)
 
1176
   {
 
1177
     unsigned int result = AO_int_load(addr);
 
1178
     /* Acquire barrier would be useless, since the load could be delayed  */
 
1179
     /* beyond it.                                                         */
 
1180
     AO_nop_full();
 
1181
     return result;
 
1182
   }
 
1183
#  define AO_HAVE_int_load_acquire
 
1184
#endif
 
1185
 
 
1186
#if defined(AO_HAVE_int_load) && defined(AO_HAVE_nop_read) && \
 
1187
    !defined(AO_HAVE_int_load_read)
 
1188
   AO_INLINE unsigned int
 
1189
   AO_int_load_read(volatile unsigned int *addr)
 
1190
   {
 
1191
     unsigned int result = AO_int_load(addr);
 
1192
     /* Acquire barrier would be useless, since the load could be delayed  */
 
1193
     /* beyond it.                                                         */
 
1194
     AO_nop_read();
 
1195
     return result;
 
1196
   }
 
1197
#  define AO_HAVE_int_load_read
 
1198
#endif
 
1199
 
 
1200
#if defined(AO_HAVE_int_load_acquire) && defined(AO_HAVE_nop_full) && \
 
1201
    !defined(AO_HAVE_int_load_full)
 
1202
#  define AO_int_load_full(addr) (AO_nop_full(), AO_int_load_acquire(addr))
 
1203
#  define AO_HAVE_int_load_full
 
1204
#endif
 
1205
 
 
1206
#if !defined(AO_HAVE_int_load_acquire_read) && defined(AO_HAVE_int_load_read)
 
1207
#  define AO_int_load_acquire_read(addr) AO_int_load_read(addr)
 
1208
#  define AO_HAVE_int_load_acquire_read
 
1209
#endif
 
1210
 
 
1211
#if defined(AO_HAVE_int_load_acquire_read) && !defined(AO_HAVE_int_load)
 
1212
#  define AO_int_load(addr) AO_int_load_acquire_read(addr)
 
1213
#  define AO_HAVE_int_load
 
1214
#endif
 
1215
 
 
1216
#ifdef AO_NO_DD_ORDERING
 
1217
#  if defined(AO_HAVE_int_load_acquire_read)
 
1218
#    define AO_int_load_dd_acquire_read(addr) \
 
1219
        AO_int_load_acquire_read(addr)
 
1220
#    define AO_HAVE_int_load_dd_acquire_read
 
1221
#  endif
 
1222
#else
 
1223
#  if defined(AO_HAVE_int_load)
 
1224
#    define AO_int_load_dd_acquire_read(addr) \
 
1225
        AO_int_load(addr)
 
1226
#    define AO_HAVE_int_load_dd_acquire_read
 
1227
#  endif
 
1228
#endif
 
1229
 
 
1230
 
 
1231
/* int_store */
 
1232
 
 
1233
#if defined(AO_HAVE_int_store_release) && !defined(AO_HAVE_int_store)
 
1234
#  define AO_int_store(addr, val) AO_int_store_release(addr,val)
 
1235
#  define AO_HAVE_int_store
 
1236
#endif
 
1237
 
 
1238
#if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_release)
 
1239
#  define AO_int_store_release(addr,val) AO_int_store_full(addr,val)
 
1240
#  define AO_HAVE_int_store_release
 
1241
#endif
 
1242
 
 
1243
#if defined(AO_HAVE_int_store_full) && !defined(AO_HAVE_int_store_write)
 
1244
#  define AO_int_store_write(addr,val) AO_int_store_full(addr,val)
 
1245
#  define AO_HAVE_int_store_write
 
1246
#endif
 
1247
 
 
1248
#if defined(AO_HAVE_int_store_release) && \
 
1249
        !defined(AO_HAVE_int_store_release_write)
 
1250
#  define AO_int_store_release_write(addr, val) \
 
1251
        AO_int_store_release(addr,val)
 
1252
#  define AO_HAVE_int_store_release_write
 
1253
#endif
 
1254
 
 
1255
#if defined(AO_HAVE_int_store_write) && !defined(AO_HAVE_int_store)
 
1256
#  define AO_int_store(addr, val) AO_int_store_write(addr,val)
 
1257
#  define AO_HAVE_int_store
 
1258
#endif
 
1259
 
 
1260
#if defined(AO_HAVE_int_store) && defined(AO_HAVE_nop_full) && \
 
1261
    !defined(AO_HAVE_int_store_release)
 
1262
#  define AO_int_store_release(addr,val) \
 
1263
        (AO_nop_full(), AO_int_store(addr,val))
 
1264
#  define AO_HAVE_int_store_release
 
1265
#endif
 
1266
 
 
1267
#if defined(AO_HAVE_nop_write) && defined(AO_HAVE_int_store) && \
 
1268
     !defined(AO_HAVE_int_store_write)
 
1269
#  define AO_int_store_write(addr, val) \
 
1270
        (AO_nop_write(), AO_int_store(addr,val))
 
1271
#  define AO_HAVE_int_store_write
 
1272
#endif
 
1273
 
 
1274
#if defined(AO_HAVE_int_store_write) && \
 
1275
     !defined(AO_HAVE_int_store_release_write)
 
1276
#  define AO_int_store_release_write(addr, val) AO_int_store_write(addr,val)
 
1277
#  define AO_HAVE_int_store_release_write
 
1278
#endif
 
1279
 
 
1280
#if defined(AO_HAVE_int_store_release) && defined(AO_HAVE_nop_full) && \
 
1281
    !defined(AO_HAVE_int_store_full)
 
1282
#  define AO_int_store_full(addr, val) \
 
1283
        (AO_int_store_release(addr, val), AO_nop_full())
 
1284
#  define AO_HAVE_int_store_full
 
1285
#endif
 
1286
 
 
1287
 
 
1288
/* int_fetch_and_add */
 
1289
#if defined(AO_HAVE_int_compare_and_swap_full) && \
 
1290
    !defined(AO_HAVE_int_fetch_and_add_full)
 
1291
   AO_INLINE AO_t
 
1292
   AO_int_fetch_and_add_full(volatile unsigned int *addr,
 
1293
                               unsigned int incr)
 
1294
   {
 
1295
     unsigned int old;
 
1296
     do
 
1297
       {
 
1298
         old = *addr;
 
1299
       }
 
1300
     while (!AO_int_compare_and_swap_full(addr, old, old+incr));
 
1301
     return old;
 
1302
   }
 
1303
#  define AO_HAVE_int_fetch_and_add_full
 
1304
#endif
 
1305
 
 
1306
#if defined(AO_HAVE_int_compare_and_swap_acquire) && \
 
1307
    !defined(AO_HAVE_int_fetch_and_add_acquire)
 
1308
   AO_INLINE AO_t
 
1309
   AO_int_fetch_and_add_acquire(volatile unsigned int *addr,
 
1310
                                  unsigned int incr)
 
1311
   {
 
1312
     unsigned int old;
 
1313
     do
 
1314
       {
 
1315
         old = *addr;
 
1316
       }
 
1317
     while (!AO_int_compare_and_swap_acquire(addr, old, old+incr));
 
1318
     return old;
 
1319
   }
 
1320
#  define AO_HAVE_int_fetch_and_add_acquire
 
1321
#endif
 
1322
 
 
1323
#if defined(AO_HAVE_int_compare_and_swap_release) && \
 
1324
    !defined(AO_HAVE_int_fetch_and_add_release)
 
1325
   AO_INLINE AO_t
 
1326
   AO_int_fetch_and_add_release(volatile unsigned int *addr,
 
1327
                                  unsigned int incr)
 
1328
   {
 
1329
     unsigned int old;
 
1330
     do
 
1331
       {
 
1332
         old = *addr;
 
1333
       }
 
1334
     while (!AO_int_compare_and_swap_release(addr, old, old+incr));
 
1335
     return old;
 
1336
   }
 
1337
#  define AO_HAVE_int_fetch_and_add_release
 
1338
#endif
 
1339
 
 
1340
#if defined(AO_HAVE_int_fetch_and_add_full)
 
1341
#  if !defined(AO_HAVE_int_fetch_and_add_release)
 
1342
#    define AO_int_fetch_and_add_release(addr, val) \
 
1343
         AO_int_fetch_and_add_full(addr, val)
 
1344
#    define AO_HAVE_int_fetch_and_add_release
 
1345
#  endif
 
1346
#  if !defined(AO_HAVE_int_fetch_and_add_acquire)
 
1347
#    define AO_int_fetch_and_add_acquire(addr, val) \
 
1348
         AO_int_fetch_and_add_full(addr, val)
 
1349
#    define AO_HAVE_int_fetch_and_add_acquire
 
1350
#  endif
 
1351
#  if !defined(AO_HAVE_int_fetch_and_add_write)
 
1352
#    define AO_int_fetch_and_add_write(addr, val) \
 
1353
         AO_int_fetch_and_add_full(addr, val)
 
1354
#    define AO_HAVE_int_fetch_and_add_write
 
1355
#  endif
 
1356
#  if !defined(AO_HAVE_int_fetch_and_add_read)
 
1357
#    define AO_int_fetch_and_add_read(addr, val) \
 
1358
         AO_int_fetch_and_add_full(addr, val)
 
1359
#    define AO_HAVE_int_fetch_and_add_read
 
1360
#  endif
 
1361
#endif /* AO_HAVE_int_fetch_and_add_full */
 
1362
 
 
1363
#if !defined(AO_HAVE_int_fetch_and_add) && \
 
1364
    defined(AO_HAVE_int_fetch_and_add_release)
 
1365
#  define AO_int_fetch_and_add(addr, val) \
 
1366
        AO_int_fetch_and_add_release(addr, val)
 
1367
#  define AO_HAVE_int_fetch_and_add
 
1368
#endif
 
1369
#if !defined(AO_HAVE_int_fetch_and_add) && \
 
1370
    defined(AO_HAVE_int_fetch_and_add_acquire)
 
1371
#  define AO_int_fetch_and_add(addr, val) \
 
1372
        AO_int_fetch_and_add_acquire(addr, val)
 
1373
#  define AO_HAVE_int_fetch_and_add
 
1374
#endif
 
1375
#if !defined(AO_HAVE_int_fetch_and_add) && \
 
1376
    defined(AO_HAVE_int_fetch_and_add_write)
 
1377
#  define AO_int_fetch_and_add(addr, val) \
 
1378
        AO_int_fetch_and_add_write(addr, val)
 
1379
#  define AO_HAVE_int_fetch_and_add
 
1380
#endif
 
1381
#if !defined(AO_HAVE_int_fetch_and_add) && \
 
1382
    defined(AO_HAVE_int_fetch_and_add_read)
 
1383
#  define AO_int_fetch_and_add(addr, val) \
 
1384
        AO_int_fetch_and_add_read(addr, val)
 
1385
#  define AO_HAVE_int_fetch_and_add
 
1386
#endif
 
1387
 
 
1388
#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
 
1389
    defined(AO_HAVE_nop_full) && \
 
1390
    !defined(AO_HAVE_int_fetch_and_add_full)
 
1391
#  define AO_int_fetch_and_add_full(addr, val) \
 
1392
        (AO_nop_full(), AO_int_fetch_and_add_acquire(addr, val))
 
1393
#endif
 
1394
 
 
1395
#if !defined(AO_HAVE_int_fetch_and_add_release_write) && \
 
1396
    defined(AO_HAVE_int_fetch_and_add_write)
 
1397
#  define AO_int_fetch_and_add_release_write(addr, val) \
 
1398
        AO_int_fetch_and_add_write(addr, val)
 
1399
#  define AO_HAVE_int_fetch_and_add_release_write
 
1400
#endif
 
1401
#if !defined(AO_HAVE_int_fetch_and_add_release_write) && \
 
1402
    defined(AO_HAVE_int_fetch_and_add_release)
 
1403
#  define AO_int_fetch_and_add_release_write(addr, val) \
 
1404
        AO_int_fetch_and_add_release(addr, val)
 
1405
#  define AO_HAVE_int_fetch_and_add_release_write
 
1406
#endif
 
1407
#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \
 
1408
    defined(AO_HAVE_int_fetch_and_add_read)
 
1409
#  define AO_int_fetch_and_add_acquire_read(addr, val) \
 
1410
        AO_int_fetch_and_add_read(addr, val)
 
1411
#  define AO_HAVE_int_fetch_and_add_acquire_read
 
1412
#endif
 
1413
#if !defined(AO_HAVE_int_fetch_and_add_acquire_read) && \
 
1414
    defined(AO_HAVE_int_fetch_and_add_acquire)
 
1415
#  define AO_int_fetch_and_add_acquire_read(addr, val) \
 
1416
        AO_int_fetch_and_add_acquire(addr, val)
 
1417
#  define AO_HAVE_int_fetch_and_add_acquire_read
 
1418
#endif
 
1419
 
 
1420
#ifdef AO_NO_DD_ORDERING
 
1421
#  if defined(AO_HAVE_int_fetch_and_add_acquire_read)
 
1422
#    define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
 
1423
        AO_int_fetch_and_add_acquire_read(addr, val)
 
1424
#    define AO_HAVE_int_fetch_and_add_dd_acquire_read
 
1425
#  endif
 
1426
#else
 
1427
#  if defined(AO_HAVE_int_fetch_and_add)
 
1428
#    define AO_int_fetch_and_add_dd_acquire_read(addr, val) \
 
1429
        AO_int_fetch_and_add(addr, val)
 
1430
#    define AO_HAVE_int_fetch_and_add_dd_acquire_read
 
1431
#  endif
 
1432
#endif
 
1433
  
 
1434
/* int_fetch_and_add1 */
 
1435
 
 
1436
#if defined(AO_HAVE_int_fetch_and_add_full) &&\
 
1437
    !defined(AO_HAVE_int_fetch_and_add1_full)
 
1438
#  define AO_int_fetch_and_add1_full(addr) \
 
1439
        AO_int_fetch_and_add_full(addr,1)
 
1440
#  define AO_HAVE_int_fetch_and_add1_full
 
1441
#endif
 
1442
#if defined(AO_HAVE_int_fetch_and_add_release) &&\
 
1443
    !defined(AO_HAVE_int_fetch_and_add1_release)
 
1444
#  define AO_int_fetch_and_add1_release(addr) \
 
1445
        AO_int_fetch_and_add_release(addr,1)
 
1446
#  define AO_HAVE_int_fetch_and_add1_release
 
1447
#endif
 
1448
#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
 
1449
    !defined(AO_HAVE_int_fetch_and_add1_acquire)
 
1450
#  define AO_int_fetch_and_add1_acquire(addr) \
 
1451
        AO_int_fetch_and_add_acquire(addr,1)
 
1452
#  define AO_HAVE_int_fetch_and_add1_acquire
 
1453
#endif
 
1454
#if defined(AO_HAVE_int_fetch_and_add_write) &&\
 
1455
    !defined(AO_HAVE_int_fetch_and_add1_write)
 
1456
#  define AO_int_fetch_and_add1_write(addr) \
 
1457
        AO_int_fetch_and_add_write(addr,1)
 
1458
#  define AO_HAVE_int_fetch_and_add1_write
 
1459
#endif
 
1460
#if defined(AO_HAVE_int_fetch_and_add_read) &&\
 
1461
    !defined(AO_HAVE_int_fetch_and_add1_read)
 
1462
#  define AO_int_fetch_and_add1_read(addr) \
 
1463
        AO_int_fetch_and_add_read(addr,1)
 
1464
#  define AO_HAVE_int_fetch_and_add1_read
 
1465
#endif
 
1466
#if defined(AO_HAVE_int_fetch_and_add_release_write) &&\
 
1467
    !defined(AO_HAVE_int_fetch_and_add1_release_write)
 
1468
#  define AO_int_fetch_and_add1_release_write(addr) \
 
1469
        AO_int_fetch_and_add_release_write(addr,1)
 
1470
#  define AO_HAVE_int_fetch_and_add1_release_write
 
1471
#endif
 
1472
#if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\
 
1473
    !defined(AO_HAVE_int_fetch_and_add1_acquire_read)
 
1474
#  define AO_int_fetch_and_add1_acquire_read(addr) \
 
1475
        AO_int_fetch_and_add_acquire_read(addr,1)
 
1476
#  define AO_HAVE_int_fetch_and_add1_acquire_read
 
1477
#endif
 
1478
#if defined(AO_HAVE_int_fetch_and_add) &&\
 
1479
    !defined(AO_HAVE_int_fetch_and_add1)
 
1480
#  define AO_int_fetch_and_add1(addr) \
 
1481
        AO_int_fetch_and_add(addr,1)
 
1482
#  define AO_HAVE_int_fetch_and_add1
 
1483
#endif
 
1484
 
 
1485
#if defined(AO_HAVE_int_fetch_and_add1_full)
 
1486
#  if !defined(AO_HAVE_int_fetch_and_add1_release)
 
1487
#    define AO_int_fetch_and_add1_release(addr) \
 
1488
         AO_int_fetch_and_add1_full(addr)
 
1489
#    define AO_HAVE_int_fetch_and_add1_release
 
1490
#  endif
 
1491
#  if !defined(AO_HAVE_int_fetch_and_add1_acquire)
 
1492
#    define AO_int_fetch_and_add1_acquire(addr) \
 
1493
         AO_int_fetch_and_add1_full(addr)
 
1494
#    define AO_HAVE_int_fetch_and_add1_acquire
 
1495
#  endif
 
1496
#  if !defined(AO_HAVE_int_fetch_and_add1_write)
 
1497
#    define AO_int_fetch_and_add1_write(addr) \
 
1498
         AO_int_fetch_and_add1_full(addr)
 
1499
#    define AO_HAVE_int_fetch_and_add1_write
 
1500
#  endif
 
1501
#  if !defined(AO_HAVE_int_fetch_and_add1_read)
 
1502
#    define AO_int_fetch_and_add1_read(addr) \
 
1503
         AO_int_fetch_and_add1_full(addr)
 
1504
#    define AO_HAVE_int_fetch_and_add1_read
 
1505
#  endif
 
1506
#endif /* AO_HAVE_int_fetch_and_add1_full */
 
1507
 
 
1508
#if !defined(AO_HAVE_int_fetch_and_add1) && \
 
1509
    defined(AO_HAVE_int_fetch_and_add1_release)
 
1510
#  define AO_int_fetch_and_add1(addr) \
 
1511
        AO_int_fetch_and_add1_release(addr)
 
1512
#  define AO_HAVE_int_fetch_and_add1
 
1513
#endif
 
1514
#if !defined(AO_HAVE_int_fetch_and_add1) && \
 
1515
    defined(AO_HAVE_int_fetch_and_add1_acquire)
 
1516
#  define AO_int_fetch_and_add1(addr) \
 
1517
        AO_int_fetch_and_add1_acquire(addr)
 
1518
#  define AO_HAVE_int_fetch_and_add1
 
1519
#endif
 
1520
#if !defined(AO_HAVE_int_fetch_and_add1) && \
 
1521
    defined(AO_HAVE_int_fetch_and_add1_write)
 
1522
#  define AO_int_fetch_and_add1(addr) \
 
1523
        AO_int_fetch_and_add1_write(addr)
 
1524
#  define AO_HAVE_int_fetch_and_add1
 
1525
#endif
 
1526
#if !defined(AO_HAVE_int_fetch_and_add1) && \
 
1527
    defined(AO_HAVE_int_fetch_and_add1_read)
 
1528
#  define AO_int_fetch_and_add1(addr) \
 
1529
        AO_int_fetch_and_add1_read(addr)
 
1530
#  define AO_HAVE_int_fetch_and_add1
 
1531
#endif
 
1532
 
 
1533
#if defined(AO_HAVE_int_fetch_and_add1_acquire) &&\
 
1534
    defined(AO_HAVE_nop_full) && \
 
1535
    !defined(AO_HAVE_int_fetch_and_add1_full)
 
1536
#  define AO_int_fetch_and_add1_full(addr) \
 
1537
        (AO_nop_full(), AO_int_fetch_and_add1_acquire(addr))
 
1538
#  define AO_HAVE_int_fetch_and_add1_full
 
1539
#endif
 
1540
 
 
1541
#if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \
 
1542
    defined(AO_HAVE_int_fetch_and_add1_write)
 
1543
#  define AO_int_fetch_and_add1_release_write(addr) \
 
1544
        AO_int_fetch_and_add1_write(addr)
 
1545
#  define AO_HAVE_int_fetch_and_add1_release_write
 
1546
#endif
 
1547
#if !defined(AO_HAVE_int_fetch_and_add1_release_write) && \
 
1548
    defined(AO_HAVE_int_fetch_and_add1_release)
 
1549
#  define AO_int_fetch_and_add1_release_write(addr) \
 
1550
        AO_int_fetch_and_add1_release(addr)
 
1551
#  define AO_HAVE_int_fetch_and_add1_release_write
 
1552
#endif
 
1553
#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \
 
1554
    defined(AO_HAVE_int_fetch_and_add1_read)
 
1555
#  define AO_int_fetch_and_add1_acquire_read(addr) \
 
1556
        AO_int_fetch_and_add1_read(addr)
 
1557
#  define AO_HAVE_int_fetch_and_add1_acquire_read
 
1558
#endif
 
1559
#if !defined(AO_HAVE_int_fetch_and_add1_acquire_read) && \
 
1560
    defined(AO_HAVE_int_fetch_and_add1_acquire)
 
1561
#  define AO_int_fetch_and_add1_acquire_read(addr) \
 
1562
        AO_int_fetch_and_add1_acquire(addr)
 
1563
#  define AO_HAVE_int_fetch_and_add1_acquire_read
 
1564
#endif
 
1565
 
 
1566
#ifdef AO_NO_DD_ORDERING
 
1567
#  if defined(AO_HAVE_int_fetch_and_add1_acquire_read)
 
1568
#    define AO_int_fetch_and_add1_dd_acquire_read(addr) \
 
1569
        AO_int_fetch_and_add1_acquire_read(addr)
 
1570
#    define AO_HAVE_int_fetch_and_add1_dd_acquire_read
 
1571
#  endif
 
1572
#else
 
1573
#  if defined(AO_HAVE_int_fetch_and_add1)
 
1574
#    define AO_int_fetch_and_add1_dd_acquire_read(addr) \
 
1575
        AO_int_fetch_and_add1(addr)
 
1576
#    define AO_HAVE_int_fetch_and_add1_dd_acquire_read
 
1577
#  endif
 
1578
#endif
 
1579
 
 
1580
/* int_fetch_and_sub1 */
 
1581
 
 
1582
#if defined(AO_HAVE_int_fetch_and_add_full) &&\
 
1583
    !defined(AO_HAVE_int_fetch_and_sub1_full)
 
1584
#  define AO_int_fetch_and_sub1_full(addr) \
 
1585
        AO_int_fetch_and_add_full(addr,(unsigned int)(-1))
 
1586
#  define AO_HAVE_int_fetch_and_sub1_full
 
1587
#endif
 
1588
#if defined(AO_HAVE_int_fetch_and_add_release) &&\
 
1589
    !defined(AO_HAVE_int_fetch_and_sub1_release)
 
1590
#  define AO_int_fetch_and_sub1_release(addr) \
 
1591
        AO_int_fetch_and_add_release(addr,(unsigned int)(-1))
 
1592
#  define AO_HAVE_int_fetch_and_sub1_release
 
1593
#endif
 
1594
#if defined(AO_HAVE_int_fetch_and_add_acquire) &&\
 
1595
    !defined(AO_HAVE_int_fetch_and_sub1_acquire)
 
1596
#  define AO_int_fetch_and_sub1_acquire(addr) \
 
1597
        AO_int_fetch_and_add_acquire(addr,(unsigned int)(-1))
 
1598
#  define AO_HAVE_int_fetch_and_sub1_acquire
 
1599
#endif
 
1600
#if defined(AO_HAVE_int_fetch_and_add_write) &&\
 
1601
    !defined(AO_HAVE_int_fetch_and_sub1_write)
 
1602
#  define AO_int_fetch_and_sub1_write(addr) \
 
1603
        AO_int_fetch_and_add_write(addr,(unsigned int)(-1))
 
1604
#  define AO_HAVE_int_fetch_and_sub1_write
 
1605
#endif
 
1606
#if defined(AO_HAVE_int_fetch_and_add_read) &&\
 
1607
    !defined(AO_HAVE_int_fetch_and_sub1_read)
 
1608
#  define AO_int_fetch_and_sub1_read(addr) \
 
1609
        AO_int_fetch_and_add_read(addr,(unsigned int)(-1))
 
1610
#  define AO_HAVE_int_fetch_and_sub1_read
 
1611
#endif
 
1612
#if defined(AO_HAVE_int_fetch_and_add_release_write) &&\
 
1613
    !defined(AO_HAVE_int_fetch_and_sub1_release_write)
 
1614
#  define AO_int_fetch_and_sub1_release_write(addr) \
 
1615
        AO_int_fetch_and_add_release_write(addr,(unsigned int)(-1))
 
1616
#  define AO_HAVE_int_fetch_and_sub1_release_write
 
1617
#endif
 
1618
#if defined(AO_HAVE_int_fetch_and_add_acquire_read) &&\
 
1619
    !defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
 
1620
#  define AO_int_fetch_and_sub1_acquire_read(addr) \
 
1621
        AO_int_fetch_and_add_acquire_read(addr,(unsigned int)(-1))
 
1622
#  define AO_HAVE_int_fetch_and_sub1_acquire_read
 
1623
#endif
 
1624
#if defined(AO_HAVE_int_fetch_and_add) &&\
 
1625
    !defined(AO_HAVE_int_fetch_and_sub1)
 
1626
#  define AO_int_fetch_and_sub1(addr) \
 
1627
        AO_int_fetch_and_add(addr,(unsigned int)(-1))
 
1628
#  define AO_HAVE_int_fetch_and_sub1
 
1629
#endif
 
1630
 
 
1631
#if defined(AO_HAVE_int_fetch_and_sub1_full)
 
1632
#  if !defined(AO_HAVE_int_fetch_and_sub1_release)
 
1633
#    define AO_int_fetch_and_sub1_release(addr) \
 
1634
         AO_int_fetch_and_sub1_full(addr)
 
1635
#    define AO_HAVE_int_fetch_and_sub1_release
 
1636
#  endif
 
1637
#  if !defined(AO_HAVE_int_fetch_and_sub1_acquire)
 
1638
#    define AO_int_fetch_and_sub1_acquire(addr) \
 
1639
         AO_int_fetch_and_sub1_full(addr)
 
1640
#    define AO_HAVE_int_fetch_and_sub1_acquire
 
1641
#  endif
 
1642
#  if !defined(AO_HAVE_int_fetch_and_sub1_write)
 
1643
#    define AO_int_fetch_and_sub1_write(addr) \
 
1644
         AO_int_fetch_and_sub1_full(addr)
 
1645
#    define AO_HAVE_int_fetch_and_sub1_write
 
1646
#  endif
 
1647
#  if !defined(AO_HAVE_int_fetch_and_sub1_read)
 
1648
#    define AO_int_fetch_and_sub1_read(addr) \
 
1649
         AO_int_fetch_and_sub1_full(addr)
 
1650
#    define AO_HAVE_int_fetch_and_sub1_read
 
1651
#  endif
 
1652
#endif /* AO_HAVE_int_fetch_and_sub1_full */
 
1653
 
 
1654
#if !defined(AO_HAVE_int_fetch_and_sub1) && \
 
1655
    defined(AO_HAVE_int_fetch_and_sub1_release)
 
1656
#  define AO_int_fetch_and_sub1(addr) \
 
1657
        AO_int_fetch_and_sub1_release(addr)
 
1658
#  define AO_HAVE_int_fetch_and_sub1
 
1659
#endif
 
1660
#if !defined(AO_HAVE_int_fetch_and_sub1) && \
 
1661
    defined(AO_HAVE_int_fetch_and_sub1_acquire)
 
1662
#  define AO_int_fetch_and_sub1(addr) \
 
1663
        AO_int_fetch_and_sub1_acquire(addr)
 
1664
#  define AO_HAVE_int_fetch_and_sub1
 
1665
#endif
 
1666
#if !defined(AO_HAVE_int_fetch_and_sub1) && \
 
1667
    defined(AO_HAVE_int_fetch_and_sub1_write)
 
1668
#  define AO_int_fetch_and_sub1(addr) \
 
1669
        AO_int_fetch_and_sub1_write(addr)
 
1670
#  define AO_HAVE_int_fetch_and_sub1
 
1671
#endif
 
1672
#if !defined(AO_HAVE_int_fetch_and_sub1) && \
 
1673
    defined(AO_HAVE_int_fetch_and_sub1_read)
 
1674
#  define AO_int_fetch_and_sub1(addr) \
 
1675
        AO_int_fetch_and_sub1_read(addr)
 
1676
#  define AO_HAVE_int_fetch_and_sub1
 
1677
#endif
 
1678
 
 
1679
#if defined(AO_HAVE_int_fetch_and_sub1_acquire) &&\
 
1680
    defined(AO_HAVE_nop_full) && \
 
1681
    !defined(AO_HAVE_int_fetch_and_sub1_full)
 
1682
#  define AO_int_fetch_and_sub1_full(addr) \
 
1683
        (AO_nop_full(), AO_int_fetch_and_sub1_acquire(addr))
 
1684
#  define AO_HAVE_int_fetch_and_sub1_full
 
1685
#endif
 
1686
 
 
1687
#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \
 
1688
    defined(AO_HAVE_int_fetch_and_sub1_write)
 
1689
#  define AO_int_fetch_and_sub1_release_write(addr) \
 
1690
        AO_int_fetch_and_sub1_write(addr)
 
1691
#  define AO_HAVE_int_fetch_and_sub1_release_write
 
1692
#endif
 
1693
#if !defined(AO_HAVE_int_fetch_and_sub1_release_write) && \
 
1694
    defined(AO_HAVE_int_fetch_and_sub1_release)
 
1695
#  define AO_int_fetch_and_sub1_release_write(addr) \
 
1696
        AO_int_fetch_and_sub1_release(addr)
 
1697
#  define AO_HAVE_int_fetch_and_sub1_release_write
 
1698
#endif
 
1699
#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \
 
1700
    defined(AO_HAVE_int_fetch_and_sub1_read)
 
1701
#  define AO_int_fetch_and_sub1_acquire_read(addr) \
 
1702
        AO_int_fetch_and_sub1_read(addr)
 
1703
#  define AO_HAVE_int_fetch_and_sub1_acquire_read
 
1704
#endif
 
1705
#if !defined(AO_HAVE_int_fetch_and_sub1_acquire_read) && \
 
1706
    defined(AO_HAVE_int_fetch_and_sub1_acquire)
 
1707
#  define AO_int_fetch_and_sub1_acquire_read(addr) \
 
1708
        AO_int_fetch_and_sub1_acquire(addr)
 
1709
#  define AO_HAVE_int_fetch_and_sub1_acquire_read
 
1710
#endif
 
1711
 
 
1712
#ifdef AO_NO_DD_ORDERING
 
1713
#  if defined(AO_HAVE_int_fetch_and_sub1_acquire_read)
 
1714
#    define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
 
1715
        AO_int_fetch_and_sub1_acquire_read(addr)
 
1716
#    define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
 
1717
#  endif
 
1718
#else
 
1719
#  if defined(AO_HAVE_int_fetch_and_sub1)
 
1720
#    define AO_int_fetch_and_sub1_dd_acquire_read(addr) \
 
1721
        AO_int_fetch_and_sub1(addr)
 
1722
#    define AO_HAVE_int_fetch_and_sub1_dd_acquire_read
 
1723
#  endif
 
1724
#endif
 
1725