PAPI 7.1.0.0
Loading...
Searching...
No Matches
generic-arithm.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
3 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
4 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
5 *
6 *
7 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
8 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
9 *
10 * Permission is hereby granted to use or copy this program
11 * for any purpose, provided the above notices are retained on all copies.
12 * Permission to modify the code and to distribute modified code is granted,
13 * provided the above notices are retained, and a notice that the code was
14 * modified is included with the above copyright notice.
15 *
16 */
17
18#ifndef AO_NO_char_ARITHM
19
20AO_INLINE unsignedchar
21AO_char_fetch_and_add(volatile unsignedchar *addr, unsignedchar incr)
22{
23 return __atomic_fetch_add(addr, incr, __ATOMIC_RELAXED);
24}
25#define AO_HAVE_char_fetch_and_add
26
27#ifndef AO_SKIPATOMIC_ANY_and_ANY
28 AO_INLINE void
29 AO_char_and(volatile unsignedchar *addr, unsignedchar value)
30 {
31 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELAXED);
32 }
33# define AO_HAVE_char_and
34#endif
35
36#ifndef AO_SKIPATOMIC_ANY_or_ANY
37 AO_INLINE void
38 AO_char_or(volatile unsignedchar *addr, unsignedchar value)
39 {
40 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELAXED);
41 }
42# define AO_HAVE_char_or
43#endif
44
45#ifndef AO_SKIPATOMIC_ANY_xor_ANY
46 AO_INLINE void
47 AO_char_xor(volatile unsignedchar *addr, unsignedchar value)
48 {
49 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELAXED);
50 }
51# define AO_HAVE_char_xor
52#endif
53
54#endif /* !AO_NO_char_ARITHM */
55/*
56 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
57 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
58 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
59 *
60 *
61 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
62 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
63 *
64 * Permission is hereby granted to use or copy this program
65 * for any purpose, provided the above notices are retained on all copies.
66 * Permission to modify the code and to distribute modified code is granted,
67 * provided the above notices are retained, and a notice that the code was
68 * modified is included with the above copyright notice.
69 *
70 */
71
72#ifndef AO_NO_short_ARITHM
73
74AO_INLINE unsignedshort
75AO_short_fetch_and_add(volatile unsignedshort *addr, unsignedshort incr)
76{
77 return __atomic_fetch_add(addr, incr, __ATOMIC_RELAXED);
78}
79#define AO_HAVE_short_fetch_and_add
80
81#ifndef AO_SKIPATOMIC_ANY_and_ANY
82 AO_INLINE void
83 AO_short_and(volatile unsignedshort *addr, unsignedshort value)
84 {
85 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELAXED);
86 }
87# define AO_HAVE_short_and
88#endif
89
90#ifndef AO_SKIPATOMIC_ANY_or_ANY
91 AO_INLINE void
92 AO_short_or(volatile unsignedshort *addr, unsignedshort value)
93 {
94 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELAXED);
95 }
96# define AO_HAVE_short_or
97#endif
98
99#ifndef AO_SKIPATOMIC_ANY_xor_ANY
100 AO_INLINE void
101 AO_short_xor(volatile unsignedshort *addr, unsignedshort value)
102 {
103 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELAXED);
104 }
105# define AO_HAVE_short_xor
106#endif
107
108#endif /* !AO_NO_short_ARITHM */
109/*
110 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
111 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
112 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
113 *
114 *
115 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
116 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
117 *
118 * Permission is hereby granted to use or copy this program
119 * for any purpose, provided the above notices are retained on all copies.
120 * Permission to modify the code and to distribute modified code is granted,
121 * provided the above notices are retained, and a notice that the code was
122 * modified is included with the above copyright notice.
123 *
124 */
125
126#ifndef AO_NO_int_ARITHM
127
128AO_INLINE unsigned
129AO_int_fetch_and_add(volatile unsigned *addr, unsigned incr)
130{
131 return __atomic_fetch_add(addr, incr, __ATOMIC_RELAXED);
132}
133#define AO_HAVE_int_fetch_and_add
134
135#ifndef AO_SKIPATOMIC_ANY_and_ANY
136 AO_INLINE void
137 AO_int_and(volatile unsigned *addr, unsigned value)
138 {
139 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELAXED);
140 }
141# define AO_HAVE_int_and
142#endif
143
144#ifndef AO_SKIPATOMIC_ANY_or_ANY
145 AO_INLINE void
146 AO_int_or(volatile unsigned *addr, unsigned value)
147 {
148 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELAXED);
149 }
150# define AO_HAVE_int_or
151#endif
152
153#ifndef AO_SKIPATOMIC_ANY_xor_ANY
154 AO_INLINE void
155 AO_int_xor(volatile unsigned *addr, unsigned value)
156 {
157 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELAXED);
158 }
159# define AO_HAVE_int_xor
160#endif
161
162#endif /* !AO_NO_int_ARITHM */
163/*
164 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
165 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
166 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
167 *
168 *
169 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
170 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
171 *
172 * Permission is hereby granted to use or copy this program
173 * for any purpose, provided the above notices are retained on all copies.
174 * Permission to modify the code and to distribute modified code is granted,
175 * provided the above notices are retained, and a notice that the code was
176 * modified is included with the above copyright notice.
177 *
178 */
179
180#ifndef AO_NO_ARITHM
181
183AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
184{
185 return __atomic_fetch_add(addr, incr, __ATOMIC_RELAXED);
186}
187#define AO_HAVE_fetch_and_add
188
189#ifndef AO_SKIPATOMIC_ANY_and_ANY
190 AO_INLINE void
191 AO_and(volatile AO_t *addr, AO_t value)
192 {
193 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELAXED);
194 }
195# define AO_HAVE_and
196#endif
197
198#ifndef AO_SKIPATOMIC_ANY_or_ANY
199 AO_INLINE void
200 AO_or(volatile AO_t *addr, AO_t value)
201 {
202 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELAXED);
203 }
204# define AO_HAVE_or
205#endif
206
207#ifndef AO_SKIPATOMIC_ANY_xor_ANY
208 AO_INLINE void
209 AO_xor(volatile AO_t *addr, AO_t value)
210 {
211 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELAXED);
212 }
213# define AO_HAVE_xor
214#endif
215
216#endif /* !AO_NO_ARITHM */
217/*
218 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
219 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
220 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
221 *
222 *
223 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
224 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
225 *
226 * Permission is hereby granted to use or copy this program
227 * for any purpose, provided the above notices are retained on all copies.
228 * Permission to modify the code and to distribute modified code is granted,
229 * provided the above notices are retained, and a notice that the code was
230 * modified is included with the above copyright notice.
231 *
232 */
233
234#ifndef AO_NO_char_ARITHM
235
236AO_INLINE unsignedchar
237AO_char_fetch_and_add_acquire(volatile unsignedchar *addr, unsignedchar incr)
238{
239 return __atomic_fetch_add(addr, incr, __ATOMIC_ACQUIRE);
240}
241#define AO_HAVE_char_fetch_and_add_acquire
242
243#ifndef AO_SKIPATOMIC_ANY_and_ANY
244 AO_INLINE void
245 AO_char_and_acquire(volatile unsignedchar *addr, unsignedchar value)
246 {
247 (void)__atomic_and_fetch(addr, value, __ATOMIC_ACQUIRE);
248 }
249# define AO_HAVE_char_and_acquire
250#endif
251
252#ifndef AO_SKIPATOMIC_ANY_or_ANY
253 AO_INLINE void
254 AO_char_or_acquire(volatile unsignedchar *addr, unsignedchar value)
255 {
256 (void)__atomic_or_fetch(addr, value, __ATOMIC_ACQUIRE);
257 }
258# define AO_HAVE_char_or_acquire
259#endif
260
261#ifndef AO_SKIPATOMIC_ANY_xor_ANY
262 AO_INLINE void
263 AO_char_xor_acquire(volatile unsignedchar *addr, unsignedchar value)
264 {
265 (void)__atomic_xor_fetch(addr, value, __ATOMIC_ACQUIRE);
266 }
267# define AO_HAVE_char_xor_acquire
268#endif
269
270#endif /* !AO_NO_char_ARITHM */
271/*
272 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
273 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
274 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
275 *
276 *
277 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
278 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
279 *
280 * Permission is hereby granted to use or copy this program
281 * for any purpose, provided the above notices are retained on all copies.
282 * Permission to modify the code and to distribute modified code is granted,
283 * provided the above notices are retained, and a notice that the code was
284 * modified is included with the above copyright notice.
285 *
286 */
287
288#ifndef AO_NO_short_ARITHM
289
290AO_INLINE unsignedshort
291AO_short_fetch_and_add_acquire(volatile unsignedshort *addr, unsignedshort incr)
292{
293 return __atomic_fetch_add(addr, incr, __ATOMIC_ACQUIRE);
294}
295#define AO_HAVE_short_fetch_and_add_acquire
296
297#ifndef AO_SKIPATOMIC_ANY_and_ANY
298 AO_INLINE void
299 AO_short_and_acquire(volatile unsignedshort *addr, unsignedshort value)
300 {
301 (void)__atomic_and_fetch(addr, value, __ATOMIC_ACQUIRE);
302 }
303# define AO_HAVE_short_and_acquire
304#endif
305
306#ifndef AO_SKIPATOMIC_ANY_or_ANY
307 AO_INLINE void
308 AO_short_or_acquire(volatile unsignedshort *addr, unsignedshort value)
309 {
310 (void)__atomic_or_fetch(addr, value, __ATOMIC_ACQUIRE);
311 }
312# define AO_HAVE_short_or_acquire
313#endif
314
315#ifndef AO_SKIPATOMIC_ANY_xor_ANY
316 AO_INLINE void
317 AO_short_xor_acquire(volatile unsignedshort *addr, unsignedshort value)
318 {
319 (void)__atomic_xor_fetch(addr, value, __ATOMIC_ACQUIRE);
320 }
321# define AO_HAVE_short_xor_acquire
322#endif
323
324#endif /* !AO_NO_short_ARITHM */
325/*
326 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
327 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
328 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
329 *
330 *
331 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
332 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
333 *
334 * Permission is hereby granted to use or copy this program
335 * for any purpose, provided the above notices are retained on all copies.
336 * Permission to modify the code and to distribute modified code is granted,
337 * provided the above notices are retained, and a notice that the code was
338 * modified is included with the above copyright notice.
339 *
340 */
341
342#ifndef AO_NO_int_ARITHM
343
344AO_INLINE unsigned
345AO_int_fetch_and_add_acquire(volatile unsigned *addr, unsigned incr)
346{
347 return __atomic_fetch_add(addr, incr, __ATOMIC_ACQUIRE);
348}
349#define AO_HAVE_int_fetch_and_add_acquire
350
351#ifndef AO_SKIPATOMIC_ANY_and_ANY
352 AO_INLINE void
353 AO_int_and_acquire(volatile unsigned *addr, unsigned value)
354 {
355 (void)__atomic_and_fetch(addr, value, __ATOMIC_ACQUIRE);
356 }
357# define AO_HAVE_int_and_acquire
358#endif
359
360#ifndef AO_SKIPATOMIC_ANY_or_ANY
361 AO_INLINE void
362 AO_int_or_acquire(volatile unsigned *addr, unsigned value)
363 {
364 (void)__atomic_or_fetch(addr, value, __ATOMIC_ACQUIRE);
365 }
366# define AO_HAVE_int_or_acquire
367#endif
368
369#ifndef AO_SKIPATOMIC_ANY_xor_ANY
370 AO_INLINE void
371 AO_int_xor_acquire(volatile unsigned *addr, unsigned value)
372 {
373 (void)__atomic_xor_fetch(addr, value, __ATOMIC_ACQUIRE);
374 }
375# define AO_HAVE_int_xor_acquire
376#endif
377
378#endif /* !AO_NO_int_ARITHM */
379/*
380 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
381 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
382 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
383 *
384 *
385 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
386 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
387 *
388 * Permission is hereby granted to use or copy this program
389 * for any purpose, provided the above notices are retained on all copies.
390 * Permission to modify the code and to distribute modified code is granted,
391 * provided the above notices are retained, and a notice that the code was
392 * modified is included with the above copyright notice.
393 *
394 */
395
396#ifndef AO_NO_ARITHM
397
399AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
400{
401 return __atomic_fetch_add(addr, incr, __ATOMIC_ACQUIRE);
402}
403#define AO_HAVE_fetch_and_add_acquire
404
405#ifndef AO_SKIPATOMIC_ANY_and_ANY
406 AO_INLINE void
407 AO_and_acquire(volatile AO_t *addr, AO_t value)
408 {
409 (void)__atomic_and_fetch(addr, value, __ATOMIC_ACQUIRE);
410 }
411# define AO_HAVE_and_acquire
412#endif
413
414#ifndef AO_SKIPATOMIC_ANY_or_ANY
415 AO_INLINE void
416 AO_or_acquire(volatile AO_t *addr, AO_t value)
417 {
418 (void)__atomic_or_fetch(addr, value, __ATOMIC_ACQUIRE);
419 }
420# define AO_HAVE_or_acquire
421#endif
422
423#ifndef AO_SKIPATOMIC_ANY_xor_ANY
424 AO_INLINE void
425 AO_xor_acquire(volatile AO_t *addr, AO_t value)
426 {
427 (void)__atomic_xor_fetch(addr, value, __ATOMIC_ACQUIRE);
428 }
429# define AO_HAVE_xor_acquire
430#endif
431
432#endif /* !AO_NO_ARITHM */
433/*
434 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
435 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
436 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
437 *
438 *
439 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
440 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
441 *
442 * Permission is hereby granted to use or copy this program
443 * for any purpose, provided the above notices are retained on all copies.
444 * Permission to modify the code and to distribute modified code is granted,
445 * provided the above notices are retained, and a notice that the code was
446 * modified is included with the above copyright notice.
447 *
448 */
449
450#ifndef AO_NO_char_ARITHM
451
452AO_INLINE unsignedchar
453AO_char_fetch_and_add_release(volatile unsignedchar *addr, unsignedchar incr)
454{
455 return __atomic_fetch_add(addr, incr, __ATOMIC_RELEASE);
456}
457#define AO_HAVE_char_fetch_and_add_release
458
459#ifndef AO_SKIPATOMIC_ANY_and_ANY
460 AO_INLINE void
461 AO_char_and_release(volatile unsignedchar *addr, unsignedchar value)
462 {
463 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELEASE);
464 }
465# define AO_HAVE_char_and_release
466#endif
467
468#ifndef AO_SKIPATOMIC_ANY_or_ANY
469 AO_INLINE void
470 AO_char_or_release(volatile unsignedchar *addr, unsignedchar value)
471 {
472 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELEASE);
473 }
474# define AO_HAVE_char_or_release
475#endif
476
477#ifndef AO_SKIPATOMIC_ANY_xor_ANY
478 AO_INLINE void
479 AO_char_xor_release(volatile unsignedchar *addr, unsignedchar value)
480 {
481 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELEASE);
482 }
483# define AO_HAVE_char_xor_release
484#endif
485
486#endif /* !AO_NO_char_ARITHM */
487/*
488 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
489 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
490 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
491 *
492 *
493 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
494 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
495 *
496 * Permission is hereby granted to use or copy this program
497 * for any purpose, provided the above notices are retained on all copies.
498 * Permission to modify the code and to distribute modified code is granted,
499 * provided the above notices are retained, and a notice that the code was
500 * modified is included with the above copyright notice.
501 *
502 */
503
504#ifndef AO_NO_short_ARITHM
505
506AO_INLINE unsignedshort
507AO_short_fetch_and_add_release(volatile unsignedshort *addr, unsignedshort incr)
508{
509 return __atomic_fetch_add(addr, incr, __ATOMIC_RELEASE);
510}
511#define AO_HAVE_short_fetch_and_add_release
512
513#ifndef AO_SKIPATOMIC_ANY_and_ANY
514 AO_INLINE void
515 AO_short_and_release(volatile unsignedshort *addr, unsignedshort value)
516 {
517 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELEASE);
518 }
519# define AO_HAVE_short_and_release
520#endif
521
522#ifndef AO_SKIPATOMIC_ANY_or_ANY
523 AO_INLINE void
524 AO_short_or_release(volatile unsignedshort *addr, unsignedshort value)
525 {
526 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELEASE);
527 }
528# define AO_HAVE_short_or_release
529#endif
530
531#ifndef AO_SKIPATOMIC_ANY_xor_ANY
532 AO_INLINE void
533 AO_short_xor_release(volatile unsignedshort *addr, unsignedshort value)
534 {
535 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELEASE);
536 }
537# define AO_HAVE_short_xor_release
538#endif
539
540#endif /* !AO_NO_short_ARITHM */
541/*
542 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
543 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
544 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
545 *
546 *
547 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
548 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
549 *
550 * Permission is hereby granted to use or copy this program
551 * for any purpose, provided the above notices are retained on all copies.
552 * Permission to modify the code and to distribute modified code is granted,
553 * provided the above notices are retained, and a notice that the code was
554 * modified is included with the above copyright notice.
555 *
556 */
557
558#ifndef AO_NO_int_ARITHM
559
560AO_INLINE unsigned
561AO_int_fetch_and_add_release(volatile unsigned *addr, unsigned incr)
562{
563 return __atomic_fetch_add(addr, incr, __ATOMIC_RELEASE);
564}
565#define AO_HAVE_int_fetch_and_add_release
566
567#ifndef AO_SKIPATOMIC_ANY_and_ANY
568 AO_INLINE void
569 AO_int_and_release(volatile unsigned *addr, unsigned value)
570 {
571 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELEASE);
572 }
573# define AO_HAVE_int_and_release
574#endif
575
576#ifndef AO_SKIPATOMIC_ANY_or_ANY
577 AO_INLINE void
578 AO_int_or_release(volatile unsigned *addr, unsigned value)
579 {
580 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELEASE);
581 }
582# define AO_HAVE_int_or_release
583#endif
584
585#ifndef AO_SKIPATOMIC_ANY_xor_ANY
586 AO_INLINE void
587 AO_int_xor_release(volatile unsigned *addr, unsigned value)
588 {
589 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELEASE);
590 }
591# define AO_HAVE_int_xor_release
592#endif
593
594#endif /* !AO_NO_int_ARITHM */
595/*
596 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
597 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
598 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
599 *
600 *
601 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
602 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
603 *
604 * Permission is hereby granted to use or copy this program
605 * for any purpose, provided the above notices are retained on all copies.
606 * Permission to modify the code and to distribute modified code is granted,
607 * provided the above notices are retained, and a notice that the code was
608 * modified is included with the above copyright notice.
609 *
610 */
611
612#ifndef AO_NO_ARITHM
613
615AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr)
616{
617 return __atomic_fetch_add(addr, incr, __ATOMIC_RELEASE);
618}
619#define AO_HAVE_fetch_and_add_release
620
621#ifndef AO_SKIPATOMIC_ANY_and_ANY
622 AO_INLINE void
623 AO_and_release(volatile AO_t *addr, AO_t value)
624 {
625 (void)__atomic_and_fetch(addr, value, __ATOMIC_RELEASE);
626 }
627# define AO_HAVE_and_release
628#endif
629
630#ifndef AO_SKIPATOMIC_ANY_or_ANY
631 AO_INLINE void
632 AO_or_release(volatile AO_t *addr, AO_t value)
633 {
634 (void)__atomic_or_fetch(addr, value, __ATOMIC_RELEASE);
635 }
636# define AO_HAVE_or_release
637#endif
638
639#ifndef AO_SKIPATOMIC_ANY_xor_ANY
640 AO_INLINE void
641 AO_xor_release(volatile AO_t *addr, AO_t value)
642 {
643 (void)__atomic_xor_fetch(addr, value, __ATOMIC_RELEASE);
644 }
645# define AO_HAVE_xor_release
646#endif
647
648#endif /* !AO_NO_ARITHM */
649/*
650 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
651 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
652 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
653 *
654 *
655 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
656 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
657 *
658 * Permission is hereby granted to use or copy this program
659 * for any purpose, provided the above notices are retained on all copies.
660 * Permission to modify the code and to distribute modified code is granted,
661 * provided the above notices are retained, and a notice that the code was
662 * modified is included with the above copyright notice.
663 *
664 */
665
666#ifndef AO_NO_char_ARITHM
667
668AO_INLINE unsignedchar
669AO_char_fetch_and_add_full(volatile unsignedchar *addr, unsignedchar incr)
670{
671 return __atomic_fetch_add(addr, incr, __ATOMIC_SEQ_CST);
672}
673#define AO_HAVE_char_fetch_and_add_full
674
675#ifndef AO_SKIPATOMIC_ANY_and_ANY
676 AO_INLINE void
677 AO_char_and_full(volatile unsignedchar *addr, unsignedchar value)
678 {
679 (void)__atomic_and_fetch(addr, value, __ATOMIC_SEQ_CST);
680 }
681# define AO_HAVE_char_and_full
682#endif
683
684#ifndef AO_SKIPATOMIC_ANY_or_ANY
685 AO_INLINE void
686 AO_char_or_full(volatile unsignedchar *addr, unsignedchar value)
687 {
688 (void)__atomic_or_fetch(addr, value, __ATOMIC_SEQ_CST);
689 }
690# define AO_HAVE_char_or_full
691#endif
692
693#ifndef AO_SKIPATOMIC_ANY_xor_ANY
694 AO_INLINE void
695 AO_char_xor_full(volatile unsignedchar *addr, unsignedchar value)
696 {
697 (void)__atomic_xor_fetch(addr, value, __ATOMIC_SEQ_CST);
698 }
699# define AO_HAVE_char_xor_full
700#endif
701
702#endif /* !AO_NO_char_ARITHM */
703/*
704 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
705 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
706 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
707 *
708 *
709 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
710 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
711 *
712 * Permission is hereby granted to use or copy this program
713 * for any purpose, provided the above notices are retained on all copies.
714 * Permission to modify the code and to distribute modified code is granted,
715 * provided the above notices are retained, and a notice that the code was
716 * modified is included with the above copyright notice.
717 *
718 */
719
720#ifndef AO_NO_short_ARITHM
721
722AO_INLINE unsignedshort
723AO_short_fetch_and_add_full(volatile unsignedshort *addr, unsignedshort incr)
724{
725 return __atomic_fetch_add(addr, incr, __ATOMIC_SEQ_CST);
726}
727#define AO_HAVE_short_fetch_and_add_full
728
729#ifndef AO_SKIPATOMIC_ANY_and_ANY
730 AO_INLINE void
731 AO_short_and_full(volatile unsignedshort *addr, unsignedshort value)
732 {
733 (void)__atomic_and_fetch(addr, value, __ATOMIC_SEQ_CST);
734 }
735# define AO_HAVE_short_and_full
736#endif
737
738#ifndef AO_SKIPATOMIC_ANY_or_ANY
739 AO_INLINE void
740 AO_short_or_full(volatile unsignedshort *addr, unsignedshort value)
741 {
742 (void)__atomic_or_fetch(addr, value, __ATOMIC_SEQ_CST);
743 }
744# define AO_HAVE_short_or_full
745#endif
746
747#ifndef AO_SKIPATOMIC_ANY_xor_ANY
748 AO_INLINE void
749 AO_short_xor_full(volatile unsignedshort *addr, unsignedshort value)
750 {
751 (void)__atomic_xor_fetch(addr, value, __ATOMIC_SEQ_CST);
752 }
753# define AO_HAVE_short_xor_full
754#endif
755
756#endif /* !AO_NO_short_ARITHM */
757/*
758 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
759 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
760 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
761 *
762 *
763 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
764 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
765 *
766 * Permission is hereby granted to use or copy this program
767 * for any purpose, provided the above notices are retained on all copies.
768 * Permission to modify the code and to distribute modified code is granted,
769 * provided the above notices are retained, and a notice that the code was
770 * modified is included with the above copyright notice.
771 *
772 */
773
774#ifndef AO_NO_int_ARITHM
775
776AO_INLINE unsigned
777AO_int_fetch_and_add_full(volatile unsigned *addr, unsigned incr)
778{
779 return __atomic_fetch_add(addr, incr, __ATOMIC_SEQ_CST);
780}
781#define AO_HAVE_int_fetch_and_add_full
782
783#ifndef AO_SKIPATOMIC_ANY_and_ANY
784 AO_INLINE void
785 AO_int_and_full(volatile unsigned *addr, unsigned value)
786 {
787 (void)__atomic_and_fetch(addr, value, __ATOMIC_SEQ_CST);
788 }
789# define AO_HAVE_int_and_full
790#endif
791
792#ifndef AO_SKIPATOMIC_ANY_or_ANY
793 AO_INLINE void
794 AO_int_or_full(volatile unsigned *addr, unsigned value)
795 {
796 (void)__atomic_or_fetch(addr, value, __ATOMIC_SEQ_CST);
797 }
798# define AO_HAVE_int_or_full
799#endif
800
801#ifndef AO_SKIPATOMIC_ANY_xor_ANY
802 AO_INLINE void
803 AO_int_xor_full(volatile unsigned *addr, unsigned value)
804 {
805 (void)__atomic_xor_fetch(addr, value, __ATOMIC_SEQ_CST);
806 }
807# define AO_HAVE_int_xor_full
808#endif
809
810#endif /* !AO_NO_int_ARITHM */
811/*
812 * Copyright (c) 1991-1994 by Xerox Corporation. All rights reserved.
813 * Copyright (c) 1996-1999 by Silicon Graphics. All rights reserved.
814 * Copyright (c) 2003-2011 Hewlett-Packard Development Company, L.P.
815 *
816 *
817 * THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED
818 * OR IMPLIED. ANY USE IS AT YOUR OWN RISK.
819 *
820 * Permission is hereby granted to use or copy this program
821 * for any purpose, provided the above notices are retained on all copies.
822 * Permission to modify the code and to distribute modified code is granted,
823 * provided the above notices are retained, and a notice that the code was
824 * modified is included with the above copyright notice.
825 *
826 */
827
828#ifndef AO_NO_ARITHM
829
831AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr)
832{
833 return __atomic_fetch_add(addr, incr, __ATOMIC_SEQ_CST);
834}
835#define AO_HAVE_fetch_and_add_full
836
837#ifndef AO_SKIPATOMIC_ANY_and_ANY
838 AO_INLINE void
839 AO_and_full(volatile AO_t *addr, AO_t value)
840 {
841 (void)__atomic_and_fetch(addr, value, __ATOMIC_SEQ_CST);
842 }
843# define AO_HAVE_and_full
844#endif
845
846#ifndef AO_SKIPATOMIC_ANY_or_ANY
847 AO_INLINE void
848 AO_or_full(volatile AO_t *addr, AO_t value)
849 {
850 (void)__atomic_or_fetch(addr, value, __ATOMIC_SEQ_CST);
851 }
852# define AO_HAVE_or_full
853#endif
854
855#ifndef AO_SKIPATOMIC_ANY_xor_ANY
856 AO_INLINE void
857 AO_xor_full(volatile AO_t *addr, AO_t value)
858 {
859 (void)__atomic_xor_fetch(addr, value, __ATOMIC_SEQ_CST);
860 }
861# define AO_HAVE_xor_full
862#endif
863
864#endif /* !AO_NO_ARITHM */
#define AO_t
Definition: atomic_ops.h:156
#define AO_INLINE
Definition: atomic_ops.h:186
AO_INLINE void AO_char_xor_release(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE AO_t AO_fetch_and_add_release(volatile AO_t *addr, AO_t incr)
AO_INLINE void AO_short_xor(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE unsigned short AO_short_fetch_and_add(volatile unsignedshort *addr, unsignedshort incr)
AO_INLINE unsigned AO_int_fetch_and_add_full(volatile unsigned *addr, unsigned incr)
AO_INLINE AO_t AO_fetch_and_add(volatile AO_t *addr, AO_t incr)
AO_INLINE void AO_int_xor_acquire(volatile unsigned *addr, unsigned value)
AO_INLINE unsigned char AO_char_fetch_and_add_full(volatile unsignedchar *addr, unsignedchar incr)
AO_INLINE void AO_short_xor_full(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_char_and_acquire(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_char_or_acquire(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE unsigned char AO_char_fetch_and_add_release(volatile unsignedchar *addr, unsignedchar incr)
AO_INLINE void AO_int_and_acquire(volatile unsigned *addr, unsigned value)
AO_INLINE AO_t AO_fetch_and_add_acquire(volatile AO_t *addr, AO_t incr)
AO_INLINE void AO_char_xor_acquire(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_char_and_full(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE unsigned short AO_short_fetch_and_add_full(volatile unsignedshort *addr, unsignedshort incr)
AO_INLINE void AO_xor_acquire(volatile AO_t *addr, AO_t value)
AO_INLINE unsigned short AO_short_fetch_and_add_release(volatile unsignedshort *addr, unsignedshort incr)
AO_INLINE void AO_char_or_full(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_or_release(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_short_and_full(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_and(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_char_xor_full(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_char_and(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_int_or(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_or(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_short_or_full(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE unsigned short AO_short_fetch_and_add_acquire(volatile unsignedshort *addr, unsignedshort incr)
AO_INLINE void AO_short_and_release(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_short_or_release(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_short_xor_acquire(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_int_or_acquire(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_int_and_full(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_short_and(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE AO_t AO_fetch_and_add_full(volatile AO_t *addr, AO_t incr)
AO_INLINE void AO_char_or_release(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_short_or_acquire(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_char_and_release(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE unsigned char AO_char_fetch_and_add(volatile unsignedchar *addr, unsignedchar incr)
AO_INLINE void AO_or_full(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_int_xor_release(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_and_full(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_xor_release(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_char_or(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_int_xor_full(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_short_or(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_and_release(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_char_xor(volatile unsignedchar *addr, unsignedchar value)
AO_INLINE void AO_int_and(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_or_acquire(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_int_or_full(volatile unsigned *addr, unsigned value)
AO_INLINE unsigned AO_int_fetch_and_add(volatile unsigned *addr, unsigned incr)
AO_INLINE void AO_and_acquire(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_xor_full(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_short_xor_release(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE unsigned AO_int_fetch_and_add_acquire(volatile unsigned *addr, unsigned incr)
AO_INLINE void AO_xor(volatile AO_t *addr, AO_t value)
AO_INLINE void AO_short_and_acquire(volatile unsignedshort *addr, unsignedshort value)
AO_INLINE void AO_int_or_release(volatile unsigned *addr, unsigned value)
AO_INLINE unsigned char AO_char_fetch_and_add_acquire(volatile unsignedchar *addr, unsignedchar incr)
AO_INLINE unsigned AO_int_fetch_and_add_release(volatile unsigned *addr, unsigned incr)
AO_INLINE void AO_int_and_release(volatile unsigned *addr, unsigned value)
AO_INLINE void AO_int_xor(volatile unsigned *addr, unsigned value)