--- libatomic-ops-7.4.orig/debian/README.Debian +++ libatomic-ops-7.4/debian/README.Debian @@ -0,0 +1,35 @@ +libatomic-ops for Debian +------------------------ + +Libatomic-ops implements a large collection of operations, each one +of which is a combination of an (optional) atomic memory operation, +and a memory barrier. It also implements associated feature-test +macros that determine whether a particular operation is available +on the current target hardware (either directly or by synthesis). +Libatomic-ops attempts to replace various existing files with similar +goals, since they usually do not handle differences in memory barrier +styles with sufficient generality. + +This package is only available as a static library; much of the magic +is in the header files anyway. + +Please be aware of the dual nature of the license, from LICENSING.txt + +Two small libraries are built and installed: + +- libatomic_ops.a is a support library, which is not needed on some platforms. + This is intended to be usable, under some mild restrictions, in free or + proprietary code, as are all the header files. See doc/LICENSING.txt. +- libatomic_ops_gpl.a contains some higher level facilities. This code is + currently covered by the GPL. The contents currently correspond to + the headers atomic_ops_stack.h and atomic_ops_malloc.h. + +NB: the Debian package has been enabled to build on any architecture. +However, only i386, ia64 and amd64 have been fully tested due to +limited access to some of the other architectures. Corrections are +welcome. + +The M68K port was contributed by Roman Zippel , +and is not currently part of the upstream source. + + -- Ian Wienand , Mon, 16 Oct 2006 09:47:19 +1000 --- libatomic-ops-7.4.orig/debian/changelog +++ libatomic-ops-7.4/debian/changelog @@ -0,0 +1,299 @@ +libatomic-ops (7.4-0ubuntu3) trusty; urgency=medium + + * Force AO_load() to map to AO_load_acquire() for powerpc. + + -- Matthias Klose Mon, 24 Feb 2014 20:27:17 +0100 + +libatomic-ops (7.4-0ubuntu1) trusty; urgency=medium + + * New upstream version. + * Build using dh-autoreconf. + * Show test results for failing tests. + + -- Matthias Klose Wed, 15 Jan 2014 18:20:40 +0100 + +libatomic-ops (7.3~alpha3+git20130717-1) unstable; urgency=low + + * Closes: 717095 -- update to current upstream for arm64 + * Update standards version (no change) + + -- Ian Wienand Wed, 17 Jul 2013 09:06:32 +1000 + +libatomic-ops (7.3~alpha3+git20121114-1) unstable; urgency=low + + * Closes: 680100 -- include workaround for alpha spin-outs; thanks to + Ivan Maidanski for diagnosing. + + -- Ian Wienand Wed, 14 Nov 2012 15:27:35 -0800 + +libatomic-ops (7.3~alpha1+git20120718-1) unstable; urgency=low + + * Closes: 655872 -- Update from upstream git which fixes issues with + older compilers as used on kfreebsd + (613f39d369045e8fc385a439f67a575cddcc6fa1). Thanks Ivan! + + -- Ian Wienand Wed, 18 Jul 2012 07:08:36 -0700 + +libatomic-ops (7.3~alpha1+git20120701-1) unstable; urgency=low + + * Closes: 679680 -- Update from upstream git which contains fix for type + issue on ia64 (3e7162d789df366a57d3e4a59dde4046f91ed135) + + -- Ian Wienand Sun, 01 Jul 2012 22:20:34 -0700 + +libatomic-ops (7.3~alpha1+git20120621-1) unstable; urgency=low + + * Update from upstream git + * Closes: 632604 -- Fixed by upstream 30cea1b as identified by Emanuele + Aina and Gregor Herrmann . Thanks! + + -- Ian Wienand Thu, 21 Jun 2012 09:55:15 -0700 + +libatomic-ops (7.3~alpha1+git20111031-1) unstable; urgency=low + + * Update from upstream git + * Closes: 645302 -- Integrates patch from Thorsten Glaser + + -- Ian Wienand Mon, 31 Oct 2011 23:01:03 -0700 + +libatomic-ops (7.3~alpha1+git20110913-1) unstable; urgency=low + + * New upstream release + + -- Ian Wienand Tue, 13 Sep 2011 21:19:00 -0700 + +libatomic-ops (7.2~alpha5+cvs20101124-1) unstable; urgency=low + + * Closes: 604753 -- Update from upstream CVS, fixes ARM Thumb-2 mode + FTBFS + + -- Ian Wienand Wed, 24 Nov 2010 21:20:40 -0800 + +libatomic-ops (7.2~alpha5+cvs20100919-1) unstable; urgency=low + + * Closes: 597193 -- Update from upstream CVS to fix armel issues + * Update to standards 3.9.1 + + -- Ian Wienand Sun, 19 Sep 2010 21:55:41 -0700 + +libatomic-ops (7.2~alpha5+cvs20100601-1) unstable; urgency=low + + * Update from upstream CVS, to fix AVR build issues with change from + Brad Smith + + -- Ian Wienand Tue, 01 Jun 2010 15:37:41 -0700 + +libatomic-ops (7.2~alpha5+cvs20100523-1) unstable; urgency=low + + * Update from upstream CVS + * Closes: 580211 -- avr support integrated upstream (Thanks Stefano!) + + -- Ian Wienand Fri, 21 May 2010 15:47:12 -0700 + +libatomic-ops (7.2~alpha5+cvs20100204-1) unstable; urgency=low + + * New upstream (with new version scheme based on the GC library) + * Packagaing overhaul - remove unneeded debian/libatomic-ops-dev.files, + debian/libatomic-ops-dev.install, debian/docs, debian/dirs + * Update rules to use DEB_DESTDIR to install into /tmp + * Pick only relevant files with debian/libatomic-ops-dev.install + * Remove patch to ignore upstream doc generation, not needed with above + changes + + -- Ian Wienand Thu, 04 Feb 2010 14:57:58 -0800 + +libatomic-ops (1.2+cvs20091005-1) unstable; urgency=low + + * Update from upstream CVS + * Closes: #547136 -- patch accepted upstream + * Lintian updates : Update standards version, debhelper compat version, + add Section tag for source, misc depends for debhelper + + -- Ian Wienand Mon, 5 Oct 2009 11:08:00 -0700 + +libatomic-ops (1.2+cvs20080819-1) unstable; urgency=low + + * Update from upstream CVS + * Closes: #495211 -- patch taken upstream, thanks Thiemo! + + -- Ian Wienand Tue, 19 Aug 2008 14:25:24 -0700 + +libatomic-ops (1.2+cvs20080815-1) unstable; urgency=low + + * New upstream, taken from CVS repository at + bdwgc.cvs.sourceforge.net:/cvsroot/bdwgc + which upstream has told me is official home of the package. + * Patches now included upstream: 01_s390_include.patch, 02_mips.patch, + 04_m68k.patch, 05_powerpc_asm.patch, 07_pic_cmpxchng.patch, + + -- Ian Wienand Fri, 15 Aug 2008 21:26:06 -0700 + +libatomic-ops (1.2-4) unstable; urgency=low + + * Closes: #463390 -- Add 06_double.patch to fix some issues with double + CAS defs. Patch by Jamey Sharp, thanks Jamey! + * This fixed up AO_compare_double_and_swap_double_full which then + revealed a PIC problem, which then revealed the arguments to cmpxchg8b + were around the wrong way, fixed in 07_pic_cmpxchng.patch + + -- Ian Wienand Fri, 01 Feb 2008 11:09:33 +1100 + +libatomic-ops (1.2-3) unstable; urgency=low + + * Closes: #449152 -- updated MIPS patch from Thiemo Seufer + + -- Ian Wienand Sun, 04 Nov 2007 19:01:31 +1100 + +libatomic-ops (1.2-2) unstable; urgency=low + + * Add patches/05_powerpc_asm.patch to fix invalid ASM in PowerPC, as per + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33171 (Closes: #432654). + Thanks to Sjoerd Simons for isolating the bug, and + Andrew Pinkski for solution. + + -- Ian Wienand Mon, 27 Aug 2007 11:13:13 +1000 + +libatomic-ops (1.2-1) unstable; urgency=low + + * New upstream + * Remove 00_x86_intrin.patch, fixed upstream (with "=q")x + + -- Ian Wienand Fri, 25 May 2007 11:29:30 +1000 + +libatomic-ops (1.1-4) unstable; urgency=low + + * Closes: #322027, #338469 -- add 04_m68k.patch for M68K support, from + Roman Zippel . Add note in README.Debian about + port. + * Change mainatiner address to my @debian.org + + -- Ian Wienand Mon, 16 Oct 2006 09:45:29 +1000 + +libatomic-ops (1.1-3) unstable; urgency=low + + * move the check target under the rules to make cdbs run inbuilt tests + * Closes: #307448 -- assuming the (newly re-enabled) test runs OK we + seem to be building on ARM + + -- Ian Wienand Thu, 8 Dec 2005 13:39:22 +1100 + +libatomic-ops (1.1-2) unstable; urgency=low + + * spell my name right in README.Debian + * patches/03_nodoc.patch : don't install documentation, the packaging + does this directly + * really install manpages + * clean up what docs get installed + * don't auto generate control file, do it in external scripts + + -- Ian Wienand Fri, 25 Nov 2005 16:28:16 +1100 + +libatomic-ops (1.1-1) unstable; urgency=low + + * New upstream release + * Convert to use CDBS with patch system; move extra stuff over upstream + into ./debian/patches + * Closes: #336112, #338442 -- MIPS support debian/patches/02_mips.patch + Thanks Thiemo! + + -- Ian Wienand Mon, 31 Oct 2005 13:40:53 +1100 + +libatomic-ops (1.0-3) unstable; urgency=low + + * Closes: bug#332378 -- fix include headers in + src/atomic_ops/sysdeps/gcc/s390.h + + -- Ian Wienand Thu, 6 Oct 2005 16:14:49 +1000 + +libatomic-ops (1.0-2) unstable; urgency=low + + * Closes: bug#321284 -- we now only have the -dev package with the + static libraries in it, and it replaces the normal version (this + corrects an ahs3 thinko from 1.0-1). + * Add a note to README.Debian about staticness and license + * Add /doc subdir into package documents + * Closes: bug#321291 -- use "Q" constraint in + src/atomic_ops/sysdeps/gcc/x86.h for AO_test_and_set_full, see + http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23242 + * Reopening #307448 -- the asm needs to be reconsidered and possibly + rewritten for ARM. + + -- Ian Wienand Fri, 5 Aug 2005 11:13:26 +1000 + +libatomic-ops (1.0-1) unstable; urgency=low + + * Closes: bug#307503 -- FTBS. Update to upstream 1.0 (ianw) + * The 'libatomic-ops' package now contains only a statically linked + library, as upstream wishes (which makes sense, in this case, and + still fits within policy). The 'libatomic-ops-dev' package now + depends on the 'libatomic-ops' as a result to ensure a developer + can still properly link against the package (ahs3). + * Update standards version to 3.6.2 (ahs3) + * Closes: bug#307448 -- variable 'ret' undefined on ARM. I think + this has been solved but I could be wrong and may have to reopen + this bug (ahs3). + + -- Al Stone Mon, 1 Aug 2005 22:25:38 -0600 + +libatomic-ops (0.5.1-4) unstable; urgency=low + + * Add man page + + -- Ian Wienand Fri, 20 May 2005 08:28:14 +1000 + +libatomic-ops (0.5.1-3) unstable; urgency=low + + * Closes: bug#287276: support for amd64 -- thinko, skipped part + of Kurt's patch inadvertently. + + -- Al Stone Mon, 21 Feb 2005 17:15:35 -0700 + +libatomic-ops (0.5.1-2) unstable; urgency=low + + * Closes: bug#287276: support for amd64 added (thanks to Kurt + Roeckx for the patch). + * Closes: bug#244910: all architectures have now been enabled (only + i386, ia64, amd64 are absolutely known to work, however) + + -- Al Stone Sat, 19 Feb 2005 15:47:31 -0700 + +libatomic-ops (0.5.1-1) unstable; urgency=low + + * Merge in Ian's changes for a non-native Debian package -- properly, + this time. + * Remove the auto* build-deps (the point of Ian's changes) + * Closes: bug#270013 -- FTBFS: Permission problem on autogen.sh + * Since we've started branching from upstream a little, change + the versioning to reflect that -- hence, 0.5.1 to start with. + + -- Al Stone Tue, 7 Sep 2004 16:01:18 -0600 + +libatomic-ops (0.5-3) unstable; urgency=low + + * Update to cleanup and not be a debian native package + * Closes: bug#266131: FTBFS: aclocal-1.7: command not found + * Minor changes to debian/rules file (ahs3) + * Cleanup minor typos before upload (ahs3) + * Added 'libtool' to Build-Depends (ahs3) + + -- Ian Wienand Fri, 27 Aug 2004 10:48:39 +1000 + +libatomic-ops (0.5-2) unstable; urgency=low + + * Cleanup of the source tree from Ian Wienand ; + got rid of all the generated files to simplify things. + * Did cleanup of lintian-reported items + + -- Al Stone Tue, 24 Aug 2004 22:50:25 -0600 + +libatomic-ops (0.5-1) unstable; urgency=low + + * Initial Release based on Ian Wienand's work (). + * Inserted myself (Al Stone as maintainer. + * Cleaned up the various files needed in the debian directory. + * Package now creates 'libatomic-ops' and 'libatomic-ops-dev' + * Package now uses libtool + * Closes: bug#231793 -- ITP for libatomic_ops + + -- Al Stone Sat, 13 Mar 2004 14:38:53 -0700 + --- libatomic-ops-7.4.orig/debian/compat +++ libatomic-ops-7.4/debian/compat @@ -0,0 +1 @@ +8 --- libatomic-ops-7.4.orig/debian/control +++ libatomic-ops-7.4/debian/control @@ -0,0 +1,26 @@ +Source: libatomic-ops +Priority: optional +Section: libdevel +Maintainer: Ian Wienand +Uploaders: Al Stone +Build-Depends: dh-autoreconf, debhelper (>= 8) +Standards-Version: 3.9.4 + +Package: libatomic-ops-dev +Section: libdevel +Depends: ${shlibs:Depends}, ${misc:Depends} +Architecture: any +Replaces: libatomic-ops +Description: A library for atomic operations (development files) + Libatomic-ops implements a large collection of operations, each one + of which is a combination of an (optional) atomic memory operation, + and a memory barrier. It also implements associated feature-test + macros that determine whether a particular operation is available + on the current target hardware (either directly or by synthesis). + Libatomic-ops attempts to replace various existing files with similar + goals, since they usually do not handle differences in memory barrier + styles with sufficient generality. + . + This package provides the header files and documentation needed by + developers. + --- libatomic-ops-7.4.orig/debian/copyright +++ libatomic-ops-7.4/debian/copyright @@ -0,0 +1,71 @@ +This package was debianized by Ian Wienand +on Mon, 9 Feb 2004 10:26:54 +1100. + +It was downloaded from: + https://github.com/ivmai/libatomic_ops + (previously + http://www.hpl.hp.com/research/linux/atomic_ops/download.php4) + +Upstream Authors: + Hans Boehm + David Mosberger + +Our intent is to make it easy to use all "library" pieces of the code, in +both free and proprietary software. Hence most code that we expect to be +linked into a client application is covered by an MIT-style license: + +---------------------------------------- + +Copyright (c) 2004, Hewlett-Packard Company + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +-------------------------------- + +A few files in the ao_sysdeps directory were inherited in part from the +Boehm-Demers-Weiser conservative garbage collector, and are covered by +its license, which is similar in spirit: + +-------------------------------- + +Copyright (c) 2004 Hewlett-Packard Company + +THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED +OR IMPLIED. ANY USE IS AT YOUR OWN RISK. + +Permission is hereby granted to use or copy this program +for any purpose, provided the above notices are retained on all copies. +Permission to modify the code and to distribute modified code is granted, +provided the above notices are retained, and a notice that the code was +modified is included with the above copyright notice. + +---------------------------------- + +A few files are covered by the GNU General Public License. (See file +"COPYING"). Currently this applies only to test code and sample +applications. This should have no effect on linking "library" +routines into proprietary applications. + +A copy of the GNU General Public License can be found in: +/usr/share/common-licenses/GPL + +In the future, legal considerations may make it desirable to also cover +some newly added library routines under the GPL. If so, these will be +clearly separated, and not implicitly linked into existing libraries. + --- libatomic-ops-7.4.orig/debian/libatomic-malloc.3 +++ libatomic-ops-7.4/debian/libatomic-malloc.3 @@ -0,0 +1,89 @@ +.\" Copyright 2005 Ian Wienand, Gelato@UNSW +.\" +.TH "LIBATOMIC-MALLOC" "3" "2 June, 2005" "Ian Wienand" "" +.SH "NAME" +libatomic\-malloc \- Library providing simple almost\-lock\-free malloc implementation +.SH "SYNOPSIS" +.B #include +.sp +.B cc ... \-latomic_ops_gpl +.sp +Note that the AO_malloc implementation is licensed under the GPL, unlike the lower level routines. + +.B void *AO_malloc(size_t sz); +.br +.B void AO_free(void *p); +.br +.B void AO_malloc_enable_mmap(void); +.SH "DESCRIPTION" +A simple almost\-lock\-free malloc implementation. + +This is intended as a safe way to allocate memory from a signal handler, +or to allocate memory in the context of a library that does not know what +thread library it will be used with. In either case locking is impossible. + +Note that the operations are only guaranteed to be 1\-lock\-free, i.e. a +single blocked thread will not prevent progress, but multiple blocked +threads may. To safely use these operations in a signal handler, +the handler should be non\-reentrant, i.e. it should not be interruptable +by another handler using these operations. Furthermore use outside +of signal handlers in a multithreaded application should be protected +by a lock, so that at most one invocation may be interrupted by a signal. +The header will define the macro +.I AO_MALLOC_IS_LOCK_FREE +on platforms +on which malloc is completely lock\-free, and hence these restrictions +do not apply. + +In the presence of threads, but absence of contention, the time performance +of this package should be as good, or slightly better than, most system +malloc implementations. Its space performance +is theoretically optimal (to within a constant factor), but probably +quite poor in practice. In particular, no attempt is made to +coalesce free small memory blocks. Something like Doug Lea's malloc is +likely to use significantly less memory for complex applications. + +Perfomance on platforms without an efficient compare\-and\-swap implementation +will be poor. + +This package was not designed for processor\-scalability in the face of +high allocation rates. If all threads happen to allocate different\-sized +objects, you might get lucky. Otherwise expect contention and false\-sharing +problems. If this is an issue, something like Maged Michael's algorithm +(PLDI 2004) would be technically a far better choice. If you are concerned +only with scalablity, and not signal\-safety, you might also consider +using Hoard instead. We have seen a factor of 3 to 4 slowdown from the +standard glibc malloc implementation with contention, even when the +performance without contention was faster. (To make the implementation +more scalable, one would need to replicate at least the free list headers, +so that concurrent access is possible without cache conflicts.) + +Unfortunately there is no portable async\-signal\-safe way to obtain large +chunks of memory from the OS. Based on reading of the source code, +mmap\-based allocation appears safe under Linux, and probably BSD variants. +It is probably unsafe for operating systems built on Mach, such as +Apple's Darwin. Without use of mmap, the allocator is +limited to a fixed size, statically preallocated heap (2MB by default), +and will fail to allocate objects above a certain size (just under 64K +by default). Use of mmap to circumvent these limitations requires an +explicit call. + +The entire interface to the AO_malloc package currently consists of: + +.TP +.B AO_malloc +Allocate an area of memory + +.TP +.B AO_free +Free a previously malloced memory area + +.TP +AO_malloc_enable_mmap +Enable mmap for large malloc chunks + + +.SH "SEE ALSO" +libatomic\-ops(3), libatomic\-stack(3) +.SH "AUTHOR" +This manual page was written by Ian Wienand , based on comments in the source code. It was written for the Debian project (but may be used by others). --- libatomic-ops-7.4.orig/debian/libatomic-ops-dev.docs +++ libatomic-ops-7.4/debian/libatomic-ops-dev.docs @@ -0,0 +1,3 @@ +doc/README.txt +doc/README_malloc.txt +doc/README_stack.txt --- libatomic-ops-7.4.orig/debian/libatomic-ops-dev.install +++ libatomic-ops-7.4/debian/libatomic-ops-dev.install @@ -0,0 +1,2 @@ +usr/include +usr/lib \ No newline at end of file --- libatomic-ops-7.4.orig/debian/libatomic-ops-dev.manpages +++ libatomic-ops-7.4/debian/libatomic-ops-dev.manpages @@ -0,0 +1,3 @@ +debian/libatomic-malloc.3 +debian/libatomic-ops.3 +debian/libatomic-stack.3 --- libatomic-ops-7.4.orig/debian/libatomic-ops.3 +++ libatomic-ops-7.4/debian/libatomic-ops.3 @@ -0,0 +1,115 @@ +.\" Copyright 2005 Ian Wienand, Gelato@UNSW +.\" +.TH "LIBATOMIC-OPS" "3" "May 17, 2005" "Ian Wienand" "" +.SH "NAME" +libatomic\-ops \- Library providing user level atomic operations +.SH "SYNOPSIS" +.B #include +.sp +.B cc ... \-latomic_ops +.sp +Note that all operations have an additional barrier option that can be set explicitly. +.sp +.B void AO_load(AO_t *addr) +.br +.B void AO_store(AO_t *addr, AO_t val) +.sp +.B int AO_test_and_set (AO_t *addr) +.sp +.B AO_t AO_fetch_and_add(AO_t *addr, AO_t incr) +.br +.B AO_t AO_fetch_and_add1(AO_t *addr) +.br +.B AO_t AO_fetch_and_sub1(AO_t *addr) +.sp +.B void AO_or(AO_t *p, AO_t incr) +.br +.B int AO_compare_and_swap(AO_t *addr, AO_t old, AO_t new_val) +.SH "DESCRIPTION" +.B libatomic\-ops +offers a programming interface to a comprehensive range of atomic operations at user level. + +We define various atomic operations on memory in a machine\-specific way. Unfortunately, this is complicated by the fact that these may or may not be combined with various memory barriers. Thus the actual operations we define have the form +.B AO__ +for all plausible combinations of and . + +The valid barrier suffixes are +.TP +.B _release +Earlier operations may not be delayed past it. +.TP +.B _acquire +Later operations may not move ahead of it. +.TP +.B _read +Subsequent reads must follow this operation and preceding reads. +.TP +.B _write +Earlier writes precede both this operation and later writes. +.TP +.B _full +Ordered with respect to both earlier and later memops. +.TP +.B _release_write +Ordered with respect to earlier writes. +.TP +.B _acquire_read +Ordered with repsect to later reads. + +.LP +This of course results in a mild combinatorial explosion. + +The library will find the least expensive way to implement your operations on the +applicable hardware. In many cases that will involve, for example, +a stronger memory barrier, or a combination of hardware primitives. + +Note that atomicity guarantees are valid only if both readers and +writers use AO_ operations to access the shared value, while ordering +constraints are intended to apply all memory operations. +If a location can potentially be accessed simultaneously from +multiple threads, and one of those accesses may be a write access, +then all such accesses to that location should be +through AO_ primitives. However if AO_ operations enforce sufficient +ordering to ensure that a location x cannot be accessed concurrently, or can only +be read concurrently, then x can be accessed via ordinary references and assignments. + +All operations operate on an +.B AO_t +value, which is the natural word size for the architecture. + +.B AO_load +and +.B AO_store +load and store the specified pointer address. + +.B AO_test_and_set +atomically replaces an address with +.B AO_TS_SET +and returns the prior value. An +.B AO_TS_t location can be reset with the +.B AO_CLEAR +macro, which usually uses +.B AO_store_release + +.B AO_fetch_and_add +takes an address and a value to add. + +.B AO_fetch_and_add1 +and +.B AO_fetch_and_sub1 +are provided since they may have faster implemenations on some hardware + +.B AO_or +atomically ors an +.I AO_t +value into a memory location, but does not provide +access to the original + +.B AO_compare_and_swap +takes an address, an old value and a new value and returns an int. +.I non\-zero +indicates the compare and swap succeeded. +.SH "SEE ALSO" +libatomic\-stack(3), libatomic\-malloc(3) +.SH "AUTHOR" +This manual page was written by Ian Wienand , based on comments in the source code. It was written for the Debian project (but may be used by others). --- libatomic-ops-7.4.orig/debian/libatomic-stack.3 +++ libatomic-ops-7.4/debian/libatomic-stack.3 @@ -0,0 +1,95 @@ +.\" Copyright 2005 Ian Wienand, Gelato@UNSW +.\" +.TH "LIBATOMIC-STACK" "3" "June 2, 2005" "Ian Wienand" "" +.SH "NAME" +libatomic\-stack \- Library providing linked stack abstraction +.SH "SYNOPSIS" +.B #include +.sp +.B cc ... \-latomic_ops_gpl +.sp +Note that the AO_stack implementation is licensed under the GPL, unlike the lower level routines. + +.B void AO_stack_init(AO_stack_t *list); +.br +.B void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); +.br +.B AO_t * AO_stack_pop_acquire(volatile AO_stack_t *list); +.SH "DESCRIPTION" +.B libatomic\-stack +defines a linked stack abstraction. Stacks may be accessed by multiple concurrent threads. +The implementation is 1\-lock\-free, i.e. it will continue to make progress if at most one thread +becomes inactive while operating on the data structure. + +This makes it safe to access these data structures from non\-reentrant +signal handlers, provided at most one non\-signal\-handler thread is +accessing the data structure at once. This latter condition can be +ensured by acquiring an ordinary lock around the non\-hndler accesses +to the data structure. + +We use a fully lock\-free implementation when the underlying hardware +makes that less expensive, i.e. when we have a double\-wide compare\-and\-swap +operation available. (The fully lock\-free implementation uses an AO_t\- +sized version count, and assumes it does not wrap during the time any +given operation is active. This seems reasonably safe on 32\-bit hardware, +and very safe on 64\-bit hardware.) If a fully lock\-free implementation +is used, the macro +.I AO_STACK_IS_LOCK_FREE +will be defined. + +The cleanest way to use these routines is probably to define the stack node +type with an initial +.I AO_t +link field, so that the conversion between the +link\-field pointer and the stack element pointer is just a compile\-time +cast. But other possibilities exist. (This would be cleaner in C++ with +templates.) + +A stack is represented by an AO_stack_t structure. (This is normally +2 or 3 times the size of a pointer.) It may be statically initialized +by setting it to +.I AO_STACK_INITIALIZER +, or dynamically initialized to +an empty stack with +.I AO_stack_init +. There are only three operations for +accessing stacks: + +.TP +.B AO_stack_init +Initalise a stack +.TP +.B AO_stack_push_release +Push new element onto the stack. +.TP +.B AO_stack_pop_acquire +Pop element off the stack. + +.LP +We require that the objects pushed as list elements remain addressable +as long as any push or pop operation are in progress. (It is OK for an object +to be "pop"ped off a stack and "deallocated" with a concurrent "pop" on +the same stack still in progress, but only if "deallocation" leaves the +object addressable. The second "pop" may still read the object, but +the value it reads will not matter.) + +We require that the headers ( +.I AO_stack +objects) remain allocated and +valid as long as any operations on them are still in\-flight. + +We also provide macros +.I AO_REAL_HEAD_PTR +that converts an +.I AO_stack_t +to a pointer to the link field in the next element, and +.I AO_REAL_NEXT_PTR +that converts a link field to a real, dereferencable, pointer to the link field +in the next element. This is intended only for debugging, or to traverse +the list after modification has ceased. There is otherwise no guarantee that +walking a stack using this macro will produce any kind of consistent +picture of the data structure. +.SH "SEE ALSO" +libatomic\-ops(3), libatomic\-malloc(3) +.SH "AUTHOR" +This manual page was written by Ian Wienand , based on comments in the source code. It was written for the Debian project (but may be used by others). --- libatomic-ops-7.4.orig/debian/rules +++ libatomic-ops-7.4/debian/rules @@ -0,0 +1,54 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +DEB_HOST_ARCH ?= $(shell dpkg-architecture -qDEB_HOST_ARCH) + +%: + dh $@ --parallel --with autoreconf + +override_dh_auto_test: +ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) + -dh_auto_test 2>&1 | tee test.log + rv=0; \ + fails=$$(awk '/^# FAIL:/ { print $$3 }' test.log); \ + if [ "$$fails" -eq 0 ]; then \ + echo "all tests did pass on $(DEB_HOST_ARCH)"; \ + else \ + if [ -f debian/test-expected.$(DEB_HOST_ARCH) ]; then \ + cp debian/test-expected.$(DEB_HOST_ARCH) test-expected.log; \ + else \ + rm -f test-expected.log; touch test-expected.log; \ + fi; \ + grep '^FAIL: ' test.log | sort > test-fail.log; \ + comm -13 test-expected.log test-fail.log > test-regress.log; \ + comm -23 test-expected.log test-fail.log > test-progress.log; \ + if [ -z "$$(cat test-regress.log)" ]; then \ + echo "expected test failures on $(DEB_HOST_ARCH)"; \ + if [ -n "$$(cat test-progress.log)" ]; then \ + echo "unexpected test progressions on $(DEB_HOST_ARCH)"; \ + cat test-progress.log; \ + fi; \ + else \ + echo "unexpected test failures on $(DEB_HOST_ARCH)"; \ + cat test-regress.log; \ + rv=1; \ + fi; \ + if [ -n "$$(cat test-fail.log)" ]; then \ + for t in $$(awk '{print $$2}' test-fail.log); do \ + echo "=============== $$t ==============="; \ + cat tests/$$t.log; \ + done; \ + echo "=============== tests/test-suite.log ==============="; \ + cat tests/test-suite.log; \ + fi; \ + fi; \ + exit $$rv +endif + +override_dh_auto_install: + dh_auto_install --destdir=$(CURDIR)/debian/tmp + +override_dh_auto_clean: + rm -f test*.log + dh_auto_clean + --- libatomic-ops-7.4.orig/src/atomic_ops/sysdeps/gcc/powerpc.h +++ libatomic-ops-7.4/src/atomic_ops/sysdeps/gcc/powerpc.h @@ -29,6 +29,8 @@ #include "../all_aligned_atomic_load_store.h" +#define AO_load(addr) AO_load_acquire(addr) + #include "../test_and_set_t_is_ao_t.h" /* There seems to be no byte equivalent of lwarx, so this */ /* may really be what we want, at least in the 32-bit case. */ --- libatomic-ops-7.4.orig/tests/list_atomic.c +++ libatomic-ops-7.4/tests/list_atomic.c @@ -0,0 +1,5266 @@ +#include "atomic_ops.h" +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic(void) +{ +# if defined(AO_HAVE_load) || defined(AO_HAVE_store) \ + || defined(AO_HAVE_fetch_and_add) \ + || defined(AO_HAVE_fetch_and_add1) \ + || defined(AO_HAVE_and) \ + || defined(AO_HAVE_compare_and_swap) \ + || defined(AO_HAVE_fetch_compare_and_swap) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap) \ + || defined(AO_HAVE_fetch_compare_and_swap) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store) \ + || defined(AO_HAVE_compare_and_swap) \ + || defined(AO_HAVE_fetch_compare_and_swap) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add) || defined(AO_HAVE_and) \ + || defined(AO_HAVE_or) || defined(AO_HAVE_xor) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop) + (void)"AO_nop(): "; + AO_nop(); +# else + (void)"No AO_nop"; +# endif + +# ifdef AO_HAVE_load + (void)"AO_load(&val):"; + AO_load(&val); +# else + (void)"No AO_load"; +# endif +# ifdef AO_HAVE_store + (void)"AO_store(&val, newval):"; + AO_store(&val, newval); +# else + (void)"No AO_store"; +# endif +# ifdef AO_HAVE_fetch_and_add + (void)"AO_fetch_and_add(&val, incr):"; + AO_fetch_and_add(&val, incr); +# else + (void)"No AO_fetch_and_add"; +# endif +# ifdef AO_HAVE_fetch_and_add1 + (void)"AO_fetch_and_add1(&val):"; + AO_fetch_and_add1(&val); +# else + (void)"No AO_fetch_and_add1"; +# endif +# ifdef AO_HAVE_fetch_and_sub1 + (void)"AO_fetch_and_sub1(&val):"; + AO_fetch_and_sub1(&val); +# else + (void)"No AO_fetch_and_sub1"; +# endif +# ifdef AO_HAVE_and + (void)"AO_and(&val, incr):"; + AO_and(&val, incr); +# else + (void)"No AO_and"; +# endif +# ifdef AO_HAVE_or + (void)"AO_or(&val, incr):"; + AO_or(&val, incr); +# else + (void)"No AO_or"; +# endif +# ifdef AO_HAVE_xor + (void)"AO_xor(&val, incr):"; + AO_xor(&val, incr); +# else + (void)"No AO_xor"; +# endif +# ifdef AO_HAVE_compare_and_swap + (void)"AO_compare_and_swap(&val, oldval, newval):"; + AO_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap"; +# endif + /* TODO: Add AO_compare_double_and_swap_double */ + /* TODO: Add AO_compare_and_swap_double */ +# ifdef AO_HAVE_fetch_compare_and_swap + (void)"AO_fetch_compare_and_swap(&val, oldval, newval):"; + AO_fetch_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap"; +# endif + +# if defined(AO_HAVE_test_and_set) + (void)"AO_test_and_set(&ts):"; + AO_test_and_set(&ts); +# else + (void)"No AO_test_and_set"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_release(void) +{ +# if defined(AO_HAVE_load_release) || defined(AO_HAVE_store_release) \ + || defined(AO_HAVE_fetch_and_add_release) \ + || defined(AO_HAVE_fetch_and_add1_release) \ + || defined(AO_HAVE_and_release) \ + || defined(AO_HAVE_compare_and_swap_release) \ + || defined(AO_HAVE_fetch_compare_and_swap_release) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_release) \ + || defined(AO_HAVE_fetch_compare_and_swap_release) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_release) \ + || defined(AO_HAVE_compare_and_swap_release) \ + || defined(AO_HAVE_fetch_compare_and_swap_release) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_release) || defined(AO_HAVE_and_release) \ + || defined(AO_HAVE_or_release) || defined(AO_HAVE_xor_release) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release) + (void)"AO_nop_release(): "; + AO_nop_release(); +# else + (void)"No AO_nop_release"; +# endif + +# ifdef AO_HAVE_load_release + (void)"AO_load_release(&val):"; + AO_load_release(&val); +# else + (void)"No AO_load_release"; +# endif +# ifdef AO_HAVE_store_release + (void)"AO_store_release(&val, newval):"; + AO_store_release(&val, newval); +# else + (void)"No AO_store_release"; +# endif +# ifdef AO_HAVE_fetch_and_add_release + (void)"AO_fetch_and_add_release(&val, incr):"; + AO_fetch_and_add_release(&val, incr); +# else + (void)"No AO_fetch_and_add_release"; +# endif +# ifdef AO_HAVE_fetch_and_add1_release + (void)"AO_fetch_and_add1_release(&val):"; + AO_fetch_and_add1_release(&val); +# else + (void)"No AO_fetch_and_add1_release"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_release + (void)"AO_fetch_and_sub1_release(&val):"; + AO_fetch_and_sub1_release(&val); +# else + (void)"No AO_fetch_and_sub1_release"; +# endif +# ifdef AO_HAVE_and_release + (void)"AO_and_release(&val, incr):"; + AO_and_release(&val, incr); +# else + (void)"No AO_and_release"; +# endif +# ifdef AO_HAVE_or_release + (void)"AO_or_release(&val, incr):"; + AO_or_release(&val, incr); +# else + (void)"No AO_or_release"; +# endif +# ifdef AO_HAVE_xor_release + (void)"AO_xor_release(&val, incr):"; + AO_xor_release(&val, incr); +# else + (void)"No AO_xor_release"; +# endif +# ifdef AO_HAVE_compare_and_swap_release + (void)"AO_compare_and_swap_release(&val, oldval, newval):"; + AO_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_release"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release */ + /* TODO: Add AO_compare_and_swap_double_release */ +# ifdef AO_HAVE_fetch_compare_and_swap_release + (void)"AO_fetch_compare_and_swap_release(&val, oldval, newval):"; + AO_fetch_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_release"; +# endif + +# if defined(AO_HAVE_test_and_set_release) + (void)"AO_test_and_set_release(&ts):"; + AO_test_and_set_release(&ts); +# else + (void)"No AO_test_and_set_release"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_acquire(void) +{ +# if defined(AO_HAVE_load_acquire) || defined(AO_HAVE_store_acquire) \ + || defined(AO_HAVE_fetch_and_add_acquire) \ + || defined(AO_HAVE_fetch_and_add1_acquire) \ + || defined(AO_HAVE_and_acquire) \ + || defined(AO_HAVE_compare_and_swap_acquire) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_acquire) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_acquire) \ + || defined(AO_HAVE_compare_and_swap_acquire) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_acquire) || defined(AO_HAVE_and_acquire) \ + || defined(AO_HAVE_or_acquire) || defined(AO_HAVE_xor_acquire) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire) + (void)"AO_nop_acquire(): "; + AO_nop_acquire(); +# else + (void)"No AO_nop_acquire"; +# endif + +# ifdef AO_HAVE_load_acquire + (void)"AO_load_acquire(&val):"; + AO_load_acquire(&val); +# else + (void)"No AO_load_acquire"; +# endif +# ifdef AO_HAVE_store_acquire + (void)"AO_store_acquire(&val, newval):"; + AO_store_acquire(&val, newval); +# else + (void)"No AO_store_acquire"; +# endif +# ifdef AO_HAVE_fetch_and_add_acquire + (void)"AO_fetch_and_add_acquire(&val, incr):"; + AO_fetch_and_add_acquire(&val, incr); +# else + (void)"No AO_fetch_and_add_acquire"; +# endif +# ifdef AO_HAVE_fetch_and_add1_acquire + (void)"AO_fetch_and_add1_acquire(&val):"; + AO_fetch_and_add1_acquire(&val); +# else + (void)"No AO_fetch_and_add1_acquire"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_acquire + (void)"AO_fetch_and_sub1_acquire(&val):"; + AO_fetch_and_sub1_acquire(&val); +# else + (void)"No AO_fetch_and_sub1_acquire"; +# endif +# ifdef AO_HAVE_and_acquire + (void)"AO_and_acquire(&val, incr):"; + AO_and_acquire(&val, incr); +# else + (void)"No AO_and_acquire"; +# endif +# ifdef AO_HAVE_or_acquire + (void)"AO_or_acquire(&val, incr):"; + AO_or_acquire(&val, incr); +# else + (void)"No AO_or_acquire"; +# endif +# ifdef AO_HAVE_xor_acquire + (void)"AO_xor_acquire(&val, incr):"; + AO_xor_acquire(&val, incr); +# else + (void)"No AO_xor_acquire"; +# endif +# ifdef AO_HAVE_compare_and_swap_acquire + (void)"AO_compare_and_swap_acquire(&val, oldval, newval):"; + AO_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_acquire"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire */ + /* TODO: Add AO_compare_and_swap_double_acquire */ +# ifdef AO_HAVE_fetch_compare_and_swap_acquire + (void)"AO_fetch_compare_and_swap_acquire(&val, oldval, newval):"; + AO_fetch_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_acquire"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire) + (void)"AO_test_and_set_acquire(&ts):"; + AO_test_and_set_acquire(&ts); +# else + (void)"No AO_test_and_set_acquire"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_read(void) +{ +# if defined(AO_HAVE_load_read) || defined(AO_HAVE_store_read) \ + || defined(AO_HAVE_fetch_and_add_read) \ + || defined(AO_HAVE_fetch_and_add1_read) \ + || defined(AO_HAVE_and_read) \ + || defined(AO_HAVE_compare_and_swap_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_read) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_read) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_read) \ + || defined(AO_HAVE_compare_and_swap_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_read) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_read) || defined(AO_HAVE_and_read) \ + || defined(AO_HAVE_or_read) || defined(AO_HAVE_xor_read) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_read) + (void)"AO_nop_read(): "; + AO_nop_read(); +# else + (void)"No AO_nop_read"; +# endif + +# ifdef AO_HAVE_load_read + (void)"AO_load_read(&val):"; + AO_load_read(&val); +# else + (void)"No AO_load_read"; +# endif +# ifdef AO_HAVE_store_read + (void)"AO_store_read(&val, newval):"; + AO_store_read(&val, newval); +# else + (void)"No AO_store_read"; +# endif +# ifdef AO_HAVE_fetch_and_add_read + (void)"AO_fetch_and_add_read(&val, incr):"; + AO_fetch_and_add_read(&val, incr); +# else + (void)"No AO_fetch_and_add_read"; +# endif +# ifdef AO_HAVE_fetch_and_add1_read + (void)"AO_fetch_and_add1_read(&val):"; + AO_fetch_and_add1_read(&val); +# else + (void)"No AO_fetch_and_add1_read"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_read + (void)"AO_fetch_and_sub1_read(&val):"; + AO_fetch_and_sub1_read(&val); +# else + (void)"No AO_fetch_and_sub1_read"; +# endif +# ifdef AO_HAVE_and_read + (void)"AO_and_read(&val, incr):"; + AO_and_read(&val, incr); +# else + (void)"No AO_and_read"; +# endif +# ifdef AO_HAVE_or_read + (void)"AO_or_read(&val, incr):"; + AO_or_read(&val, incr); +# else + (void)"No AO_or_read"; +# endif +# ifdef AO_HAVE_xor_read + (void)"AO_xor_read(&val, incr):"; + AO_xor_read(&val, incr); +# else + (void)"No AO_xor_read"; +# endif +# ifdef AO_HAVE_compare_and_swap_read + (void)"AO_compare_and_swap_read(&val, oldval, newval):"; + AO_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_read */ + /* TODO: Add AO_compare_and_swap_double_read */ +# ifdef AO_HAVE_fetch_compare_and_swap_read + (void)"AO_fetch_compare_and_swap_read(&val, oldval, newval):"; + AO_fetch_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_read"; +# endif + +# if defined(AO_HAVE_test_and_set_read) + (void)"AO_test_and_set_read(&ts):"; + AO_test_and_set_read(&ts); +# else + (void)"No AO_test_and_set_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_write(void) +{ +# if defined(AO_HAVE_load_write) || defined(AO_HAVE_store_write) \ + || defined(AO_HAVE_fetch_and_add_write) \ + || defined(AO_HAVE_fetch_and_add1_write) \ + || defined(AO_HAVE_and_write) \ + || defined(AO_HAVE_compare_and_swap_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_write) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_write) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_write) \ + || defined(AO_HAVE_compare_and_swap_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_write) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_write) || defined(AO_HAVE_and_write) \ + || defined(AO_HAVE_or_write) || defined(AO_HAVE_xor_write) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_write) + (void)"AO_nop_write(): "; + AO_nop_write(); +# else + (void)"No AO_nop_write"; +# endif + +# ifdef AO_HAVE_load_write + (void)"AO_load_write(&val):"; + AO_load_write(&val); +# else + (void)"No AO_load_write"; +# endif +# ifdef AO_HAVE_store_write + (void)"AO_store_write(&val, newval):"; + AO_store_write(&val, newval); +# else + (void)"No AO_store_write"; +# endif +# ifdef AO_HAVE_fetch_and_add_write + (void)"AO_fetch_and_add_write(&val, incr):"; + AO_fetch_and_add_write(&val, incr); +# else + (void)"No AO_fetch_and_add_write"; +# endif +# ifdef AO_HAVE_fetch_and_add1_write + (void)"AO_fetch_and_add1_write(&val):"; + AO_fetch_and_add1_write(&val); +# else + (void)"No AO_fetch_and_add1_write"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_write + (void)"AO_fetch_and_sub1_write(&val):"; + AO_fetch_and_sub1_write(&val); +# else + (void)"No AO_fetch_and_sub1_write"; +# endif +# ifdef AO_HAVE_and_write + (void)"AO_and_write(&val, incr):"; + AO_and_write(&val, incr); +# else + (void)"No AO_and_write"; +# endif +# ifdef AO_HAVE_or_write + (void)"AO_or_write(&val, incr):"; + AO_or_write(&val, incr); +# else + (void)"No AO_or_write"; +# endif +# ifdef AO_HAVE_xor_write + (void)"AO_xor_write(&val, incr):"; + AO_xor_write(&val, incr); +# else + (void)"No AO_xor_write"; +# endif +# ifdef AO_HAVE_compare_and_swap_write + (void)"AO_compare_and_swap_write(&val, oldval, newval):"; + AO_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_write */ + /* TODO: Add AO_compare_and_swap_double_write */ +# ifdef AO_HAVE_fetch_compare_and_swap_write + (void)"AO_fetch_compare_and_swap_write(&val, oldval, newval):"; + AO_fetch_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_write"; +# endif + +# if defined(AO_HAVE_test_and_set_write) + (void)"AO_test_and_set_write(&ts):"; + AO_test_and_set_write(&ts); +# else + (void)"No AO_test_and_set_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_full(void) +{ +# if defined(AO_HAVE_load_full) || defined(AO_HAVE_store_full) \ + || defined(AO_HAVE_fetch_and_add_full) \ + || defined(AO_HAVE_fetch_and_add1_full) \ + || defined(AO_HAVE_and_full) \ + || defined(AO_HAVE_compare_and_swap_full) \ + || defined(AO_HAVE_fetch_compare_and_swap_full) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_full) \ + || defined(AO_HAVE_fetch_compare_and_swap_full) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_full) \ + || defined(AO_HAVE_compare_and_swap_full) \ + || defined(AO_HAVE_fetch_compare_and_swap_full) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_full) || defined(AO_HAVE_and_full) \ + || defined(AO_HAVE_or_full) || defined(AO_HAVE_xor_full) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_full) + (void)"AO_nop_full(): "; + AO_nop_full(); +# else + (void)"No AO_nop_full"; +# endif + +# ifdef AO_HAVE_load_full + (void)"AO_load_full(&val):"; + AO_load_full(&val); +# else + (void)"No AO_load_full"; +# endif +# ifdef AO_HAVE_store_full + (void)"AO_store_full(&val, newval):"; + AO_store_full(&val, newval); +# else + (void)"No AO_store_full"; +# endif +# ifdef AO_HAVE_fetch_and_add_full + (void)"AO_fetch_and_add_full(&val, incr):"; + AO_fetch_and_add_full(&val, incr); +# else + (void)"No AO_fetch_and_add_full"; +# endif +# ifdef AO_HAVE_fetch_and_add1_full + (void)"AO_fetch_and_add1_full(&val):"; + AO_fetch_and_add1_full(&val); +# else + (void)"No AO_fetch_and_add1_full"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_full + (void)"AO_fetch_and_sub1_full(&val):"; + AO_fetch_and_sub1_full(&val); +# else + (void)"No AO_fetch_and_sub1_full"; +# endif +# ifdef AO_HAVE_and_full + (void)"AO_and_full(&val, incr):"; + AO_and_full(&val, incr); +# else + (void)"No AO_and_full"; +# endif +# ifdef AO_HAVE_or_full + (void)"AO_or_full(&val, incr):"; + AO_or_full(&val, incr); +# else + (void)"No AO_or_full"; +# endif +# ifdef AO_HAVE_xor_full + (void)"AO_xor_full(&val, incr):"; + AO_xor_full(&val, incr); +# else + (void)"No AO_xor_full"; +# endif +# ifdef AO_HAVE_compare_and_swap_full + (void)"AO_compare_and_swap_full(&val, oldval, newval):"; + AO_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_full"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_full */ + /* TODO: Add AO_compare_and_swap_double_full */ +# ifdef AO_HAVE_fetch_compare_and_swap_full + (void)"AO_fetch_compare_and_swap_full(&val, oldval, newval):"; + AO_fetch_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_full"; +# endif + +# if defined(AO_HAVE_test_and_set_full) + (void)"AO_test_and_set_full(&ts):"; + AO_test_and_set_full(&ts); +# else + (void)"No AO_test_and_set_full"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_release_write(void) +{ +# if defined(AO_HAVE_load_release_write) || defined(AO_HAVE_store_release_write) \ + || defined(AO_HAVE_fetch_and_add_release_write) \ + || defined(AO_HAVE_fetch_and_add1_release_write) \ + || defined(AO_HAVE_and_release_write) \ + || defined(AO_HAVE_compare_and_swap_release_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_release_write) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_release_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_release_write) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_release_write) \ + || defined(AO_HAVE_compare_and_swap_release_write) \ + || defined(AO_HAVE_fetch_compare_and_swap_release_write) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_release_write) || defined(AO_HAVE_and_release_write) \ + || defined(AO_HAVE_or_release_write) || defined(AO_HAVE_xor_release_write) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release_write) + (void)"AO_nop_release_write(): "; + AO_nop_release_write(); +# else + (void)"No AO_nop_release_write"; +# endif + +# ifdef AO_HAVE_load_release_write + (void)"AO_load_release_write(&val):"; + AO_load_release_write(&val); +# else + (void)"No AO_load_release_write"; +# endif +# ifdef AO_HAVE_store_release_write + (void)"AO_store_release_write(&val, newval):"; + AO_store_release_write(&val, newval); +# else + (void)"No AO_store_release_write"; +# endif +# ifdef AO_HAVE_fetch_and_add_release_write + (void)"AO_fetch_and_add_release_write(&val, incr):"; + AO_fetch_and_add_release_write(&val, incr); +# else + (void)"No AO_fetch_and_add_release_write"; +# endif +# ifdef AO_HAVE_fetch_and_add1_release_write + (void)"AO_fetch_and_add1_release_write(&val):"; + AO_fetch_and_add1_release_write(&val); +# else + (void)"No AO_fetch_and_add1_release_write"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_release_write + (void)"AO_fetch_and_sub1_release_write(&val):"; + AO_fetch_and_sub1_release_write(&val); +# else + (void)"No AO_fetch_and_sub1_release_write"; +# endif +# ifdef AO_HAVE_and_release_write + (void)"AO_and_release_write(&val, incr):"; + AO_and_release_write(&val, incr); +# else + (void)"No AO_and_release_write"; +# endif +# ifdef AO_HAVE_or_release_write + (void)"AO_or_release_write(&val, incr):"; + AO_or_release_write(&val, incr); +# else + (void)"No AO_or_release_write"; +# endif +# ifdef AO_HAVE_xor_release_write + (void)"AO_xor_release_write(&val, incr):"; + AO_xor_release_write(&val, incr); +# else + (void)"No AO_xor_release_write"; +# endif +# ifdef AO_HAVE_compare_and_swap_release_write + (void)"AO_compare_and_swap_release_write(&val, oldval, newval):"; + AO_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_release_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release_write */ + /* TODO: Add AO_compare_and_swap_double_release_write */ +# ifdef AO_HAVE_fetch_compare_and_swap_release_write + (void)"AO_fetch_compare_and_swap_release_write(&val, oldval, newval):"; + AO_fetch_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_release_write"; +# endif + +# if defined(AO_HAVE_test_and_set_release_write) + (void)"AO_test_and_set_release_write(&ts):"; + AO_test_and_set_release_write(&ts); +# else + (void)"No AO_test_and_set_release_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_acquire_read(void) +{ +# if defined(AO_HAVE_load_acquire_read) || defined(AO_HAVE_store_acquire_read) \ + || defined(AO_HAVE_fetch_and_add_acquire_read) \ + || defined(AO_HAVE_fetch_and_add1_acquire_read) \ + || defined(AO_HAVE_and_acquire_read) \ + || defined(AO_HAVE_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire_read) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire_read) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_acquire_read) \ + || defined(AO_HAVE_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_acquire_read) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_acquire_read) || defined(AO_HAVE_and_acquire_read) \ + || defined(AO_HAVE_or_acquire_read) || defined(AO_HAVE_xor_acquire_read) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + (void)"AO_nop_acquire_read(): "; + AO_nop_acquire_read(); +# else + (void)"No AO_nop_acquire_read"; +# endif + +# ifdef AO_HAVE_load_acquire_read + (void)"AO_load_acquire_read(&val):"; + AO_load_acquire_read(&val); +# else + (void)"No AO_load_acquire_read"; +# endif +# ifdef AO_HAVE_store_acquire_read + (void)"AO_store_acquire_read(&val, newval):"; + AO_store_acquire_read(&val, newval); +# else + (void)"No AO_store_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_add_acquire_read + (void)"AO_fetch_and_add_acquire_read(&val, incr):"; + AO_fetch_and_add_acquire_read(&val, incr); +# else + (void)"No AO_fetch_and_add_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_add1_acquire_read + (void)"AO_fetch_and_add1_acquire_read(&val):"; + AO_fetch_and_add1_acquire_read(&val); +# else + (void)"No AO_fetch_and_add1_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_acquire_read + (void)"AO_fetch_and_sub1_acquire_read(&val):"; + AO_fetch_and_sub1_acquire_read(&val); +# else + (void)"No AO_fetch_and_sub1_acquire_read"; +# endif +# ifdef AO_HAVE_and_acquire_read + (void)"AO_and_acquire_read(&val, incr):"; + AO_and_acquire_read(&val, incr); +# else + (void)"No AO_and_acquire_read"; +# endif +# ifdef AO_HAVE_or_acquire_read + (void)"AO_or_acquire_read(&val, incr):"; + AO_or_acquire_read(&val, incr); +# else + (void)"No AO_or_acquire_read"; +# endif +# ifdef AO_HAVE_xor_acquire_read + (void)"AO_xor_acquire_read(&val, incr):"; + AO_xor_acquire_read(&val, incr); +# else + (void)"No AO_xor_acquire_read"; +# endif +# ifdef AO_HAVE_compare_and_swap_acquire_read + (void)"AO_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_acquire_read */ +# ifdef AO_HAVE_fetch_compare_and_swap_acquire_read + (void)"AO_fetch_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_fetch_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire_read) + (void)"AO_test_and_set_acquire_read(&ts):"; + AO_test_and_set_acquire_read(&ts); +# else + (void)"No AO_test_and_set_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void list_atomic_dd_acquire_read(void) +{ +# if defined(AO_HAVE_load_dd_acquire_read) || defined(AO_HAVE_store_dd_acquire_read) \ + || defined(AO_HAVE_fetch_and_add_dd_acquire_read) \ + || defined(AO_HAVE_fetch_and_add1_dd_acquire_read) \ + || defined(AO_HAVE_and_dd_acquire_read) \ + || defined(AO_HAVE_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_dd_acquire_read) + static volatile AO_t val /* = 0 */; +# endif +# if defined(AO_HAVE_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_dd_acquire_read) + static AO_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_store_dd_acquire_read) \ + || defined(AO_HAVE_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_fetch_compare_and_swap_dd_acquire_read) + static AO_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_fetch_and_add_dd_acquire_read) || defined(AO_HAVE_and_dd_acquire_read) \ + || defined(AO_HAVE_or_dd_acquire_read) || defined(AO_HAVE_xor_dd_acquire_read) + static AO_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_dd_acquire_read) + (void)"AO_nop_dd_acquire_read(): "; + AO_nop_dd_acquire_read(); +# else + (void)"No AO_nop_dd_acquire_read"; +# endif + +# ifdef AO_HAVE_load_dd_acquire_read + (void)"AO_load_dd_acquire_read(&val):"; + AO_load_dd_acquire_read(&val); +# else + (void)"No AO_load_dd_acquire_read"; +# endif +# ifdef AO_HAVE_store_dd_acquire_read + (void)"AO_store_dd_acquire_read(&val, newval):"; + AO_store_dd_acquire_read(&val, newval); +# else + (void)"No AO_store_dd_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_add_dd_acquire_read + (void)"AO_fetch_and_add_dd_acquire_read(&val, incr):"; + AO_fetch_and_add_dd_acquire_read(&val, incr); +# else + (void)"No AO_fetch_and_add_dd_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_add1_dd_acquire_read + (void)"AO_fetch_and_add1_dd_acquire_read(&val):"; + AO_fetch_and_add1_dd_acquire_read(&val); +# else + (void)"No AO_fetch_and_add1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_fetch_and_sub1_dd_acquire_read + (void)"AO_fetch_and_sub1_dd_acquire_read(&val):"; + AO_fetch_and_sub1_dd_acquire_read(&val); +# else + (void)"No AO_fetch_and_sub1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_and_dd_acquire_read + (void)"AO_and_dd_acquire_read(&val, incr):"; + AO_and_dd_acquire_read(&val, incr); +# else + (void)"No AO_and_dd_acquire_read"; +# endif +# ifdef AO_HAVE_or_dd_acquire_read + (void)"AO_or_dd_acquire_read(&val, incr):"; + AO_or_dd_acquire_read(&val, incr); +# else + (void)"No AO_or_dd_acquire_read"; +# endif +# ifdef AO_HAVE_xor_dd_acquire_read + (void)"AO_xor_dd_acquire_read(&val, incr):"; + AO_xor_dd_acquire_read(&val, incr); +# else + (void)"No AO_xor_dd_acquire_read"; +# endif +# ifdef AO_HAVE_compare_and_swap_dd_acquire_read + (void)"AO_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_compare_and_swap_dd_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_dd_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_dd_acquire_read */ +# ifdef AO_HAVE_fetch_compare_and_swap_dd_acquire_read + (void)"AO_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_fetch_compare_and_swap_dd_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + (void)"AO_test_and_set_dd_acquire_read(&ts):"; + AO_test_and_set_dd_acquire_read(&ts); +# else + (void)"No AO_test_and_set_dd_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic(void) +{ +# if defined(AO_HAVE_char_load) || defined(AO_HAVE_char_store) \ + || defined(AO_HAVE_char_fetch_and_add) \ + || defined(AO_HAVE_char_fetch_and_add1) \ + || defined(AO_HAVE_char_and) \ + || defined(AO_HAVE_char_compare_and_swap) \ + || defined(AO_HAVE_char_fetch_compare_and_swap) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap) \ + || defined(AO_HAVE_char_fetch_compare_and_swap) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store) \ + || defined(AO_HAVE_char_compare_and_swap) \ + || defined(AO_HAVE_char_fetch_compare_and_swap) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add) || defined(AO_HAVE_char_and) \ + || defined(AO_HAVE_char_or) || defined(AO_HAVE_char_xor) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop) + (void)"AO_nop(): "; + AO_nop(); +# else + (void)"No AO_nop"; +# endif + +# ifdef AO_HAVE_char_load + (void)"AO_char_load(&val):"; + AO_char_load(&val); +# else + (void)"No AO_char_load"; +# endif +# ifdef AO_HAVE_char_store + (void)"AO_char_store(&val, newval):"; + AO_char_store(&val, newval); +# else + (void)"No AO_char_store"; +# endif +# ifdef AO_HAVE_char_fetch_and_add + (void)"AO_char_fetch_and_add(&val, incr):"; + AO_char_fetch_and_add(&val, incr); +# else + (void)"No AO_char_fetch_and_add"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1 + (void)"AO_char_fetch_and_add1(&val):"; + AO_char_fetch_and_add1(&val); +# else + (void)"No AO_char_fetch_and_add1"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1 + (void)"AO_char_fetch_and_sub1(&val):"; + AO_char_fetch_and_sub1(&val); +# else + (void)"No AO_char_fetch_and_sub1"; +# endif +# ifdef AO_HAVE_char_and + (void)"AO_char_and(&val, incr):"; + AO_char_and(&val, incr); +# else + (void)"No AO_char_and"; +# endif +# ifdef AO_HAVE_char_or + (void)"AO_char_or(&val, incr):"; + AO_char_or(&val, incr); +# else + (void)"No AO_char_or"; +# endif +# ifdef AO_HAVE_char_xor + (void)"AO_char_xor(&val, incr):"; + AO_char_xor(&val, incr); +# else + (void)"No AO_char_xor"; +# endif +# ifdef AO_HAVE_char_compare_and_swap + (void)"AO_char_compare_and_swap(&val, oldval, newval):"; + AO_char_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap"; +# endif + /* TODO: Add AO_compare_double_and_swap_double */ + /* TODO: Add AO_compare_and_swap_double */ +# ifdef AO_HAVE_char_fetch_compare_and_swap + (void)"AO_char_fetch_compare_and_swap(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap"; +# endif + +# if defined(AO_HAVE_test_and_set) + (void)"AO_test_and_set(&ts):"; + AO_test_and_set(&ts); +# else + (void)"No AO_test_and_set"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_release(void) +{ +# if defined(AO_HAVE_char_load_release) || defined(AO_HAVE_char_store_release) \ + || defined(AO_HAVE_char_fetch_and_add_release) \ + || defined(AO_HAVE_char_fetch_and_add1_release) \ + || defined(AO_HAVE_char_and_release) \ + || defined(AO_HAVE_char_compare_and_swap_release) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_release) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_release) \ + || defined(AO_HAVE_char_compare_and_swap_release) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_release) || defined(AO_HAVE_char_and_release) \ + || defined(AO_HAVE_char_or_release) || defined(AO_HAVE_char_xor_release) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release) + (void)"AO_nop_release(): "; + AO_nop_release(); +# else + (void)"No AO_nop_release"; +# endif + +# ifdef AO_HAVE_char_load_release + (void)"AO_char_load_release(&val):"; + AO_char_load_release(&val); +# else + (void)"No AO_char_load_release"; +# endif +# ifdef AO_HAVE_char_store_release + (void)"AO_char_store_release(&val, newval):"; + AO_char_store_release(&val, newval); +# else + (void)"No AO_char_store_release"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_release + (void)"AO_char_fetch_and_add_release(&val, incr):"; + AO_char_fetch_and_add_release(&val, incr); +# else + (void)"No AO_char_fetch_and_add_release"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_release + (void)"AO_char_fetch_and_add1_release(&val):"; + AO_char_fetch_and_add1_release(&val); +# else + (void)"No AO_char_fetch_and_add1_release"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_release + (void)"AO_char_fetch_and_sub1_release(&val):"; + AO_char_fetch_and_sub1_release(&val); +# else + (void)"No AO_char_fetch_and_sub1_release"; +# endif +# ifdef AO_HAVE_char_and_release + (void)"AO_char_and_release(&val, incr):"; + AO_char_and_release(&val, incr); +# else + (void)"No AO_char_and_release"; +# endif +# ifdef AO_HAVE_char_or_release + (void)"AO_char_or_release(&val, incr):"; + AO_char_or_release(&val, incr); +# else + (void)"No AO_char_or_release"; +# endif +# ifdef AO_HAVE_char_xor_release + (void)"AO_char_xor_release(&val, incr):"; + AO_char_xor_release(&val, incr); +# else + (void)"No AO_char_xor_release"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_release + (void)"AO_char_compare_and_swap_release(&val, oldval, newval):"; + AO_char_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_release"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release */ + /* TODO: Add AO_compare_and_swap_double_release */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_release + (void)"AO_char_fetch_compare_and_swap_release(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_release"; +# endif + +# if defined(AO_HAVE_test_and_set_release) + (void)"AO_test_and_set_release(&ts):"; + AO_test_and_set_release(&ts); +# else + (void)"No AO_test_and_set_release"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_acquire(void) +{ +# if defined(AO_HAVE_char_load_acquire) || defined(AO_HAVE_char_store_acquire) \ + || defined(AO_HAVE_char_fetch_and_add_acquire) \ + || defined(AO_HAVE_char_fetch_and_add1_acquire) \ + || defined(AO_HAVE_char_and_acquire) \ + || defined(AO_HAVE_char_compare_and_swap_acquire) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_acquire) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_acquire) \ + || defined(AO_HAVE_char_compare_and_swap_acquire) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_acquire) || defined(AO_HAVE_char_and_acquire) \ + || defined(AO_HAVE_char_or_acquire) || defined(AO_HAVE_char_xor_acquire) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire) + (void)"AO_nop_acquire(): "; + AO_nop_acquire(); +# else + (void)"No AO_nop_acquire"; +# endif + +# ifdef AO_HAVE_char_load_acquire + (void)"AO_char_load_acquire(&val):"; + AO_char_load_acquire(&val); +# else + (void)"No AO_char_load_acquire"; +# endif +# ifdef AO_HAVE_char_store_acquire + (void)"AO_char_store_acquire(&val, newval):"; + AO_char_store_acquire(&val, newval); +# else + (void)"No AO_char_store_acquire"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_acquire + (void)"AO_char_fetch_and_add_acquire(&val, incr):"; + AO_char_fetch_and_add_acquire(&val, incr); +# else + (void)"No AO_char_fetch_and_add_acquire"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_acquire + (void)"AO_char_fetch_and_add1_acquire(&val):"; + AO_char_fetch_and_add1_acquire(&val); +# else + (void)"No AO_char_fetch_and_add1_acquire"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_acquire + (void)"AO_char_fetch_and_sub1_acquire(&val):"; + AO_char_fetch_and_sub1_acquire(&val); +# else + (void)"No AO_char_fetch_and_sub1_acquire"; +# endif +# ifdef AO_HAVE_char_and_acquire + (void)"AO_char_and_acquire(&val, incr):"; + AO_char_and_acquire(&val, incr); +# else + (void)"No AO_char_and_acquire"; +# endif +# ifdef AO_HAVE_char_or_acquire + (void)"AO_char_or_acquire(&val, incr):"; + AO_char_or_acquire(&val, incr); +# else + (void)"No AO_char_or_acquire"; +# endif +# ifdef AO_HAVE_char_xor_acquire + (void)"AO_char_xor_acquire(&val, incr):"; + AO_char_xor_acquire(&val, incr); +# else + (void)"No AO_char_xor_acquire"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_acquire + (void)"AO_char_compare_and_swap_acquire(&val, oldval, newval):"; + AO_char_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_acquire"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire */ + /* TODO: Add AO_compare_and_swap_double_acquire */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_acquire + (void)"AO_char_fetch_compare_and_swap_acquire(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_acquire"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire) + (void)"AO_test_and_set_acquire(&ts):"; + AO_test_and_set_acquire(&ts); +# else + (void)"No AO_test_and_set_acquire"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_read(void) +{ +# if defined(AO_HAVE_char_load_read) || defined(AO_HAVE_char_store_read) \ + || defined(AO_HAVE_char_fetch_and_add_read) \ + || defined(AO_HAVE_char_fetch_and_add1_read) \ + || defined(AO_HAVE_char_and_read) \ + || defined(AO_HAVE_char_compare_and_swap_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_read) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_read) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_read) \ + || defined(AO_HAVE_char_compare_and_swap_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_read) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_read) || defined(AO_HAVE_char_and_read) \ + || defined(AO_HAVE_char_or_read) || defined(AO_HAVE_char_xor_read) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_read) + (void)"AO_nop_read(): "; + AO_nop_read(); +# else + (void)"No AO_nop_read"; +# endif + +# ifdef AO_HAVE_char_load_read + (void)"AO_char_load_read(&val):"; + AO_char_load_read(&val); +# else + (void)"No AO_char_load_read"; +# endif +# ifdef AO_HAVE_char_store_read + (void)"AO_char_store_read(&val, newval):"; + AO_char_store_read(&val, newval); +# else + (void)"No AO_char_store_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_read + (void)"AO_char_fetch_and_add_read(&val, incr):"; + AO_char_fetch_and_add_read(&val, incr); +# else + (void)"No AO_char_fetch_and_add_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_read + (void)"AO_char_fetch_and_add1_read(&val):"; + AO_char_fetch_and_add1_read(&val); +# else + (void)"No AO_char_fetch_and_add1_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_read + (void)"AO_char_fetch_and_sub1_read(&val):"; + AO_char_fetch_and_sub1_read(&val); +# else + (void)"No AO_char_fetch_and_sub1_read"; +# endif +# ifdef AO_HAVE_char_and_read + (void)"AO_char_and_read(&val, incr):"; + AO_char_and_read(&val, incr); +# else + (void)"No AO_char_and_read"; +# endif +# ifdef AO_HAVE_char_or_read + (void)"AO_char_or_read(&val, incr):"; + AO_char_or_read(&val, incr); +# else + (void)"No AO_char_or_read"; +# endif +# ifdef AO_HAVE_char_xor_read + (void)"AO_char_xor_read(&val, incr):"; + AO_char_xor_read(&val, incr); +# else + (void)"No AO_char_xor_read"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_read + (void)"AO_char_compare_and_swap_read(&val, oldval, newval):"; + AO_char_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_read */ + /* TODO: Add AO_compare_and_swap_double_read */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_read + (void)"AO_char_fetch_compare_and_swap_read(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_read"; +# endif + +# if defined(AO_HAVE_test_and_set_read) + (void)"AO_test_and_set_read(&ts):"; + AO_test_and_set_read(&ts); +# else + (void)"No AO_test_and_set_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_write(void) +{ +# if defined(AO_HAVE_char_load_write) || defined(AO_HAVE_char_store_write) \ + || defined(AO_HAVE_char_fetch_and_add_write) \ + || defined(AO_HAVE_char_fetch_and_add1_write) \ + || defined(AO_HAVE_char_and_write) \ + || defined(AO_HAVE_char_compare_and_swap_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_write) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_write) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_write) \ + || defined(AO_HAVE_char_compare_and_swap_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_write) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_write) || defined(AO_HAVE_char_and_write) \ + || defined(AO_HAVE_char_or_write) || defined(AO_HAVE_char_xor_write) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_write) + (void)"AO_nop_write(): "; + AO_nop_write(); +# else + (void)"No AO_nop_write"; +# endif + +# ifdef AO_HAVE_char_load_write + (void)"AO_char_load_write(&val):"; + AO_char_load_write(&val); +# else + (void)"No AO_char_load_write"; +# endif +# ifdef AO_HAVE_char_store_write + (void)"AO_char_store_write(&val, newval):"; + AO_char_store_write(&val, newval); +# else + (void)"No AO_char_store_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_write + (void)"AO_char_fetch_and_add_write(&val, incr):"; + AO_char_fetch_and_add_write(&val, incr); +# else + (void)"No AO_char_fetch_and_add_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_write + (void)"AO_char_fetch_and_add1_write(&val):"; + AO_char_fetch_and_add1_write(&val); +# else + (void)"No AO_char_fetch_and_add1_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_write + (void)"AO_char_fetch_and_sub1_write(&val):"; + AO_char_fetch_and_sub1_write(&val); +# else + (void)"No AO_char_fetch_and_sub1_write"; +# endif +# ifdef AO_HAVE_char_and_write + (void)"AO_char_and_write(&val, incr):"; + AO_char_and_write(&val, incr); +# else + (void)"No AO_char_and_write"; +# endif +# ifdef AO_HAVE_char_or_write + (void)"AO_char_or_write(&val, incr):"; + AO_char_or_write(&val, incr); +# else + (void)"No AO_char_or_write"; +# endif +# ifdef AO_HAVE_char_xor_write + (void)"AO_char_xor_write(&val, incr):"; + AO_char_xor_write(&val, incr); +# else + (void)"No AO_char_xor_write"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_write + (void)"AO_char_compare_and_swap_write(&val, oldval, newval):"; + AO_char_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_write */ + /* TODO: Add AO_compare_and_swap_double_write */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_write + (void)"AO_char_fetch_compare_and_swap_write(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_write"; +# endif + +# if defined(AO_HAVE_test_and_set_write) + (void)"AO_test_and_set_write(&ts):"; + AO_test_and_set_write(&ts); +# else + (void)"No AO_test_and_set_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_full(void) +{ +# if defined(AO_HAVE_char_load_full) || defined(AO_HAVE_char_store_full) \ + || defined(AO_HAVE_char_fetch_and_add_full) \ + || defined(AO_HAVE_char_fetch_and_add1_full) \ + || defined(AO_HAVE_char_and_full) \ + || defined(AO_HAVE_char_compare_and_swap_full) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_full) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_full) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_full) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_full) \ + || defined(AO_HAVE_char_compare_and_swap_full) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_full) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_full) || defined(AO_HAVE_char_and_full) \ + || defined(AO_HAVE_char_or_full) || defined(AO_HAVE_char_xor_full) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_full) + (void)"AO_nop_full(): "; + AO_nop_full(); +# else + (void)"No AO_nop_full"; +# endif + +# ifdef AO_HAVE_char_load_full + (void)"AO_char_load_full(&val):"; + AO_char_load_full(&val); +# else + (void)"No AO_char_load_full"; +# endif +# ifdef AO_HAVE_char_store_full + (void)"AO_char_store_full(&val, newval):"; + AO_char_store_full(&val, newval); +# else + (void)"No AO_char_store_full"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_full + (void)"AO_char_fetch_and_add_full(&val, incr):"; + AO_char_fetch_and_add_full(&val, incr); +# else + (void)"No AO_char_fetch_and_add_full"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_full + (void)"AO_char_fetch_and_add1_full(&val):"; + AO_char_fetch_and_add1_full(&val); +# else + (void)"No AO_char_fetch_and_add1_full"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_full + (void)"AO_char_fetch_and_sub1_full(&val):"; + AO_char_fetch_and_sub1_full(&val); +# else + (void)"No AO_char_fetch_and_sub1_full"; +# endif +# ifdef AO_HAVE_char_and_full + (void)"AO_char_and_full(&val, incr):"; + AO_char_and_full(&val, incr); +# else + (void)"No AO_char_and_full"; +# endif +# ifdef AO_HAVE_char_or_full + (void)"AO_char_or_full(&val, incr):"; + AO_char_or_full(&val, incr); +# else + (void)"No AO_char_or_full"; +# endif +# ifdef AO_HAVE_char_xor_full + (void)"AO_char_xor_full(&val, incr):"; + AO_char_xor_full(&val, incr); +# else + (void)"No AO_char_xor_full"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_full + (void)"AO_char_compare_and_swap_full(&val, oldval, newval):"; + AO_char_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_full"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_full */ + /* TODO: Add AO_compare_and_swap_double_full */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_full + (void)"AO_char_fetch_compare_and_swap_full(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_full"; +# endif + +# if defined(AO_HAVE_test_and_set_full) + (void)"AO_test_and_set_full(&ts):"; + AO_test_and_set_full(&ts); +# else + (void)"No AO_test_and_set_full"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_release_write(void) +{ +# if defined(AO_HAVE_char_load_release_write) || defined(AO_HAVE_char_store_release_write) \ + || defined(AO_HAVE_char_fetch_and_add_release_write) \ + || defined(AO_HAVE_char_fetch_and_add1_release_write) \ + || defined(AO_HAVE_char_and_release_write) \ + || defined(AO_HAVE_char_compare_and_swap_release_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release_write) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_release_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release_write) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_release_write) \ + || defined(AO_HAVE_char_compare_and_swap_release_write) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_release_write) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_release_write) || defined(AO_HAVE_char_and_release_write) \ + || defined(AO_HAVE_char_or_release_write) || defined(AO_HAVE_char_xor_release_write) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release_write) + (void)"AO_nop_release_write(): "; + AO_nop_release_write(); +# else + (void)"No AO_nop_release_write"; +# endif + +# ifdef AO_HAVE_char_load_release_write + (void)"AO_char_load_release_write(&val):"; + AO_char_load_release_write(&val); +# else + (void)"No AO_char_load_release_write"; +# endif +# ifdef AO_HAVE_char_store_release_write + (void)"AO_char_store_release_write(&val, newval):"; + AO_char_store_release_write(&val, newval); +# else + (void)"No AO_char_store_release_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_release_write + (void)"AO_char_fetch_and_add_release_write(&val, incr):"; + AO_char_fetch_and_add_release_write(&val, incr); +# else + (void)"No AO_char_fetch_and_add_release_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_release_write + (void)"AO_char_fetch_and_add1_release_write(&val):"; + AO_char_fetch_and_add1_release_write(&val); +# else + (void)"No AO_char_fetch_and_add1_release_write"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_release_write + (void)"AO_char_fetch_and_sub1_release_write(&val):"; + AO_char_fetch_and_sub1_release_write(&val); +# else + (void)"No AO_char_fetch_and_sub1_release_write"; +# endif +# ifdef AO_HAVE_char_and_release_write + (void)"AO_char_and_release_write(&val, incr):"; + AO_char_and_release_write(&val, incr); +# else + (void)"No AO_char_and_release_write"; +# endif +# ifdef AO_HAVE_char_or_release_write + (void)"AO_char_or_release_write(&val, incr):"; + AO_char_or_release_write(&val, incr); +# else + (void)"No AO_char_or_release_write"; +# endif +# ifdef AO_HAVE_char_xor_release_write + (void)"AO_char_xor_release_write(&val, incr):"; + AO_char_xor_release_write(&val, incr); +# else + (void)"No AO_char_xor_release_write"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_release_write + (void)"AO_char_compare_and_swap_release_write(&val, oldval, newval):"; + AO_char_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_release_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release_write */ + /* TODO: Add AO_compare_and_swap_double_release_write */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_release_write + (void)"AO_char_fetch_compare_and_swap_release_write(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_release_write"; +# endif + +# if defined(AO_HAVE_test_and_set_release_write) + (void)"AO_test_and_set_release_write(&ts):"; + AO_test_and_set_release_write(&ts); +# else + (void)"No AO_test_and_set_release_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_acquire_read(void) +{ +# if defined(AO_HAVE_char_load_acquire_read) || defined(AO_HAVE_char_store_acquire_read) \ + || defined(AO_HAVE_char_fetch_and_add_acquire_read) \ + || defined(AO_HAVE_char_fetch_and_add1_acquire_read) \ + || defined(AO_HAVE_char_and_acquire_read) \ + || defined(AO_HAVE_char_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire_read) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire_read) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_acquire_read) \ + || defined(AO_HAVE_char_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_acquire_read) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_acquire_read) || defined(AO_HAVE_char_and_acquire_read) \ + || defined(AO_HAVE_char_or_acquire_read) || defined(AO_HAVE_char_xor_acquire_read) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + (void)"AO_nop_acquire_read(): "; + AO_nop_acquire_read(); +# else + (void)"No AO_nop_acquire_read"; +# endif + +# ifdef AO_HAVE_char_load_acquire_read + (void)"AO_char_load_acquire_read(&val):"; + AO_char_load_acquire_read(&val); +# else + (void)"No AO_char_load_acquire_read"; +# endif +# ifdef AO_HAVE_char_store_acquire_read + (void)"AO_char_store_acquire_read(&val, newval):"; + AO_char_store_acquire_read(&val, newval); +# else + (void)"No AO_char_store_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_acquire_read + (void)"AO_char_fetch_and_add_acquire_read(&val, incr):"; + AO_char_fetch_and_add_acquire_read(&val, incr); +# else + (void)"No AO_char_fetch_and_add_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_acquire_read + (void)"AO_char_fetch_and_add1_acquire_read(&val):"; + AO_char_fetch_and_add1_acquire_read(&val); +# else + (void)"No AO_char_fetch_and_add1_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_acquire_read + (void)"AO_char_fetch_and_sub1_acquire_read(&val):"; + AO_char_fetch_and_sub1_acquire_read(&val); +# else + (void)"No AO_char_fetch_and_sub1_acquire_read"; +# endif +# ifdef AO_HAVE_char_and_acquire_read + (void)"AO_char_and_acquire_read(&val, incr):"; + AO_char_and_acquire_read(&val, incr); +# else + (void)"No AO_char_and_acquire_read"; +# endif +# ifdef AO_HAVE_char_or_acquire_read + (void)"AO_char_or_acquire_read(&val, incr):"; + AO_char_or_acquire_read(&val, incr); +# else + (void)"No AO_char_or_acquire_read"; +# endif +# ifdef AO_HAVE_char_xor_acquire_read + (void)"AO_char_xor_acquire_read(&val, incr):"; + AO_char_xor_acquire_read(&val, incr); +# else + (void)"No AO_char_xor_acquire_read"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_acquire_read + (void)"AO_char_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_char_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_acquire_read */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_acquire_read + (void)"AO_char_fetch_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire_read) + (void)"AO_test_and_set_acquire_read(&ts):"; + AO_test_and_set_acquire_read(&ts); +# else + (void)"No AO_test_and_set_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void char_list_atomic_dd_acquire_read(void) +{ +# if defined(AO_HAVE_char_load_dd_acquire_read) || defined(AO_HAVE_char_store_dd_acquire_read) \ + || defined(AO_HAVE_char_fetch_and_add_dd_acquire_read) \ + || defined(AO_HAVE_char_fetch_and_add1_dd_acquire_read) \ + || defined(AO_HAVE_char_and_dd_acquire_read) \ + || defined(AO_HAVE_char_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_dd_acquire_read) + static volatile unsigned/**/char val /* = 0 */; +# endif +# if defined(AO_HAVE_char_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_dd_acquire_read) + static unsigned/**/char oldval /* = 0 */; +# endif +# if defined(AO_HAVE_char_store_dd_acquire_read) \ + || defined(AO_HAVE_char_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_char_fetch_compare_and_swap_dd_acquire_read) + static unsigned/**/char newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_char_fetch_and_add_dd_acquire_read) || defined(AO_HAVE_char_and_dd_acquire_read) \ + || defined(AO_HAVE_char_or_dd_acquire_read) || defined(AO_HAVE_char_xor_dd_acquire_read) + static unsigned/**/char incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_dd_acquire_read) + (void)"AO_nop_dd_acquire_read(): "; + AO_nop_dd_acquire_read(); +# else + (void)"No AO_nop_dd_acquire_read"; +# endif + +# ifdef AO_HAVE_char_load_dd_acquire_read + (void)"AO_char_load_dd_acquire_read(&val):"; + AO_char_load_dd_acquire_read(&val); +# else + (void)"No AO_char_load_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_store_dd_acquire_read + (void)"AO_char_store_dd_acquire_read(&val, newval):"; + AO_char_store_dd_acquire_read(&val, newval); +# else + (void)"No AO_char_store_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add_dd_acquire_read + (void)"AO_char_fetch_and_add_dd_acquire_read(&val, incr):"; + AO_char_fetch_and_add_dd_acquire_read(&val, incr); +# else + (void)"No AO_char_fetch_and_add_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_add1_dd_acquire_read + (void)"AO_char_fetch_and_add1_dd_acquire_read(&val):"; + AO_char_fetch_and_add1_dd_acquire_read(&val); +# else + (void)"No AO_char_fetch_and_add1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_fetch_and_sub1_dd_acquire_read + (void)"AO_char_fetch_and_sub1_dd_acquire_read(&val):"; + AO_char_fetch_and_sub1_dd_acquire_read(&val); +# else + (void)"No AO_char_fetch_and_sub1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_and_dd_acquire_read + (void)"AO_char_and_dd_acquire_read(&val, incr):"; + AO_char_and_dd_acquire_read(&val, incr); +# else + (void)"No AO_char_and_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_or_dd_acquire_read + (void)"AO_char_or_dd_acquire_read(&val, incr):"; + AO_char_or_dd_acquire_read(&val, incr); +# else + (void)"No AO_char_or_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_xor_dd_acquire_read + (void)"AO_char_xor_dd_acquire_read(&val, incr):"; + AO_char_xor_dd_acquire_read(&val, incr); +# else + (void)"No AO_char_xor_dd_acquire_read"; +# endif +# ifdef AO_HAVE_char_compare_and_swap_dd_acquire_read + (void)"AO_char_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_char_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_char_compare_and_swap_dd_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_dd_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_dd_acquire_read */ +# ifdef AO_HAVE_char_fetch_compare_and_swap_dd_acquire_read + (void)"AO_char_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_char_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_char_fetch_compare_and_swap_dd_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + (void)"AO_test_and_set_dd_acquire_read(&ts):"; + AO_test_and_set_dd_acquire_read(&ts); +# else + (void)"No AO_test_and_set_dd_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic(void) +{ +# if defined(AO_HAVE_short_load) || defined(AO_HAVE_short_store) \ + || defined(AO_HAVE_short_fetch_and_add) \ + || defined(AO_HAVE_short_fetch_and_add1) \ + || defined(AO_HAVE_short_and) \ + || defined(AO_HAVE_short_compare_and_swap) \ + || defined(AO_HAVE_short_fetch_compare_and_swap) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap) \ + || defined(AO_HAVE_short_fetch_compare_and_swap) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store) \ + || defined(AO_HAVE_short_compare_and_swap) \ + || defined(AO_HAVE_short_fetch_compare_and_swap) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add) || defined(AO_HAVE_short_and) \ + || defined(AO_HAVE_short_or) || defined(AO_HAVE_short_xor) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop) + (void)"AO_nop(): "; + AO_nop(); +# else + (void)"No AO_nop"; +# endif + +# ifdef AO_HAVE_short_load + (void)"AO_short_load(&val):"; + AO_short_load(&val); +# else + (void)"No AO_short_load"; +# endif +# ifdef AO_HAVE_short_store + (void)"AO_short_store(&val, newval):"; + AO_short_store(&val, newval); +# else + (void)"No AO_short_store"; +# endif +# ifdef AO_HAVE_short_fetch_and_add + (void)"AO_short_fetch_and_add(&val, incr):"; + AO_short_fetch_and_add(&val, incr); +# else + (void)"No AO_short_fetch_and_add"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1 + (void)"AO_short_fetch_and_add1(&val):"; + AO_short_fetch_and_add1(&val); +# else + (void)"No AO_short_fetch_and_add1"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1 + (void)"AO_short_fetch_and_sub1(&val):"; + AO_short_fetch_and_sub1(&val); +# else + (void)"No AO_short_fetch_and_sub1"; +# endif +# ifdef AO_HAVE_short_and + (void)"AO_short_and(&val, incr):"; + AO_short_and(&val, incr); +# else + (void)"No AO_short_and"; +# endif +# ifdef AO_HAVE_short_or + (void)"AO_short_or(&val, incr):"; + AO_short_or(&val, incr); +# else + (void)"No AO_short_or"; +# endif +# ifdef AO_HAVE_short_xor + (void)"AO_short_xor(&val, incr):"; + AO_short_xor(&val, incr); +# else + (void)"No AO_short_xor"; +# endif +# ifdef AO_HAVE_short_compare_and_swap + (void)"AO_short_compare_and_swap(&val, oldval, newval):"; + AO_short_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap"; +# endif + /* TODO: Add AO_compare_double_and_swap_double */ + /* TODO: Add AO_compare_and_swap_double */ +# ifdef AO_HAVE_short_fetch_compare_and_swap + (void)"AO_short_fetch_compare_and_swap(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap"; +# endif + +# if defined(AO_HAVE_test_and_set) + (void)"AO_test_and_set(&ts):"; + AO_test_and_set(&ts); +# else + (void)"No AO_test_and_set"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_release(void) +{ +# if defined(AO_HAVE_short_load_release) || defined(AO_HAVE_short_store_release) \ + || defined(AO_HAVE_short_fetch_and_add_release) \ + || defined(AO_HAVE_short_fetch_and_add1_release) \ + || defined(AO_HAVE_short_and_release) \ + || defined(AO_HAVE_short_compare_and_swap_release) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_release) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_release) \ + || defined(AO_HAVE_short_compare_and_swap_release) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_release) || defined(AO_HAVE_short_and_release) \ + || defined(AO_HAVE_short_or_release) || defined(AO_HAVE_short_xor_release) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release) + (void)"AO_nop_release(): "; + AO_nop_release(); +# else + (void)"No AO_nop_release"; +# endif + +# ifdef AO_HAVE_short_load_release + (void)"AO_short_load_release(&val):"; + AO_short_load_release(&val); +# else + (void)"No AO_short_load_release"; +# endif +# ifdef AO_HAVE_short_store_release + (void)"AO_short_store_release(&val, newval):"; + AO_short_store_release(&val, newval); +# else + (void)"No AO_short_store_release"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_release + (void)"AO_short_fetch_and_add_release(&val, incr):"; + AO_short_fetch_and_add_release(&val, incr); +# else + (void)"No AO_short_fetch_and_add_release"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_release + (void)"AO_short_fetch_and_add1_release(&val):"; + AO_short_fetch_and_add1_release(&val); +# else + (void)"No AO_short_fetch_and_add1_release"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_release + (void)"AO_short_fetch_and_sub1_release(&val):"; + AO_short_fetch_and_sub1_release(&val); +# else + (void)"No AO_short_fetch_and_sub1_release"; +# endif +# ifdef AO_HAVE_short_and_release + (void)"AO_short_and_release(&val, incr):"; + AO_short_and_release(&val, incr); +# else + (void)"No AO_short_and_release"; +# endif +# ifdef AO_HAVE_short_or_release + (void)"AO_short_or_release(&val, incr):"; + AO_short_or_release(&val, incr); +# else + (void)"No AO_short_or_release"; +# endif +# ifdef AO_HAVE_short_xor_release + (void)"AO_short_xor_release(&val, incr):"; + AO_short_xor_release(&val, incr); +# else + (void)"No AO_short_xor_release"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_release + (void)"AO_short_compare_and_swap_release(&val, oldval, newval):"; + AO_short_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_release"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release */ + /* TODO: Add AO_compare_and_swap_double_release */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_release + (void)"AO_short_fetch_compare_and_swap_release(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_release"; +# endif + +# if defined(AO_HAVE_test_and_set_release) + (void)"AO_test_and_set_release(&ts):"; + AO_test_and_set_release(&ts); +# else + (void)"No AO_test_and_set_release"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_acquire(void) +{ +# if defined(AO_HAVE_short_load_acquire) || defined(AO_HAVE_short_store_acquire) \ + || defined(AO_HAVE_short_fetch_and_add_acquire) \ + || defined(AO_HAVE_short_fetch_and_add1_acquire) \ + || defined(AO_HAVE_short_and_acquire) \ + || defined(AO_HAVE_short_compare_and_swap_acquire) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_acquire) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_acquire) \ + || defined(AO_HAVE_short_compare_and_swap_acquire) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_acquire) || defined(AO_HAVE_short_and_acquire) \ + || defined(AO_HAVE_short_or_acquire) || defined(AO_HAVE_short_xor_acquire) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire) + (void)"AO_nop_acquire(): "; + AO_nop_acquire(); +# else + (void)"No AO_nop_acquire"; +# endif + +# ifdef AO_HAVE_short_load_acquire + (void)"AO_short_load_acquire(&val):"; + AO_short_load_acquire(&val); +# else + (void)"No AO_short_load_acquire"; +# endif +# ifdef AO_HAVE_short_store_acquire + (void)"AO_short_store_acquire(&val, newval):"; + AO_short_store_acquire(&val, newval); +# else + (void)"No AO_short_store_acquire"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_acquire + (void)"AO_short_fetch_and_add_acquire(&val, incr):"; + AO_short_fetch_and_add_acquire(&val, incr); +# else + (void)"No AO_short_fetch_and_add_acquire"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_acquire + (void)"AO_short_fetch_and_add1_acquire(&val):"; + AO_short_fetch_and_add1_acquire(&val); +# else + (void)"No AO_short_fetch_and_add1_acquire"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_acquire + (void)"AO_short_fetch_and_sub1_acquire(&val):"; + AO_short_fetch_and_sub1_acquire(&val); +# else + (void)"No AO_short_fetch_and_sub1_acquire"; +# endif +# ifdef AO_HAVE_short_and_acquire + (void)"AO_short_and_acquire(&val, incr):"; + AO_short_and_acquire(&val, incr); +# else + (void)"No AO_short_and_acquire"; +# endif +# ifdef AO_HAVE_short_or_acquire + (void)"AO_short_or_acquire(&val, incr):"; + AO_short_or_acquire(&val, incr); +# else + (void)"No AO_short_or_acquire"; +# endif +# ifdef AO_HAVE_short_xor_acquire + (void)"AO_short_xor_acquire(&val, incr):"; + AO_short_xor_acquire(&val, incr); +# else + (void)"No AO_short_xor_acquire"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_acquire + (void)"AO_short_compare_and_swap_acquire(&val, oldval, newval):"; + AO_short_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_acquire"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire */ + /* TODO: Add AO_compare_and_swap_double_acquire */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_acquire + (void)"AO_short_fetch_compare_and_swap_acquire(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_acquire"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire) + (void)"AO_test_and_set_acquire(&ts):"; + AO_test_and_set_acquire(&ts); +# else + (void)"No AO_test_and_set_acquire"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_read(void) +{ +# if defined(AO_HAVE_short_load_read) || defined(AO_HAVE_short_store_read) \ + || defined(AO_HAVE_short_fetch_and_add_read) \ + || defined(AO_HAVE_short_fetch_and_add1_read) \ + || defined(AO_HAVE_short_and_read) \ + || defined(AO_HAVE_short_compare_and_swap_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_read) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_read) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_read) \ + || defined(AO_HAVE_short_compare_and_swap_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_read) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_read) || defined(AO_HAVE_short_and_read) \ + || defined(AO_HAVE_short_or_read) || defined(AO_HAVE_short_xor_read) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_read) + (void)"AO_nop_read(): "; + AO_nop_read(); +# else + (void)"No AO_nop_read"; +# endif + +# ifdef AO_HAVE_short_load_read + (void)"AO_short_load_read(&val):"; + AO_short_load_read(&val); +# else + (void)"No AO_short_load_read"; +# endif +# ifdef AO_HAVE_short_store_read + (void)"AO_short_store_read(&val, newval):"; + AO_short_store_read(&val, newval); +# else + (void)"No AO_short_store_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_read + (void)"AO_short_fetch_and_add_read(&val, incr):"; + AO_short_fetch_and_add_read(&val, incr); +# else + (void)"No AO_short_fetch_and_add_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_read + (void)"AO_short_fetch_and_add1_read(&val):"; + AO_short_fetch_and_add1_read(&val); +# else + (void)"No AO_short_fetch_and_add1_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_read + (void)"AO_short_fetch_and_sub1_read(&val):"; + AO_short_fetch_and_sub1_read(&val); +# else + (void)"No AO_short_fetch_and_sub1_read"; +# endif +# ifdef AO_HAVE_short_and_read + (void)"AO_short_and_read(&val, incr):"; + AO_short_and_read(&val, incr); +# else + (void)"No AO_short_and_read"; +# endif +# ifdef AO_HAVE_short_or_read + (void)"AO_short_or_read(&val, incr):"; + AO_short_or_read(&val, incr); +# else + (void)"No AO_short_or_read"; +# endif +# ifdef AO_HAVE_short_xor_read + (void)"AO_short_xor_read(&val, incr):"; + AO_short_xor_read(&val, incr); +# else + (void)"No AO_short_xor_read"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_read + (void)"AO_short_compare_and_swap_read(&val, oldval, newval):"; + AO_short_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_read */ + /* TODO: Add AO_compare_and_swap_double_read */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_read + (void)"AO_short_fetch_compare_and_swap_read(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_read"; +# endif + +# if defined(AO_HAVE_test_and_set_read) + (void)"AO_test_and_set_read(&ts):"; + AO_test_and_set_read(&ts); +# else + (void)"No AO_test_and_set_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_write(void) +{ +# if defined(AO_HAVE_short_load_write) || defined(AO_HAVE_short_store_write) \ + || defined(AO_HAVE_short_fetch_and_add_write) \ + || defined(AO_HAVE_short_fetch_and_add1_write) \ + || defined(AO_HAVE_short_and_write) \ + || defined(AO_HAVE_short_compare_and_swap_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_write) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_write) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_write) \ + || defined(AO_HAVE_short_compare_and_swap_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_write) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_write) || defined(AO_HAVE_short_and_write) \ + || defined(AO_HAVE_short_or_write) || defined(AO_HAVE_short_xor_write) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_write) + (void)"AO_nop_write(): "; + AO_nop_write(); +# else + (void)"No AO_nop_write"; +# endif + +# ifdef AO_HAVE_short_load_write + (void)"AO_short_load_write(&val):"; + AO_short_load_write(&val); +# else + (void)"No AO_short_load_write"; +# endif +# ifdef AO_HAVE_short_store_write + (void)"AO_short_store_write(&val, newval):"; + AO_short_store_write(&val, newval); +# else + (void)"No AO_short_store_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_write + (void)"AO_short_fetch_and_add_write(&val, incr):"; + AO_short_fetch_and_add_write(&val, incr); +# else + (void)"No AO_short_fetch_and_add_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_write + (void)"AO_short_fetch_and_add1_write(&val):"; + AO_short_fetch_and_add1_write(&val); +# else + (void)"No AO_short_fetch_and_add1_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_write + (void)"AO_short_fetch_and_sub1_write(&val):"; + AO_short_fetch_and_sub1_write(&val); +# else + (void)"No AO_short_fetch_and_sub1_write"; +# endif +# ifdef AO_HAVE_short_and_write + (void)"AO_short_and_write(&val, incr):"; + AO_short_and_write(&val, incr); +# else + (void)"No AO_short_and_write"; +# endif +# ifdef AO_HAVE_short_or_write + (void)"AO_short_or_write(&val, incr):"; + AO_short_or_write(&val, incr); +# else + (void)"No AO_short_or_write"; +# endif +# ifdef AO_HAVE_short_xor_write + (void)"AO_short_xor_write(&val, incr):"; + AO_short_xor_write(&val, incr); +# else + (void)"No AO_short_xor_write"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_write + (void)"AO_short_compare_and_swap_write(&val, oldval, newval):"; + AO_short_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_write */ + /* TODO: Add AO_compare_and_swap_double_write */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_write + (void)"AO_short_fetch_compare_and_swap_write(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_write"; +# endif + +# if defined(AO_HAVE_test_and_set_write) + (void)"AO_test_and_set_write(&ts):"; + AO_test_and_set_write(&ts); +# else + (void)"No AO_test_and_set_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_full(void) +{ +# if defined(AO_HAVE_short_load_full) || defined(AO_HAVE_short_store_full) \ + || defined(AO_HAVE_short_fetch_and_add_full) \ + || defined(AO_HAVE_short_fetch_and_add1_full) \ + || defined(AO_HAVE_short_and_full) \ + || defined(AO_HAVE_short_compare_and_swap_full) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_full) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_full) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_full) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_full) \ + || defined(AO_HAVE_short_compare_and_swap_full) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_full) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_full) || defined(AO_HAVE_short_and_full) \ + || defined(AO_HAVE_short_or_full) || defined(AO_HAVE_short_xor_full) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_full) + (void)"AO_nop_full(): "; + AO_nop_full(); +# else + (void)"No AO_nop_full"; +# endif + +# ifdef AO_HAVE_short_load_full + (void)"AO_short_load_full(&val):"; + AO_short_load_full(&val); +# else + (void)"No AO_short_load_full"; +# endif +# ifdef AO_HAVE_short_store_full + (void)"AO_short_store_full(&val, newval):"; + AO_short_store_full(&val, newval); +# else + (void)"No AO_short_store_full"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_full + (void)"AO_short_fetch_and_add_full(&val, incr):"; + AO_short_fetch_and_add_full(&val, incr); +# else + (void)"No AO_short_fetch_and_add_full"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_full + (void)"AO_short_fetch_and_add1_full(&val):"; + AO_short_fetch_and_add1_full(&val); +# else + (void)"No AO_short_fetch_and_add1_full"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_full + (void)"AO_short_fetch_and_sub1_full(&val):"; + AO_short_fetch_and_sub1_full(&val); +# else + (void)"No AO_short_fetch_and_sub1_full"; +# endif +# ifdef AO_HAVE_short_and_full + (void)"AO_short_and_full(&val, incr):"; + AO_short_and_full(&val, incr); +# else + (void)"No AO_short_and_full"; +# endif +# ifdef AO_HAVE_short_or_full + (void)"AO_short_or_full(&val, incr):"; + AO_short_or_full(&val, incr); +# else + (void)"No AO_short_or_full"; +# endif +# ifdef AO_HAVE_short_xor_full + (void)"AO_short_xor_full(&val, incr):"; + AO_short_xor_full(&val, incr); +# else + (void)"No AO_short_xor_full"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_full + (void)"AO_short_compare_and_swap_full(&val, oldval, newval):"; + AO_short_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_full"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_full */ + /* TODO: Add AO_compare_and_swap_double_full */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_full + (void)"AO_short_fetch_compare_and_swap_full(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_full"; +# endif + +# if defined(AO_HAVE_test_and_set_full) + (void)"AO_test_and_set_full(&ts):"; + AO_test_and_set_full(&ts); +# else + (void)"No AO_test_and_set_full"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_release_write(void) +{ +# if defined(AO_HAVE_short_load_release_write) || defined(AO_HAVE_short_store_release_write) \ + || defined(AO_HAVE_short_fetch_and_add_release_write) \ + || defined(AO_HAVE_short_fetch_and_add1_release_write) \ + || defined(AO_HAVE_short_and_release_write) \ + || defined(AO_HAVE_short_compare_and_swap_release_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release_write) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_release_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release_write) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_release_write) \ + || defined(AO_HAVE_short_compare_and_swap_release_write) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_release_write) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_release_write) || defined(AO_HAVE_short_and_release_write) \ + || defined(AO_HAVE_short_or_release_write) || defined(AO_HAVE_short_xor_release_write) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release_write) + (void)"AO_nop_release_write(): "; + AO_nop_release_write(); +# else + (void)"No AO_nop_release_write"; +# endif + +# ifdef AO_HAVE_short_load_release_write + (void)"AO_short_load_release_write(&val):"; + AO_short_load_release_write(&val); +# else + (void)"No AO_short_load_release_write"; +# endif +# ifdef AO_HAVE_short_store_release_write + (void)"AO_short_store_release_write(&val, newval):"; + AO_short_store_release_write(&val, newval); +# else + (void)"No AO_short_store_release_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_release_write + (void)"AO_short_fetch_and_add_release_write(&val, incr):"; + AO_short_fetch_and_add_release_write(&val, incr); +# else + (void)"No AO_short_fetch_and_add_release_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_release_write + (void)"AO_short_fetch_and_add1_release_write(&val):"; + AO_short_fetch_and_add1_release_write(&val); +# else + (void)"No AO_short_fetch_and_add1_release_write"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_release_write + (void)"AO_short_fetch_and_sub1_release_write(&val):"; + AO_short_fetch_and_sub1_release_write(&val); +# else + (void)"No AO_short_fetch_and_sub1_release_write"; +# endif +# ifdef AO_HAVE_short_and_release_write + (void)"AO_short_and_release_write(&val, incr):"; + AO_short_and_release_write(&val, incr); +# else + (void)"No AO_short_and_release_write"; +# endif +# ifdef AO_HAVE_short_or_release_write + (void)"AO_short_or_release_write(&val, incr):"; + AO_short_or_release_write(&val, incr); +# else + (void)"No AO_short_or_release_write"; +# endif +# ifdef AO_HAVE_short_xor_release_write + (void)"AO_short_xor_release_write(&val, incr):"; + AO_short_xor_release_write(&val, incr); +# else + (void)"No AO_short_xor_release_write"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_release_write + (void)"AO_short_compare_and_swap_release_write(&val, oldval, newval):"; + AO_short_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_release_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release_write */ + /* TODO: Add AO_compare_and_swap_double_release_write */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_release_write + (void)"AO_short_fetch_compare_and_swap_release_write(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_release_write"; +# endif + +# if defined(AO_HAVE_test_and_set_release_write) + (void)"AO_test_and_set_release_write(&ts):"; + AO_test_and_set_release_write(&ts); +# else + (void)"No AO_test_and_set_release_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_acquire_read(void) +{ +# if defined(AO_HAVE_short_load_acquire_read) || defined(AO_HAVE_short_store_acquire_read) \ + || defined(AO_HAVE_short_fetch_and_add_acquire_read) \ + || defined(AO_HAVE_short_fetch_and_add1_acquire_read) \ + || defined(AO_HAVE_short_and_acquire_read) \ + || defined(AO_HAVE_short_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire_read) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire_read) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_acquire_read) \ + || defined(AO_HAVE_short_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_acquire_read) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_acquire_read) || defined(AO_HAVE_short_and_acquire_read) \ + || defined(AO_HAVE_short_or_acquire_read) || defined(AO_HAVE_short_xor_acquire_read) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + (void)"AO_nop_acquire_read(): "; + AO_nop_acquire_read(); +# else + (void)"No AO_nop_acquire_read"; +# endif + +# ifdef AO_HAVE_short_load_acquire_read + (void)"AO_short_load_acquire_read(&val):"; + AO_short_load_acquire_read(&val); +# else + (void)"No AO_short_load_acquire_read"; +# endif +# ifdef AO_HAVE_short_store_acquire_read + (void)"AO_short_store_acquire_read(&val, newval):"; + AO_short_store_acquire_read(&val, newval); +# else + (void)"No AO_short_store_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_acquire_read + (void)"AO_short_fetch_and_add_acquire_read(&val, incr):"; + AO_short_fetch_and_add_acquire_read(&val, incr); +# else + (void)"No AO_short_fetch_and_add_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_acquire_read + (void)"AO_short_fetch_and_add1_acquire_read(&val):"; + AO_short_fetch_and_add1_acquire_read(&val); +# else + (void)"No AO_short_fetch_and_add1_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_acquire_read + (void)"AO_short_fetch_and_sub1_acquire_read(&val):"; + AO_short_fetch_and_sub1_acquire_read(&val); +# else + (void)"No AO_short_fetch_and_sub1_acquire_read"; +# endif +# ifdef AO_HAVE_short_and_acquire_read + (void)"AO_short_and_acquire_read(&val, incr):"; + AO_short_and_acquire_read(&val, incr); +# else + (void)"No AO_short_and_acquire_read"; +# endif +# ifdef AO_HAVE_short_or_acquire_read + (void)"AO_short_or_acquire_read(&val, incr):"; + AO_short_or_acquire_read(&val, incr); +# else + (void)"No AO_short_or_acquire_read"; +# endif +# ifdef AO_HAVE_short_xor_acquire_read + (void)"AO_short_xor_acquire_read(&val, incr):"; + AO_short_xor_acquire_read(&val, incr); +# else + (void)"No AO_short_xor_acquire_read"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_acquire_read + (void)"AO_short_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_short_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_acquire_read */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_acquire_read + (void)"AO_short_fetch_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire_read) + (void)"AO_test_and_set_acquire_read(&ts):"; + AO_test_and_set_acquire_read(&ts); +# else + (void)"No AO_test_and_set_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void short_list_atomic_dd_acquire_read(void) +{ +# if defined(AO_HAVE_short_load_dd_acquire_read) || defined(AO_HAVE_short_store_dd_acquire_read) \ + || defined(AO_HAVE_short_fetch_and_add_dd_acquire_read) \ + || defined(AO_HAVE_short_fetch_and_add1_dd_acquire_read) \ + || defined(AO_HAVE_short_and_dd_acquire_read) \ + || defined(AO_HAVE_short_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_dd_acquire_read) + static volatile unsigned/**/short val /* = 0 */; +# endif +# if defined(AO_HAVE_short_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_dd_acquire_read) + static unsigned/**/short oldval /* = 0 */; +# endif +# if defined(AO_HAVE_short_store_dd_acquire_read) \ + || defined(AO_HAVE_short_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_short_fetch_compare_and_swap_dd_acquire_read) + static unsigned/**/short newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_short_fetch_and_add_dd_acquire_read) || defined(AO_HAVE_short_and_dd_acquire_read) \ + || defined(AO_HAVE_short_or_dd_acquire_read) || defined(AO_HAVE_short_xor_dd_acquire_read) + static unsigned/**/short incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_dd_acquire_read) + (void)"AO_nop_dd_acquire_read(): "; + AO_nop_dd_acquire_read(); +# else + (void)"No AO_nop_dd_acquire_read"; +# endif + +# ifdef AO_HAVE_short_load_dd_acquire_read + (void)"AO_short_load_dd_acquire_read(&val):"; + AO_short_load_dd_acquire_read(&val); +# else + (void)"No AO_short_load_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_store_dd_acquire_read + (void)"AO_short_store_dd_acquire_read(&val, newval):"; + AO_short_store_dd_acquire_read(&val, newval); +# else + (void)"No AO_short_store_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add_dd_acquire_read + (void)"AO_short_fetch_and_add_dd_acquire_read(&val, incr):"; + AO_short_fetch_and_add_dd_acquire_read(&val, incr); +# else + (void)"No AO_short_fetch_and_add_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_add1_dd_acquire_read + (void)"AO_short_fetch_and_add1_dd_acquire_read(&val):"; + AO_short_fetch_and_add1_dd_acquire_read(&val); +# else + (void)"No AO_short_fetch_and_add1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_fetch_and_sub1_dd_acquire_read + (void)"AO_short_fetch_and_sub1_dd_acquire_read(&val):"; + AO_short_fetch_and_sub1_dd_acquire_read(&val); +# else + (void)"No AO_short_fetch_and_sub1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_and_dd_acquire_read + (void)"AO_short_and_dd_acquire_read(&val, incr):"; + AO_short_and_dd_acquire_read(&val, incr); +# else + (void)"No AO_short_and_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_or_dd_acquire_read + (void)"AO_short_or_dd_acquire_read(&val, incr):"; + AO_short_or_dd_acquire_read(&val, incr); +# else + (void)"No AO_short_or_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_xor_dd_acquire_read + (void)"AO_short_xor_dd_acquire_read(&val, incr):"; + AO_short_xor_dd_acquire_read(&val, incr); +# else + (void)"No AO_short_xor_dd_acquire_read"; +# endif +# ifdef AO_HAVE_short_compare_and_swap_dd_acquire_read + (void)"AO_short_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_short_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_short_compare_and_swap_dd_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_dd_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_dd_acquire_read */ +# ifdef AO_HAVE_short_fetch_compare_and_swap_dd_acquire_read + (void)"AO_short_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_short_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_short_fetch_compare_and_swap_dd_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + (void)"AO_test_and_set_dd_acquire_read(&ts):"; + AO_test_and_set_dd_acquire_read(&ts); +# else + (void)"No AO_test_and_set_dd_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic(void) +{ +# if defined(AO_HAVE_int_load) || defined(AO_HAVE_int_store) \ + || defined(AO_HAVE_int_fetch_and_add) \ + || defined(AO_HAVE_int_fetch_and_add1) \ + || defined(AO_HAVE_int_and) \ + || defined(AO_HAVE_int_compare_and_swap) \ + || defined(AO_HAVE_int_fetch_compare_and_swap) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap) \ + || defined(AO_HAVE_int_fetch_compare_and_swap) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store) \ + || defined(AO_HAVE_int_compare_and_swap) \ + || defined(AO_HAVE_int_fetch_compare_and_swap) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add) || defined(AO_HAVE_int_and) \ + || defined(AO_HAVE_int_or) || defined(AO_HAVE_int_xor) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop) + (void)"AO_nop(): "; + AO_nop(); +# else + (void)"No AO_nop"; +# endif + +# ifdef AO_HAVE_int_load + (void)"AO_int_load(&val):"; + AO_int_load(&val); +# else + (void)"No AO_int_load"; +# endif +# ifdef AO_HAVE_int_store + (void)"AO_int_store(&val, newval):"; + AO_int_store(&val, newval); +# else + (void)"No AO_int_store"; +# endif +# ifdef AO_HAVE_int_fetch_and_add + (void)"AO_int_fetch_and_add(&val, incr):"; + AO_int_fetch_and_add(&val, incr); +# else + (void)"No AO_int_fetch_and_add"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1 + (void)"AO_int_fetch_and_add1(&val):"; + AO_int_fetch_and_add1(&val); +# else + (void)"No AO_int_fetch_and_add1"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1 + (void)"AO_int_fetch_and_sub1(&val):"; + AO_int_fetch_and_sub1(&val); +# else + (void)"No AO_int_fetch_and_sub1"; +# endif +# ifdef AO_HAVE_int_and + (void)"AO_int_and(&val, incr):"; + AO_int_and(&val, incr); +# else + (void)"No AO_int_and"; +# endif +# ifdef AO_HAVE_int_or + (void)"AO_int_or(&val, incr):"; + AO_int_or(&val, incr); +# else + (void)"No AO_int_or"; +# endif +# ifdef AO_HAVE_int_xor + (void)"AO_int_xor(&val, incr):"; + AO_int_xor(&val, incr); +# else + (void)"No AO_int_xor"; +# endif +# ifdef AO_HAVE_int_compare_and_swap + (void)"AO_int_compare_and_swap(&val, oldval, newval):"; + AO_int_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap"; +# endif + /* TODO: Add AO_compare_double_and_swap_double */ + /* TODO: Add AO_compare_and_swap_double */ +# ifdef AO_HAVE_int_fetch_compare_and_swap + (void)"AO_int_fetch_compare_and_swap(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap"; +# endif + +# if defined(AO_HAVE_test_and_set) + (void)"AO_test_and_set(&ts):"; + AO_test_and_set(&ts); +# else + (void)"No AO_test_and_set"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_release(void) +{ +# if defined(AO_HAVE_int_load_release) || defined(AO_HAVE_int_store_release) \ + || defined(AO_HAVE_int_fetch_and_add_release) \ + || defined(AO_HAVE_int_fetch_and_add1_release) \ + || defined(AO_HAVE_int_and_release) \ + || defined(AO_HAVE_int_compare_and_swap_release) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_release) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_release) \ + || defined(AO_HAVE_int_compare_and_swap_release) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_release) || defined(AO_HAVE_int_and_release) \ + || defined(AO_HAVE_int_or_release) || defined(AO_HAVE_int_xor_release) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release) + (void)"AO_nop_release(): "; + AO_nop_release(); +# else + (void)"No AO_nop_release"; +# endif + +# ifdef AO_HAVE_int_load_release + (void)"AO_int_load_release(&val):"; + AO_int_load_release(&val); +# else + (void)"No AO_int_load_release"; +# endif +# ifdef AO_HAVE_int_store_release + (void)"AO_int_store_release(&val, newval):"; + AO_int_store_release(&val, newval); +# else + (void)"No AO_int_store_release"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_release + (void)"AO_int_fetch_and_add_release(&val, incr):"; + AO_int_fetch_and_add_release(&val, incr); +# else + (void)"No AO_int_fetch_and_add_release"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_release + (void)"AO_int_fetch_and_add1_release(&val):"; + AO_int_fetch_and_add1_release(&val); +# else + (void)"No AO_int_fetch_and_add1_release"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_release + (void)"AO_int_fetch_and_sub1_release(&val):"; + AO_int_fetch_and_sub1_release(&val); +# else + (void)"No AO_int_fetch_and_sub1_release"; +# endif +# ifdef AO_HAVE_int_and_release + (void)"AO_int_and_release(&val, incr):"; + AO_int_and_release(&val, incr); +# else + (void)"No AO_int_and_release"; +# endif +# ifdef AO_HAVE_int_or_release + (void)"AO_int_or_release(&val, incr):"; + AO_int_or_release(&val, incr); +# else + (void)"No AO_int_or_release"; +# endif +# ifdef AO_HAVE_int_xor_release + (void)"AO_int_xor_release(&val, incr):"; + AO_int_xor_release(&val, incr); +# else + (void)"No AO_int_xor_release"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_release + (void)"AO_int_compare_and_swap_release(&val, oldval, newval):"; + AO_int_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_release"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release */ + /* TODO: Add AO_compare_and_swap_double_release */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_release + (void)"AO_int_fetch_compare_and_swap_release(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_release"; +# endif + +# if defined(AO_HAVE_test_and_set_release) + (void)"AO_test_and_set_release(&ts):"; + AO_test_and_set_release(&ts); +# else + (void)"No AO_test_and_set_release"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_acquire(void) +{ +# if defined(AO_HAVE_int_load_acquire) || defined(AO_HAVE_int_store_acquire) \ + || defined(AO_HAVE_int_fetch_and_add_acquire) \ + || defined(AO_HAVE_int_fetch_and_add1_acquire) \ + || defined(AO_HAVE_int_and_acquire) \ + || defined(AO_HAVE_int_compare_and_swap_acquire) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_acquire) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_acquire) \ + || defined(AO_HAVE_int_compare_and_swap_acquire) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_acquire) || defined(AO_HAVE_int_and_acquire) \ + || defined(AO_HAVE_int_or_acquire) || defined(AO_HAVE_int_xor_acquire) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire) + (void)"AO_nop_acquire(): "; + AO_nop_acquire(); +# else + (void)"No AO_nop_acquire"; +# endif + +# ifdef AO_HAVE_int_load_acquire + (void)"AO_int_load_acquire(&val):"; + AO_int_load_acquire(&val); +# else + (void)"No AO_int_load_acquire"; +# endif +# ifdef AO_HAVE_int_store_acquire + (void)"AO_int_store_acquire(&val, newval):"; + AO_int_store_acquire(&val, newval); +# else + (void)"No AO_int_store_acquire"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_acquire + (void)"AO_int_fetch_and_add_acquire(&val, incr):"; + AO_int_fetch_and_add_acquire(&val, incr); +# else + (void)"No AO_int_fetch_and_add_acquire"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_acquire + (void)"AO_int_fetch_and_add1_acquire(&val):"; + AO_int_fetch_and_add1_acquire(&val); +# else + (void)"No AO_int_fetch_and_add1_acquire"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_acquire + (void)"AO_int_fetch_and_sub1_acquire(&val):"; + AO_int_fetch_and_sub1_acquire(&val); +# else + (void)"No AO_int_fetch_and_sub1_acquire"; +# endif +# ifdef AO_HAVE_int_and_acquire + (void)"AO_int_and_acquire(&val, incr):"; + AO_int_and_acquire(&val, incr); +# else + (void)"No AO_int_and_acquire"; +# endif +# ifdef AO_HAVE_int_or_acquire + (void)"AO_int_or_acquire(&val, incr):"; + AO_int_or_acquire(&val, incr); +# else + (void)"No AO_int_or_acquire"; +# endif +# ifdef AO_HAVE_int_xor_acquire + (void)"AO_int_xor_acquire(&val, incr):"; + AO_int_xor_acquire(&val, incr); +# else + (void)"No AO_int_xor_acquire"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_acquire + (void)"AO_int_compare_and_swap_acquire(&val, oldval, newval):"; + AO_int_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_acquire"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire */ + /* TODO: Add AO_compare_and_swap_double_acquire */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_acquire + (void)"AO_int_fetch_compare_and_swap_acquire(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_acquire"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire) + (void)"AO_test_and_set_acquire(&ts):"; + AO_test_and_set_acquire(&ts); +# else + (void)"No AO_test_and_set_acquire"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_read(void) +{ +# if defined(AO_HAVE_int_load_read) || defined(AO_HAVE_int_store_read) \ + || defined(AO_HAVE_int_fetch_and_add_read) \ + || defined(AO_HAVE_int_fetch_and_add1_read) \ + || defined(AO_HAVE_int_and_read) \ + || defined(AO_HAVE_int_compare_and_swap_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_read) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_read) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_read) \ + || defined(AO_HAVE_int_compare_and_swap_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_read) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_read) || defined(AO_HAVE_int_and_read) \ + || defined(AO_HAVE_int_or_read) || defined(AO_HAVE_int_xor_read) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_read) + (void)"AO_nop_read(): "; + AO_nop_read(); +# else + (void)"No AO_nop_read"; +# endif + +# ifdef AO_HAVE_int_load_read + (void)"AO_int_load_read(&val):"; + AO_int_load_read(&val); +# else + (void)"No AO_int_load_read"; +# endif +# ifdef AO_HAVE_int_store_read + (void)"AO_int_store_read(&val, newval):"; + AO_int_store_read(&val, newval); +# else + (void)"No AO_int_store_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_read + (void)"AO_int_fetch_and_add_read(&val, incr):"; + AO_int_fetch_and_add_read(&val, incr); +# else + (void)"No AO_int_fetch_and_add_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_read + (void)"AO_int_fetch_and_add1_read(&val):"; + AO_int_fetch_and_add1_read(&val); +# else + (void)"No AO_int_fetch_and_add1_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_read + (void)"AO_int_fetch_and_sub1_read(&val):"; + AO_int_fetch_and_sub1_read(&val); +# else + (void)"No AO_int_fetch_and_sub1_read"; +# endif +# ifdef AO_HAVE_int_and_read + (void)"AO_int_and_read(&val, incr):"; + AO_int_and_read(&val, incr); +# else + (void)"No AO_int_and_read"; +# endif +# ifdef AO_HAVE_int_or_read + (void)"AO_int_or_read(&val, incr):"; + AO_int_or_read(&val, incr); +# else + (void)"No AO_int_or_read"; +# endif +# ifdef AO_HAVE_int_xor_read + (void)"AO_int_xor_read(&val, incr):"; + AO_int_xor_read(&val, incr); +# else + (void)"No AO_int_xor_read"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_read + (void)"AO_int_compare_and_swap_read(&val, oldval, newval):"; + AO_int_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_read */ + /* TODO: Add AO_compare_and_swap_double_read */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_read + (void)"AO_int_fetch_compare_and_swap_read(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_read"; +# endif + +# if defined(AO_HAVE_test_and_set_read) + (void)"AO_test_and_set_read(&ts):"; + AO_test_and_set_read(&ts); +# else + (void)"No AO_test_and_set_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_write(void) +{ +# if defined(AO_HAVE_int_load_write) || defined(AO_HAVE_int_store_write) \ + || defined(AO_HAVE_int_fetch_and_add_write) \ + || defined(AO_HAVE_int_fetch_and_add1_write) \ + || defined(AO_HAVE_int_and_write) \ + || defined(AO_HAVE_int_compare_and_swap_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_write) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_write) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_write) \ + || defined(AO_HAVE_int_compare_and_swap_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_write) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_write) || defined(AO_HAVE_int_and_write) \ + || defined(AO_HAVE_int_or_write) || defined(AO_HAVE_int_xor_write) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_write) + (void)"AO_nop_write(): "; + AO_nop_write(); +# else + (void)"No AO_nop_write"; +# endif + +# ifdef AO_HAVE_int_load_write + (void)"AO_int_load_write(&val):"; + AO_int_load_write(&val); +# else + (void)"No AO_int_load_write"; +# endif +# ifdef AO_HAVE_int_store_write + (void)"AO_int_store_write(&val, newval):"; + AO_int_store_write(&val, newval); +# else + (void)"No AO_int_store_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_write + (void)"AO_int_fetch_and_add_write(&val, incr):"; + AO_int_fetch_and_add_write(&val, incr); +# else + (void)"No AO_int_fetch_and_add_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_write + (void)"AO_int_fetch_and_add1_write(&val):"; + AO_int_fetch_and_add1_write(&val); +# else + (void)"No AO_int_fetch_and_add1_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_write + (void)"AO_int_fetch_and_sub1_write(&val):"; + AO_int_fetch_and_sub1_write(&val); +# else + (void)"No AO_int_fetch_and_sub1_write"; +# endif +# ifdef AO_HAVE_int_and_write + (void)"AO_int_and_write(&val, incr):"; + AO_int_and_write(&val, incr); +# else + (void)"No AO_int_and_write"; +# endif +# ifdef AO_HAVE_int_or_write + (void)"AO_int_or_write(&val, incr):"; + AO_int_or_write(&val, incr); +# else + (void)"No AO_int_or_write"; +# endif +# ifdef AO_HAVE_int_xor_write + (void)"AO_int_xor_write(&val, incr):"; + AO_int_xor_write(&val, incr); +# else + (void)"No AO_int_xor_write"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_write + (void)"AO_int_compare_and_swap_write(&val, oldval, newval):"; + AO_int_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_write */ + /* TODO: Add AO_compare_and_swap_double_write */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_write + (void)"AO_int_fetch_compare_and_swap_write(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_write"; +# endif + +# if defined(AO_HAVE_test_and_set_write) + (void)"AO_test_and_set_write(&ts):"; + AO_test_and_set_write(&ts); +# else + (void)"No AO_test_and_set_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_full(void) +{ +# if defined(AO_HAVE_int_load_full) || defined(AO_HAVE_int_store_full) \ + || defined(AO_HAVE_int_fetch_and_add_full) \ + || defined(AO_HAVE_int_fetch_and_add1_full) \ + || defined(AO_HAVE_int_and_full) \ + || defined(AO_HAVE_int_compare_and_swap_full) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_full) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_full) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_full) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_full) \ + || defined(AO_HAVE_int_compare_and_swap_full) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_full) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_full) || defined(AO_HAVE_int_and_full) \ + || defined(AO_HAVE_int_or_full) || defined(AO_HAVE_int_xor_full) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_full) + (void)"AO_nop_full(): "; + AO_nop_full(); +# else + (void)"No AO_nop_full"; +# endif + +# ifdef AO_HAVE_int_load_full + (void)"AO_int_load_full(&val):"; + AO_int_load_full(&val); +# else + (void)"No AO_int_load_full"; +# endif +# ifdef AO_HAVE_int_store_full + (void)"AO_int_store_full(&val, newval):"; + AO_int_store_full(&val, newval); +# else + (void)"No AO_int_store_full"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_full + (void)"AO_int_fetch_and_add_full(&val, incr):"; + AO_int_fetch_and_add_full(&val, incr); +# else + (void)"No AO_int_fetch_and_add_full"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_full + (void)"AO_int_fetch_and_add1_full(&val):"; + AO_int_fetch_and_add1_full(&val); +# else + (void)"No AO_int_fetch_and_add1_full"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_full + (void)"AO_int_fetch_and_sub1_full(&val):"; + AO_int_fetch_and_sub1_full(&val); +# else + (void)"No AO_int_fetch_and_sub1_full"; +# endif +# ifdef AO_HAVE_int_and_full + (void)"AO_int_and_full(&val, incr):"; + AO_int_and_full(&val, incr); +# else + (void)"No AO_int_and_full"; +# endif +# ifdef AO_HAVE_int_or_full + (void)"AO_int_or_full(&val, incr):"; + AO_int_or_full(&val, incr); +# else + (void)"No AO_int_or_full"; +# endif +# ifdef AO_HAVE_int_xor_full + (void)"AO_int_xor_full(&val, incr):"; + AO_int_xor_full(&val, incr); +# else + (void)"No AO_int_xor_full"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_full + (void)"AO_int_compare_and_swap_full(&val, oldval, newval):"; + AO_int_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_full"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_full */ + /* TODO: Add AO_compare_and_swap_double_full */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_full + (void)"AO_int_fetch_compare_and_swap_full(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_full"; +# endif + +# if defined(AO_HAVE_test_and_set_full) + (void)"AO_test_and_set_full(&ts):"; + AO_test_and_set_full(&ts); +# else + (void)"No AO_test_and_set_full"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_release_write(void) +{ +# if defined(AO_HAVE_int_load_release_write) || defined(AO_HAVE_int_store_release_write) \ + || defined(AO_HAVE_int_fetch_and_add_release_write) \ + || defined(AO_HAVE_int_fetch_and_add1_release_write) \ + || defined(AO_HAVE_int_and_release_write) \ + || defined(AO_HAVE_int_compare_and_swap_release_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release_write) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_release_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release_write) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_release_write) \ + || defined(AO_HAVE_int_compare_and_swap_release_write) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_release_write) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_release_write) || defined(AO_HAVE_int_and_release_write) \ + || defined(AO_HAVE_int_or_release_write) || defined(AO_HAVE_int_xor_release_write) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release_write) + (void)"AO_nop_release_write(): "; + AO_nop_release_write(); +# else + (void)"No AO_nop_release_write"; +# endif + +# ifdef AO_HAVE_int_load_release_write + (void)"AO_int_load_release_write(&val):"; + AO_int_load_release_write(&val); +# else + (void)"No AO_int_load_release_write"; +# endif +# ifdef AO_HAVE_int_store_release_write + (void)"AO_int_store_release_write(&val, newval):"; + AO_int_store_release_write(&val, newval); +# else + (void)"No AO_int_store_release_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_release_write + (void)"AO_int_fetch_and_add_release_write(&val, incr):"; + AO_int_fetch_and_add_release_write(&val, incr); +# else + (void)"No AO_int_fetch_and_add_release_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_release_write + (void)"AO_int_fetch_and_add1_release_write(&val):"; + AO_int_fetch_and_add1_release_write(&val); +# else + (void)"No AO_int_fetch_and_add1_release_write"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_release_write + (void)"AO_int_fetch_and_sub1_release_write(&val):"; + AO_int_fetch_and_sub1_release_write(&val); +# else + (void)"No AO_int_fetch_and_sub1_release_write"; +# endif +# ifdef AO_HAVE_int_and_release_write + (void)"AO_int_and_release_write(&val, incr):"; + AO_int_and_release_write(&val, incr); +# else + (void)"No AO_int_and_release_write"; +# endif +# ifdef AO_HAVE_int_or_release_write + (void)"AO_int_or_release_write(&val, incr):"; + AO_int_or_release_write(&val, incr); +# else + (void)"No AO_int_or_release_write"; +# endif +# ifdef AO_HAVE_int_xor_release_write + (void)"AO_int_xor_release_write(&val, incr):"; + AO_int_xor_release_write(&val, incr); +# else + (void)"No AO_int_xor_release_write"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_release_write + (void)"AO_int_compare_and_swap_release_write(&val, oldval, newval):"; + AO_int_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_release_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release_write */ + /* TODO: Add AO_compare_and_swap_double_release_write */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_release_write + (void)"AO_int_fetch_compare_and_swap_release_write(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_release_write"; +# endif + +# if defined(AO_HAVE_test_and_set_release_write) + (void)"AO_test_and_set_release_write(&ts):"; + AO_test_and_set_release_write(&ts); +# else + (void)"No AO_test_and_set_release_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_acquire_read(void) +{ +# if defined(AO_HAVE_int_load_acquire_read) || defined(AO_HAVE_int_store_acquire_read) \ + || defined(AO_HAVE_int_fetch_and_add_acquire_read) \ + || defined(AO_HAVE_int_fetch_and_add1_acquire_read) \ + || defined(AO_HAVE_int_and_acquire_read) \ + || defined(AO_HAVE_int_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire_read) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire_read) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_acquire_read) \ + || defined(AO_HAVE_int_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_acquire_read) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_acquire_read) || defined(AO_HAVE_int_and_acquire_read) \ + || defined(AO_HAVE_int_or_acquire_read) || defined(AO_HAVE_int_xor_acquire_read) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + (void)"AO_nop_acquire_read(): "; + AO_nop_acquire_read(); +# else + (void)"No AO_nop_acquire_read"; +# endif + +# ifdef AO_HAVE_int_load_acquire_read + (void)"AO_int_load_acquire_read(&val):"; + AO_int_load_acquire_read(&val); +# else + (void)"No AO_int_load_acquire_read"; +# endif +# ifdef AO_HAVE_int_store_acquire_read + (void)"AO_int_store_acquire_read(&val, newval):"; + AO_int_store_acquire_read(&val, newval); +# else + (void)"No AO_int_store_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_acquire_read + (void)"AO_int_fetch_and_add_acquire_read(&val, incr):"; + AO_int_fetch_and_add_acquire_read(&val, incr); +# else + (void)"No AO_int_fetch_and_add_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_acquire_read + (void)"AO_int_fetch_and_add1_acquire_read(&val):"; + AO_int_fetch_and_add1_acquire_read(&val); +# else + (void)"No AO_int_fetch_and_add1_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_acquire_read + (void)"AO_int_fetch_and_sub1_acquire_read(&val):"; + AO_int_fetch_and_sub1_acquire_read(&val); +# else + (void)"No AO_int_fetch_and_sub1_acquire_read"; +# endif +# ifdef AO_HAVE_int_and_acquire_read + (void)"AO_int_and_acquire_read(&val, incr):"; + AO_int_and_acquire_read(&val, incr); +# else + (void)"No AO_int_and_acquire_read"; +# endif +# ifdef AO_HAVE_int_or_acquire_read + (void)"AO_int_or_acquire_read(&val, incr):"; + AO_int_or_acquire_read(&val, incr); +# else + (void)"No AO_int_or_acquire_read"; +# endif +# ifdef AO_HAVE_int_xor_acquire_read + (void)"AO_int_xor_acquire_read(&val, incr):"; + AO_int_xor_acquire_read(&val, incr); +# else + (void)"No AO_int_xor_acquire_read"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_acquire_read + (void)"AO_int_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_int_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_acquire_read */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_acquire_read + (void)"AO_int_fetch_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire_read) + (void)"AO_test_and_set_acquire_read(&ts):"; + AO_test_and_set_acquire_read(&ts); +# else + (void)"No AO_test_and_set_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void int_list_atomic_dd_acquire_read(void) +{ +# if defined(AO_HAVE_int_load_dd_acquire_read) || defined(AO_HAVE_int_store_dd_acquire_read) \ + || defined(AO_HAVE_int_fetch_and_add_dd_acquire_read) \ + || defined(AO_HAVE_int_fetch_and_add1_dd_acquire_read) \ + || defined(AO_HAVE_int_and_dd_acquire_read) \ + || defined(AO_HAVE_int_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_dd_acquire_read) + static volatile unsigned val /* = 0 */; +# endif +# if defined(AO_HAVE_int_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_dd_acquire_read) + static unsigned oldval /* = 0 */; +# endif +# if defined(AO_HAVE_int_store_dd_acquire_read) \ + || defined(AO_HAVE_int_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_int_fetch_compare_and_swap_dd_acquire_read) + static unsigned newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_int_fetch_and_add_dd_acquire_read) || defined(AO_HAVE_int_and_dd_acquire_read) \ + || defined(AO_HAVE_int_or_dd_acquire_read) || defined(AO_HAVE_int_xor_dd_acquire_read) + static unsigned incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_dd_acquire_read) + (void)"AO_nop_dd_acquire_read(): "; + AO_nop_dd_acquire_read(); +# else + (void)"No AO_nop_dd_acquire_read"; +# endif + +# ifdef AO_HAVE_int_load_dd_acquire_read + (void)"AO_int_load_dd_acquire_read(&val):"; + AO_int_load_dd_acquire_read(&val); +# else + (void)"No AO_int_load_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_store_dd_acquire_read + (void)"AO_int_store_dd_acquire_read(&val, newval):"; + AO_int_store_dd_acquire_read(&val, newval); +# else + (void)"No AO_int_store_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add_dd_acquire_read + (void)"AO_int_fetch_and_add_dd_acquire_read(&val, incr):"; + AO_int_fetch_and_add_dd_acquire_read(&val, incr); +# else + (void)"No AO_int_fetch_and_add_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_add1_dd_acquire_read + (void)"AO_int_fetch_and_add1_dd_acquire_read(&val):"; + AO_int_fetch_and_add1_dd_acquire_read(&val); +# else + (void)"No AO_int_fetch_and_add1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_fetch_and_sub1_dd_acquire_read + (void)"AO_int_fetch_and_sub1_dd_acquire_read(&val):"; + AO_int_fetch_and_sub1_dd_acquire_read(&val); +# else + (void)"No AO_int_fetch_and_sub1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_and_dd_acquire_read + (void)"AO_int_and_dd_acquire_read(&val, incr):"; + AO_int_and_dd_acquire_read(&val, incr); +# else + (void)"No AO_int_and_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_or_dd_acquire_read + (void)"AO_int_or_dd_acquire_read(&val, incr):"; + AO_int_or_dd_acquire_read(&val, incr); +# else + (void)"No AO_int_or_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_xor_dd_acquire_read + (void)"AO_int_xor_dd_acquire_read(&val, incr):"; + AO_int_xor_dd_acquire_read(&val, incr); +# else + (void)"No AO_int_xor_dd_acquire_read"; +# endif +# ifdef AO_HAVE_int_compare_and_swap_dd_acquire_read + (void)"AO_int_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_int_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_int_compare_and_swap_dd_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_dd_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_dd_acquire_read */ +# ifdef AO_HAVE_int_fetch_compare_and_swap_dd_acquire_read + (void)"AO_int_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_int_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_int_fetch_compare_and_swap_dd_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + (void)"AO_test_and_set_dd_acquire_read(&ts):"; + AO_test_and_set_dd_acquire_read(&ts); +# else + (void)"No AO_test_and_set_dd_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic(void) +{ +# if defined(AO_HAVE_double_load) || defined(AO_HAVE_double_store) \ + || defined(AO_HAVE_double_fetch_and_add) \ + || defined(AO_HAVE_double_fetch_and_add1) \ + || defined(AO_HAVE_double_and) \ + || defined(AO_HAVE_double_compare_and_swap) \ + || defined(AO_HAVE_double_fetch_compare_and_swap) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap) \ + || defined(AO_HAVE_double_fetch_compare_and_swap) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store) \ + || defined(AO_HAVE_double_compare_and_swap) \ + || defined(AO_HAVE_double_fetch_compare_and_swap) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add) || defined(AO_HAVE_double_and) \ + || defined(AO_HAVE_double_or) || defined(AO_HAVE_double_xor) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop) + (void)"AO_nop(): "; + AO_nop(); +# else + (void)"No AO_nop"; +# endif + +# ifdef AO_HAVE_double_load + (void)"AO_double_load(&val):"; + AO_double_load(&val); +# else + (void)"No AO_double_load"; +# endif +# ifdef AO_HAVE_double_store + (void)"AO_double_store(&val, newval):"; + AO_double_store(&val, newval); +# else + (void)"No AO_double_store"; +# endif +# ifdef AO_HAVE_double_fetch_and_add + (void)"AO_double_fetch_and_add(&val, incr):"; + AO_double_fetch_and_add(&val, incr); +# else + (void)"No AO_double_fetch_and_add"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1 + (void)"AO_double_fetch_and_add1(&val):"; + AO_double_fetch_and_add1(&val); +# else + (void)"No AO_double_fetch_and_add1"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1 + (void)"AO_double_fetch_and_sub1(&val):"; + AO_double_fetch_and_sub1(&val); +# else + (void)"No AO_double_fetch_and_sub1"; +# endif +# ifdef AO_HAVE_double_and + (void)"AO_double_and(&val, incr):"; + AO_double_and(&val, incr); +# else + (void)"No AO_double_and"; +# endif +# ifdef AO_HAVE_double_or + (void)"AO_double_or(&val, incr):"; + AO_double_or(&val, incr); +# else + (void)"No AO_double_or"; +# endif +# ifdef AO_HAVE_double_xor + (void)"AO_double_xor(&val, incr):"; + AO_double_xor(&val, incr); +# else + (void)"No AO_double_xor"; +# endif +# ifdef AO_HAVE_double_compare_and_swap + (void)"AO_double_compare_and_swap(&val, oldval, newval):"; + AO_double_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap"; +# endif + /* TODO: Add AO_compare_double_and_swap_double */ + /* TODO: Add AO_compare_and_swap_double */ +# ifdef AO_HAVE_double_fetch_compare_and_swap + (void)"AO_double_fetch_compare_and_swap(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap"; +# endif + +# if defined(AO_HAVE_test_and_set) + (void)"AO_test_and_set(&ts):"; + AO_test_and_set(&ts); +# else + (void)"No AO_test_and_set"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_release(void) +{ +# if defined(AO_HAVE_double_load_release) || defined(AO_HAVE_double_store_release) \ + || defined(AO_HAVE_double_fetch_and_add_release) \ + || defined(AO_HAVE_double_fetch_and_add1_release) \ + || defined(AO_HAVE_double_and_release) \ + || defined(AO_HAVE_double_compare_and_swap_release) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_release) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_release) \ + || defined(AO_HAVE_double_compare_and_swap_release) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_release) || defined(AO_HAVE_double_and_release) \ + || defined(AO_HAVE_double_or_release) || defined(AO_HAVE_double_xor_release) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release) + (void)"AO_nop_release(): "; + AO_nop_release(); +# else + (void)"No AO_nop_release"; +# endif + +# ifdef AO_HAVE_double_load_release + (void)"AO_double_load_release(&val):"; + AO_double_load_release(&val); +# else + (void)"No AO_double_load_release"; +# endif +# ifdef AO_HAVE_double_store_release + (void)"AO_double_store_release(&val, newval):"; + AO_double_store_release(&val, newval); +# else + (void)"No AO_double_store_release"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_release + (void)"AO_double_fetch_and_add_release(&val, incr):"; + AO_double_fetch_and_add_release(&val, incr); +# else + (void)"No AO_double_fetch_and_add_release"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_release + (void)"AO_double_fetch_and_add1_release(&val):"; + AO_double_fetch_and_add1_release(&val); +# else + (void)"No AO_double_fetch_and_add1_release"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_release + (void)"AO_double_fetch_and_sub1_release(&val):"; + AO_double_fetch_and_sub1_release(&val); +# else + (void)"No AO_double_fetch_and_sub1_release"; +# endif +# ifdef AO_HAVE_double_and_release + (void)"AO_double_and_release(&val, incr):"; + AO_double_and_release(&val, incr); +# else + (void)"No AO_double_and_release"; +# endif +# ifdef AO_HAVE_double_or_release + (void)"AO_double_or_release(&val, incr):"; + AO_double_or_release(&val, incr); +# else + (void)"No AO_double_or_release"; +# endif +# ifdef AO_HAVE_double_xor_release + (void)"AO_double_xor_release(&val, incr):"; + AO_double_xor_release(&val, incr); +# else + (void)"No AO_double_xor_release"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_release + (void)"AO_double_compare_and_swap_release(&val, oldval, newval):"; + AO_double_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_release"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release */ + /* TODO: Add AO_compare_and_swap_double_release */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_release + (void)"AO_double_fetch_compare_and_swap_release(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_release(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_release"; +# endif + +# if defined(AO_HAVE_test_and_set_release) + (void)"AO_test_and_set_release(&ts):"; + AO_test_and_set_release(&ts); +# else + (void)"No AO_test_and_set_release"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_acquire(void) +{ +# if defined(AO_HAVE_double_load_acquire) || defined(AO_HAVE_double_store_acquire) \ + || defined(AO_HAVE_double_fetch_and_add_acquire) \ + || defined(AO_HAVE_double_fetch_and_add1_acquire) \ + || defined(AO_HAVE_double_and_acquire) \ + || defined(AO_HAVE_double_compare_and_swap_acquire) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_acquire) \ + || defined(AO_HAVE_double_compare_and_swap_acquire) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_acquire) || defined(AO_HAVE_double_and_acquire) \ + || defined(AO_HAVE_double_or_acquire) || defined(AO_HAVE_double_xor_acquire) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire) + (void)"AO_nop_acquire(): "; + AO_nop_acquire(); +# else + (void)"No AO_nop_acquire"; +# endif + +# ifdef AO_HAVE_double_load_acquire + (void)"AO_double_load_acquire(&val):"; + AO_double_load_acquire(&val); +# else + (void)"No AO_double_load_acquire"; +# endif +# ifdef AO_HAVE_double_store_acquire + (void)"AO_double_store_acquire(&val, newval):"; + AO_double_store_acquire(&val, newval); +# else + (void)"No AO_double_store_acquire"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_acquire + (void)"AO_double_fetch_and_add_acquire(&val, incr):"; + AO_double_fetch_and_add_acquire(&val, incr); +# else + (void)"No AO_double_fetch_and_add_acquire"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_acquire + (void)"AO_double_fetch_and_add1_acquire(&val):"; + AO_double_fetch_and_add1_acquire(&val); +# else + (void)"No AO_double_fetch_and_add1_acquire"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_acquire + (void)"AO_double_fetch_and_sub1_acquire(&val):"; + AO_double_fetch_and_sub1_acquire(&val); +# else + (void)"No AO_double_fetch_and_sub1_acquire"; +# endif +# ifdef AO_HAVE_double_and_acquire + (void)"AO_double_and_acquire(&val, incr):"; + AO_double_and_acquire(&val, incr); +# else + (void)"No AO_double_and_acquire"; +# endif +# ifdef AO_HAVE_double_or_acquire + (void)"AO_double_or_acquire(&val, incr):"; + AO_double_or_acquire(&val, incr); +# else + (void)"No AO_double_or_acquire"; +# endif +# ifdef AO_HAVE_double_xor_acquire + (void)"AO_double_xor_acquire(&val, incr):"; + AO_double_xor_acquire(&val, incr); +# else + (void)"No AO_double_xor_acquire"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_acquire + (void)"AO_double_compare_and_swap_acquire(&val, oldval, newval):"; + AO_double_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_acquire"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire */ + /* TODO: Add AO_compare_and_swap_double_acquire */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_acquire + (void)"AO_double_fetch_compare_and_swap_acquire(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_acquire(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_acquire"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire) + (void)"AO_test_and_set_acquire(&ts):"; + AO_test_and_set_acquire(&ts); +# else + (void)"No AO_test_and_set_acquire"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_read(void) +{ +# if defined(AO_HAVE_double_load_read) || defined(AO_HAVE_double_store_read) \ + || defined(AO_HAVE_double_fetch_and_add_read) \ + || defined(AO_HAVE_double_fetch_and_add1_read) \ + || defined(AO_HAVE_double_and_read) \ + || defined(AO_HAVE_double_compare_and_swap_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_read) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_read) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_read) \ + || defined(AO_HAVE_double_compare_and_swap_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_read) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_read) || defined(AO_HAVE_double_and_read) \ + || defined(AO_HAVE_double_or_read) || defined(AO_HAVE_double_xor_read) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_read) + (void)"AO_nop_read(): "; + AO_nop_read(); +# else + (void)"No AO_nop_read"; +# endif + +# ifdef AO_HAVE_double_load_read + (void)"AO_double_load_read(&val):"; + AO_double_load_read(&val); +# else + (void)"No AO_double_load_read"; +# endif +# ifdef AO_HAVE_double_store_read + (void)"AO_double_store_read(&val, newval):"; + AO_double_store_read(&val, newval); +# else + (void)"No AO_double_store_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_read + (void)"AO_double_fetch_and_add_read(&val, incr):"; + AO_double_fetch_and_add_read(&val, incr); +# else + (void)"No AO_double_fetch_and_add_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_read + (void)"AO_double_fetch_and_add1_read(&val):"; + AO_double_fetch_and_add1_read(&val); +# else + (void)"No AO_double_fetch_and_add1_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_read + (void)"AO_double_fetch_and_sub1_read(&val):"; + AO_double_fetch_and_sub1_read(&val); +# else + (void)"No AO_double_fetch_and_sub1_read"; +# endif +# ifdef AO_HAVE_double_and_read + (void)"AO_double_and_read(&val, incr):"; + AO_double_and_read(&val, incr); +# else + (void)"No AO_double_and_read"; +# endif +# ifdef AO_HAVE_double_or_read + (void)"AO_double_or_read(&val, incr):"; + AO_double_or_read(&val, incr); +# else + (void)"No AO_double_or_read"; +# endif +# ifdef AO_HAVE_double_xor_read + (void)"AO_double_xor_read(&val, incr):"; + AO_double_xor_read(&val, incr); +# else + (void)"No AO_double_xor_read"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_read + (void)"AO_double_compare_and_swap_read(&val, oldval, newval):"; + AO_double_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_read */ + /* TODO: Add AO_compare_and_swap_double_read */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_read + (void)"AO_double_fetch_compare_and_swap_read(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_read(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_read"; +# endif + +# if defined(AO_HAVE_test_and_set_read) + (void)"AO_test_and_set_read(&ts):"; + AO_test_and_set_read(&ts); +# else + (void)"No AO_test_and_set_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_write(void) +{ +# if defined(AO_HAVE_double_load_write) || defined(AO_HAVE_double_store_write) \ + || defined(AO_HAVE_double_fetch_and_add_write) \ + || defined(AO_HAVE_double_fetch_and_add1_write) \ + || defined(AO_HAVE_double_and_write) \ + || defined(AO_HAVE_double_compare_and_swap_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_write) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_write) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_write) \ + || defined(AO_HAVE_double_compare_and_swap_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_write) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_write) || defined(AO_HAVE_double_and_write) \ + || defined(AO_HAVE_double_or_write) || defined(AO_HAVE_double_xor_write) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_write) + (void)"AO_nop_write(): "; + AO_nop_write(); +# else + (void)"No AO_nop_write"; +# endif + +# ifdef AO_HAVE_double_load_write + (void)"AO_double_load_write(&val):"; + AO_double_load_write(&val); +# else + (void)"No AO_double_load_write"; +# endif +# ifdef AO_HAVE_double_store_write + (void)"AO_double_store_write(&val, newval):"; + AO_double_store_write(&val, newval); +# else + (void)"No AO_double_store_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_write + (void)"AO_double_fetch_and_add_write(&val, incr):"; + AO_double_fetch_and_add_write(&val, incr); +# else + (void)"No AO_double_fetch_and_add_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_write + (void)"AO_double_fetch_and_add1_write(&val):"; + AO_double_fetch_and_add1_write(&val); +# else + (void)"No AO_double_fetch_and_add1_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_write + (void)"AO_double_fetch_and_sub1_write(&val):"; + AO_double_fetch_and_sub1_write(&val); +# else + (void)"No AO_double_fetch_and_sub1_write"; +# endif +# ifdef AO_HAVE_double_and_write + (void)"AO_double_and_write(&val, incr):"; + AO_double_and_write(&val, incr); +# else + (void)"No AO_double_and_write"; +# endif +# ifdef AO_HAVE_double_or_write + (void)"AO_double_or_write(&val, incr):"; + AO_double_or_write(&val, incr); +# else + (void)"No AO_double_or_write"; +# endif +# ifdef AO_HAVE_double_xor_write + (void)"AO_double_xor_write(&val, incr):"; + AO_double_xor_write(&val, incr); +# else + (void)"No AO_double_xor_write"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_write + (void)"AO_double_compare_and_swap_write(&val, oldval, newval):"; + AO_double_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_write */ + /* TODO: Add AO_compare_and_swap_double_write */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_write + (void)"AO_double_fetch_compare_and_swap_write(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_write(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_write"; +# endif + +# if defined(AO_HAVE_test_and_set_write) + (void)"AO_test_and_set_write(&ts):"; + AO_test_and_set_write(&ts); +# else + (void)"No AO_test_and_set_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_full(void) +{ +# if defined(AO_HAVE_double_load_full) || defined(AO_HAVE_double_store_full) \ + || defined(AO_HAVE_double_fetch_and_add_full) \ + || defined(AO_HAVE_double_fetch_and_add1_full) \ + || defined(AO_HAVE_double_and_full) \ + || defined(AO_HAVE_double_compare_and_swap_full) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_full) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_full) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_full) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_full) \ + || defined(AO_HAVE_double_compare_and_swap_full) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_full) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_full) || defined(AO_HAVE_double_and_full) \ + || defined(AO_HAVE_double_or_full) || defined(AO_HAVE_double_xor_full) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_full) + (void)"AO_nop_full(): "; + AO_nop_full(); +# else + (void)"No AO_nop_full"; +# endif + +# ifdef AO_HAVE_double_load_full + (void)"AO_double_load_full(&val):"; + AO_double_load_full(&val); +# else + (void)"No AO_double_load_full"; +# endif +# ifdef AO_HAVE_double_store_full + (void)"AO_double_store_full(&val, newval):"; + AO_double_store_full(&val, newval); +# else + (void)"No AO_double_store_full"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_full + (void)"AO_double_fetch_and_add_full(&val, incr):"; + AO_double_fetch_and_add_full(&val, incr); +# else + (void)"No AO_double_fetch_and_add_full"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_full + (void)"AO_double_fetch_and_add1_full(&val):"; + AO_double_fetch_and_add1_full(&val); +# else + (void)"No AO_double_fetch_and_add1_full"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_full + (void)"AO_double_fetch_and_sub1_full(&val):"; + AO_double_fetch_and_sub1_full(&val); +# else + (void)"No AO_double_fetch_and_sub1_full"; +# endif +# ifdef AO_HAVE_double_and_full + (void)"AO_double_and_full(&val, incr):"; + AO_double_and_full(&val, incr); +# else + (void)"No AO_double_and_full"; +# endif +# ifdef AO_HAVE_double_or_full + (void)"AO_double_or_full(&val, incr):"; + AO_double_or_full(&val, incr); +# else + (void)"No AO_double_or_full"; +# endif +# ifdef AO_HAVE_double_xor_full + (void)"AO_double_xor_full(&val, incr):"; + AO_double_xor_full(&val, incr); +# else + (void)"No AO_double_xor_full"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_full + (void)"AO_double_compare_and_swap_full(&val, oldval, newval):"; + AO_double_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_full"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_full */ + /* TODO: Add AO_compare_and_swap_double_full */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_full + (void)"AO_double_fetch_compare_and_swap_full(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_full(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_full"; +# endif + +# if defined(AO_HAVE_test_and_set_full) + (void)"AO_test_and_set_full(&ts):"; + AO_test_and_set_full(&ts); +# else + (void)"No AO_test_and_set_full"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_release_write(void) +{ +# if defined(AO_HAVE_double_load_release_write) || defined(AO_HAVE_double_store_release_write) \ + || defined(AO_HAVE_double_fetch_and_add_release_write) \ + || defined(AO_HAVE_double_fetch_and_add1_release_write) \ + || defined(AO_HAVE_double_and_release_write) \ + || defined(AO_HAVE_double_compare_and_swap_release_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release_write) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_release_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release_write) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_release_write) \ + || defined(AO_HAVE_double_compare_and_swap_release_write) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_release_write) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_release_write) || defined(AO_HAVE_double_and_release_write) \ + || defined(AO_HAVE_double_or_release_write) || defined(AO_HAVE_double_xor_release_write) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_release_write) + (void)"AO_nop_release_write(): "; + AO_nop_release_write(); +# else + (void)"No AO_nop_release_write"; +# endif + +# ifdef AO_HAVE_double_load_release_write + (void)"AO_double_load_release_write(&val):"; + AO_double_load_release_write(&val); +# else + (void)"No AO_double_load_release_write"; +# endif +# ifdef AO_HAVE_double_store_release_write + (void)"AO_double_store_release_write(&val, newval):"; + AO_double_store_release_write(&val, newval); +# else + (void)"No AO_double_store_release_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_release_write + (void)"AO_double_fetch_and_add_release_write(&val, incr):"; + AO_double_fetch_and_add_release_write(&val, incr); +# else + (void)"No AO_double_fetch_and_add_release_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_release_write + (void)"AO_double_fetch_and_add1_release_write(&val):"; + AO_double_fetch_and_add1_release_write(&val); +# else + (void)"No AO_double_fetch_and_add1_release_write"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_release_write + (void)"AO_double_fetch_and_sub1_release_write(&val):"; + AO_double_fetch_and_sub1_release_write(&val); +# else + (void)"No AO_double_fetch_and_sub1_release_write"; +# endif +# ifdef AO_HAVE_double_and_release_write + (void)"AO_double_and_release_write(&val, incr):"; + AO_double_and_release_write(&val, incr); +# else + (void)"No AO_double_and_release_write"; +# endif +# ifdef AO_HAVE_double_or_release_write + (void)"AO_double_or_release_write(&val, incr):"; + AO_double_or_release_write(&val, incr); +# else + (void)"No AO_double_or_release_write"; +# endif +# ifdef AO_HAVE_double_xor_release_write + (void)"AO_double_xor_release_write(&val, incr):"; + AO_double_xor_release_write(&val, incr); +# else + (void)"No AO_double_xor_release_write"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_release_write + (void)"AO_double_compare_and_swap_release_write(&val, oldval, newval):"; + AO_double_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_release_write"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_release_write */ + /* TODO: Add AO_compare_and_swap_double_release_write */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_release_write + (void)"AO_double_fetch_compare_and_swap_release_write(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_release_write(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_release_write"; +# endif + +# if defined(AO_HAVE_test_and_set_release_write) + (void)"AO_test_and_set_release_write(&ts):"; + AO_test_and_set_release_write(&ts); +# else + (void)"No AO_test_and_set_release_write"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_acquire_read(void) +{ +# if defined(AO_HAVE_double_load_acquire_read) || defined(AO_HAVE_double_store_acquire_read) \ + || defined(AO_HAVE_double_fetch_and_add_acquire_read) \ + || defined(AO_HAVE_double_fetch_and_add1_acquire_read) \ + || defined(AO_HAVE_double_and_acquire_read) \ + || defined(AO_HAVE_double_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire_read) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire_read) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_acquire_read) \ + || defined(AO_HAVE_double_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_acquire_read) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_acquire_read) || defined(AO_HAVE_double_and_acquire_read) \ + || defined(AO_HAVE_double_or_acquire_read) || defined(AO_HAVE_double_xor_acquire_read) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + (void)"AO_nop_acquire_read(): "; + AO_nop_acquire_read(); +# else + (void)"No AO_nop_acquire_read"; +# endif + +# ifdef AO_HAVE_double_load_acquire_read + (void)"AO_double_load_acquire_read(&val):"; + AO_double_load_acquire_read(&val); +# else + (void)"No AO_double_load_acquire_read"; +# endif +# ifdef AO_HAVE_double_store_acquire_read + (void)"AO_double_store_acquire_read(&val, newval):"; + AO_double_store_acquire_read(&val, newval); +# else + (void)"No AO_double_store_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_acquire_read + (void)"AO_double_fetch_and_add_acquire_read(&val, incr):"; + AO_double_fetch_and_add_acquire_read(&val, incr); +# else + (void)"No AO_double_fetch_and_add_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_acquire_read + (void)"AO_double_fetch_and_add1_acquire_read(&val):"; + AO_double_fetch_and_add1_acquire_read(&val); +# else + (void)"No AO_double_fetch_and_add1_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_acquire_read + (void)"AO_double_fetch_and_sub1_acquire_read(&val):"; + AO_double_fetch_and_sub1_acquire_read(&val); +# else + (void)"No AO_double_fetch_and_sub1_acquire_read"; +# endif +# ifdef AO_HAVE_double_and_acquire_read + (void)"AO_double_and_acquire_read(&val, incr):"; + AO_double_and_acquire_read(&val, incr); +# else + (void)"No AO_double_and_acquire_read"; +# endif +# ifdef AO_HAVE_double_or_acquire_read + (void)"AO_double_or_acquire_read(&val, incr):"; + AO_double_or_acquire_read(&val, incr); +# else + (void)"No AO_double_or_acquire_read"; +# endif +# ifdef AO_HAVE_double_xor_acquire_read + (void)"AO_double_xor_acquire_read(&val, incr):"; + AO_double_xor_acquire_read(&val, incr); +# else + (void)"No AO_double_xor_acquire_read"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_acquire_read + (void)"AO_double_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_double_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_acquire_read */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_acquire_read + (void)"AO_double_fetch_compare_and_swap_acquire_read(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_acquire_read(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_acquire_read) + (void)"AO_test_and_set_acquire_read(&ts):"; + AO_test_and_set_acquire_read(&ts); +# else + (void)"No AO_test_and_set_acquire_read"; +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* This generates a compilable program. But it is really meant to be */ +/* be used only with cc -E, to inspect the expensions generated by */ +/* primitives. */ + +/* The result will not link or run. */ + +void double_list_atomic_dd_acquire_read(void) +{ +# if defined(AO_HAVE_double_load_dd_acquire_read) || defined(AO_HAVE_double_store_dd_acquire_read) \ + || defined(AO_HAVE_double_fetch_and_add_dd_acquire_read) \ + || defined(AO_HAVE_double_fetch_and_add1_dd_acquire_read) \ + || defined(AO_HAVE_double_and_dd_acquire_read) \ + || defined(AO_HAVE_double_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_dd_acquire_read) + static volatile AO_double_t val /* = 0 */; +# endif +# if defined(AO_HAVE_double_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_dd_acquire_read) + static AO_double_t oldval /* = 0 */; +# endif +# if defined(AO_HAVE_double_store_dd_acquire_read) \ + || defined(AO_HAVE_double_compare_and_swap_dd_acquire_read) \ + || defined(AO_HAVE_double_fetch_compare_and_swap_dd_acquire_read) + static AO_double_t newval /* = 0 */; +# endif +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + AO_TS_t ts; +# endif +# if defined(AO_HAVE_double_fetch_and_add_dd_acquire_read) || defined(AO_HAVE_double_and_dd_acquire_read) \ + || defined(AO_HAVE_double_or_dd_acquire_read) || defined(AO_HAVE_double_xor_dd_acquire_read) + static AO_double_t incr /* = 0 */; +# endif + +# if defined(AO_HAVE_nop_dd_acquire_read) + (void)"AO_nop_dd_acquire_read(): "; + AO_nop_dd_acquire_read(); +# else + (void)"No AO_nop_dd_acquire_read"; +# endif + +# ifdef AO_HAVE_double_load_dd_acquire_read + (void)"AO_double_load_dd_acquire_read(&val):"; + AO_double_load_dd_acquire_read(&val); +# else + (void)"No AO_double_load_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_store_dd_acquire_read + (void)"AO_double_store_dd_acquire_read(&val, newval):"; + AO_double_store_dd_acquire_read(&val, newval); +# else + (void)"No AO_double_store_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add_dd_acquire_read + (void)"AO_double_fetch_and_add_dd_acquire_read(&val, incr):"; + AO_double_fetch_and_add_dd_acquire_read(&val, incr); +# else + (void)"No AO_double_fetch_and_add_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_add1_dd_acquire_read + (void)"AO_double_fetch_and_add1_dd_acquire_read(&val):"; + AO_double_fetch_and_add1_dd_acquire_read(&val); +# else + (void)"No AO_double_fetch_and_add1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_fetch_and_sub1_dd_acquire_read + (void)"AO_double_fetch_and_sub1_dd_acquire_read(&val):"; + AO_double_fetch_and_sub1_dd_acquire_read(&val); +# else + (void)"No AO_double_fetch_and_sub1_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_and_dd_acquire_read + (void)"AO_double_and_dd_acquire_read(&val, incr):"; + AO_double_and_dd_acquire_read(&val, incr); +# else + (void)"No AO_double_and_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_or_dd_acquire_read + (void)"AO_double_or_dd_acquire_read(&val, incr):"; + AO_double_or_dd_acquire_read(&val, incr); +# else + (void)"No AO_double_or_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_xor_dd_acquire_read + (void)"AO_double_xor_dd_acquire_read(&val, incr):"; + AO_double_xor_dd_acquire_read(&val, incr); +# else + (void)"No AO_double_xor_dd_acquire_read"; +# endif +# ifdef AO_HAVE_double_compare_and_swap_dd_acquire_read + (void)"AO_double_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_double_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_double_compare_and_swap_dd_acquire_read"; +# endif + /* TODO: Add AO_compare_double_and_swap_double_dd_acquire_read */ + /* TODO: Add AO_compare_and_swap_double_dd_acquire_read */ +# ifdef AO_HAVE_double_fetch_compare_and_swap_dd_acquire_read + (void)"AO_double_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval):"; + AO_double_fetch_compare_and_swap_dd_acquire_read(&val, oldval, newval); +# else + (void)"No AO_double_fetch_compare_and_swap_dd_acquire_read"; +# endif + +# if defined(AO_HAVE_test_and_set_dd_acquire_read) + (void)"AO_test_and_set_dd_acquire_read(&ts):"; + AO_test_and_set_dd_acquire_read(&ts); +# else + (void)"No AO_test_and_set_dd_acquire_read"; +# endif +} --- libatomic-ops-7.4.orig/tests/test_atomic_include.h +++ libatomic-ops-7.4/tests/test_atomic_include.h @@ -0,0 +1,2808 @@ +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: )\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "") + +void test_atomic(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap) \ + || defined(AO_HAVE_double_load) \ + || defined(AO_HAVE_double_store) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double) \ + || defined(AO_HAVE_compare_double_and_swap_double) \ + || defined(AO_HAVE_double_compare_and_swap) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop) + AO_nop(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store) + AO_store(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load) + TA_assert(AO_load(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set) + assert(AO_test_and_set(&z) == AO_TS_CLEAR); + assert(AO_test_and_set(&z) == AO_TS_SET); + assert(AO_test_and_set(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add) + TA_assert(AO_fetch_and_add(&x, 42) == 13); + TA_assert(AO_fetch_and_add(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1) + TA_assert(AO_fetch_and_add1(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1) + TA_assert(AO_fetch_and_sub1(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store) + AO_short_store(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add) + TA_assert(AO_short_fetch_and_add(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1) + TA_assert(AO_short_fetch_and_add1(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1) + TA_assert(AO_short_fetch_and_sub1(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store) + AO_char_store(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add) + TA_assert(AO_char_fetch_and_add(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1) + TA_assert(AO_char_fetch_and_add1(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1) + TA_assert(AO_char_fetch_and_sub1(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store) + AO_int_store(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add) + TA_assert(AO_int_fetch_and_add(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1) + TA_assert(AO_int_fetch_and_add1(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1) + TA_assert(AO_int_fetch_and_sub1(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap) + TA_assert(!AO_compare_and_swap(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or) + AO_or(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor) + AO_xor(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and) + AO_and(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap) + TA_assert(AO_fetch_compare_and_swap(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double) + TA_assert(!AO_compare_double_and_swap_double(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double) + TA_assert(!AO_compare_and_swap_double(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_release") + +void test_atomic_release(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_release) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_release) \ + || defined(AO_HAVE_double_load_release) \ + || defined(AO_HAVE_double_store_release) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_release) \ + || defined(AO_HAVE_compare_double_and_swap_double_release) \ + || defined(AO_HAVE_double_compare_and_swap_release) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_release) + AO_nop_release(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_release) + AO_store_release(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_release) + TA_assert(AO_load_release(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_release) + assert(AO_test_and_set_release(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_release(&z) == AO_TS_SET); + assert(AO_test_and_set_release(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_release) + TA_assert(AO_fetch_and_add_release(&x, 42) == 13); + TA_assert(AO_fetch_and_add_release(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_release) + TA_assert(AO_fetch_and_add1_release(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_release) + TA_assert(AO_fetch_and_sub1_release(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_release) + AO_short_store_release(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_release) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_release) + TA_assert(AO_short_fetch_and_add_release(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_release(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_release) + TA_assert(AO_short_fetch_and_add1_release(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_release) + TA_assert(AO_short_fetch_and_sub1_release(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_release) + AO_char_store_release(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_release) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_release) + TA_assert(AO_char_fetch_and_add_release(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_release(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_release) + TA_assert(AO_char_fetch_and_add1_release(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_release) + TA_assert(AO_char_fetch_and_sub1_release(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_release) + AO_int_store_release(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_release) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_release) + TA_assert(AO_int_fetch_and_add_release(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_release(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_release) + TA_assert(AO_int_fetch_and_add1_release(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_release) + TA_assert(AO_int_fetch_and_sub1_release(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_release) + TA_assert(!AO_compare_and_swap_release(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_release(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_release) + AO_or_release(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_release) + AO_xor_release(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_release) + AO_and_release(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_release) + TA_assert(AO_fetch_compare_and_swap_release(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_release(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_release) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_release(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_release) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_release(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_release(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_release(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_release) + TA_assert(!AO_compare_double_and_swap_double_release(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_release(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_release(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_release(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_release) + TA_assert(!AO_compare_and_swap_double_release(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_release(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_release(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_release(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_release(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_release(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_release) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_release(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_release(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_acquire") + +void test_atomic_acquire(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_acquire) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire) \ + || defined(AO_HAVE_double_load_acquire) \ + || defined(AO_HAVE_double_store_acquire) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_acquire) \ + || defined(AO_HAVE_compare_double_and_swap_double_acquire) \ + || defined(AO_HAVE_double_compare_and_swap_acquire) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_acquire) + AO_nop_acquire(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_acquire) + AO_store_acquire(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_acquire) + TA_assert(AO_load_acquire(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_acquire) + assert(AO_test_and_set_acquire(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_acquire(&z) == AO_TS_SET); + assert(AO_test_and_set_acquire(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_acquire) + TA_assert(AO_fetch_and_add_acquire(&x, 42) == 13); + TA_assert(AO_fetch_and_add_acquire(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_acquire) + TA_assert(AO_fetch_and_add1_acquire(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_acquire) + TA_assert(AO_fetch_and_sub1_acquire(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_acquire) + AO_short_store_acquire(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_acquire) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_acquire) + TA_assert(AO_short_fetch_and_add_acquire(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_acquire(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_acquire) + TA_assert(AO_short_fetch_and_add1_acquire(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_acquire) + TA_assert(AO_short_fetch_and_sub1_acquire(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_acquire) + AO_char_store_acquire(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_acquire) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_acquire) + TA_assert(AO_char_fetch_and_add_acquire(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_acquire(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_acquire) + TA_assert(AO_char_fetch_and_add1_acquire(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_acquire) + TA_assert(AO_char_fetch_and_sub1_acquire(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_acquire) + AO_int_store_acquire(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_acquire) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_acquire) + TA_assert(AO_int_fetch_and_add_acquire(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_acquire(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_acquire) + TA_assert(AO_int_fetch_and_add1_acquire(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_acquire) + TA_assert(AO_int_fetch_and_sub1_acquire(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_acquire) + TA_assert(!AO_compare_and_swap_acquire(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_acquire(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_acquire) + AO_or_acquire(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_acquire) + AO_xor_acquire(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_acquire) + AO_and_acquire(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_acquire) + TA_assert(AO_fetch_compare_and_swap_acquire(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_acquire(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_acquire) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_acquire(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_acquire) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_acquire(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_acquire(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_acquire(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_acquire) + TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_acquire(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_acquire(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_acquire(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_acquire) + TA_assert(!AO_compare_and_swap_double_acquire(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_acquire(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_acquire(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_acquire(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_acquire(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_acquire(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_acquire(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_acquire(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _read)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_read") + +void test_atomic_read(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_read) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_read) \ + || defined(AO_HAVE_double_load_read) \ + || defined(AO_HAVE_double_store_read) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_read) \ + || defined(AO_HAVE_compare_double_and_swap_double_read) \ + || defined(AO_HAVE_double_compare_and_swap_read) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_read) + AO_nop_read(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_read) + AO_store_read(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_read) + TA_assert(AO_load_read(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_read) + assert(AO_test_and_set_read(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_read(&z) == AO_TS_SET); + assert(AO_test_and_set_read(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_read) + TA_assert(AO_fetch_and_add_read(&x, 42) == 13); + TA_assert(AO_fetch_and_add_read(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_read) + TA_assert(AO_fetch_and_add1_read(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_read) + TA_assert(AO_fetch_and_sub1_read(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_read) + AO_short_store_read(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_read) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_read) + TA_assert(AO_short_fetch_and_add_read(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_read(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_read) + TA_assert(AO_short_fetch_and_add1_read(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_read) + TA_assert(AO_short_fetch_and_sub1_read(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_read) + AO_char_store_read(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_read) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_read) + TA_assert(AO_char_fetch_and_add_read(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_read(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_read) + TA_assert(AO_char_fetch_and_add1_read(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_read) + TA_assert(AO_char_fetch_and_sub1_read(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_read) + AO_int_store_read(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_read) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_read) + TA_assert(AO_int_fetch_and_add_read(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_read(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_read) + TA_assert(AO_int_fetch_and_add1_read(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_read) + TA_assert(AO_int_fetch_and_sub1_read(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_read) + TA_assert(!AO_compare_and_swap_read(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_read(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_read) + AO_or_read(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_read) + AO_xor_read(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_read) + AO_and_read(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_read) + TA_assert(AO_fetch_compare_and_swap_read(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_read(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_read) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_read(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_read) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_read) + TA_assert(!AO_compare_double_and_swap_double_read(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_read(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_read(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_read(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_read(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_read(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_read(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_read) + TA_assert(!AO_compare_and_swap_double_read(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_read(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_read(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_read(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_read(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_read(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_read) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_read(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _write)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_write") + +void test_atomic_write(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_write) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_write) \ + || defined(AO_HAVE_double_load_write) \ + || defined(AO_HAVE_double_store_write) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_write) \ + || defined(AO_HAVE_compare_double_and_swap_double_write) \ + || defined(AO_HAVE_double_compare_and_swap_write) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_write) + AO_nop_write(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_write) + AO_store_write(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_write) + TA_assert(AO_load_write(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_write) + assert(AO_test_and_set_write(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_write(&z) == AO_TS_SET); + assert(AO_test_and_set_write(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_write) + TA_assert(AO_fetch_and_add_write(&x, 42) == 13); + TA_assert(AO_fetch_and_add_write(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_write) + TA_assert(AO_fetch_and_add1_write(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_write) + TA_assert(AO_fetch_and_sub1_write(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_write) + AO_short_store_write(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_write) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_write) + TA_assert(AO_short_fetch_and_add_write(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_write(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_write) + TA_assert(AO_short_fetch_and_add1_write(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_write) + TA_assert(AO_short_fetch_and_sub1_write(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_write) + AO_char_store_write(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_write) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_write) + TA_assert(AO_char_fetch_and_add_write(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_write(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_write) + TA_assert(AO_char_fetch_and_add1_write(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_write) + TA_assert(AO_char_fetch_and_sub1_write(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_write) + AO_int_store_write(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_write) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_write) + TA_assert(AO_int_fetch_and_add_write(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_write(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_write) + TA_assert(AO_int_fetch_and_add1_write(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_write) + TA_assert(AO_int_fetch_and_sub1_write(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_write) + TA_assert(!AO_compare_and_swap_write(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_write(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_write) + AO_or_write(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_write) + AO_xor_write(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_write) + AO_and_write(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_write) + TA_assert(AO_fetch_compare_and_swap_write(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_write(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_write) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_write(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_write) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_write) + TA_assert(!AO_compare_double_and_swap_double_write(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_write(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_write(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_write(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_write(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_write(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_write(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_write) + TA_assert(!AO_compare_and_swap_double_write(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_write(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_write(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_write(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_write(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_write(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_write) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_write(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _full)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_full") + +void test_atomic_full(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_full) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_full) \ + || defined(AO_HAVE_double_load_full) \ + || defined(AO_HAVE_double_store_full) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_full) \ + || defined(AO_HAVE_compare_double_and_swap_double_full) \ + || defined(AO_HAVE_double_compare_and_swap_full) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_full) + AO_nop_full(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_full) + AO_store_full(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_full) + TA_assert(AO_load_full(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_full) + assert(AO_test_and_set_full(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_full(&z) == AO_TS_SET); + assert(AO_test_and_set_full(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_full) + TA_assert(AO_fetch_and_add_full(&x, 42) == 13); + TA_assert(AO_fetch_and_add_full(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_full) + TA_assert(AO_fetch_and_add1_full(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_full) + TA_assert(AO_fetch_and_sub1_full(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_full) + AO_short_store_full(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_full) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_full) + TA_assert(AO_short_fetch_and_add_full(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_full(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_full) + TA_assert(AO_short_fetch_and_add1_full(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_full) + TA_assert(AO_short_fetch_and_sub1_full(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_full) + AO_char_store_full(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_full) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_full) + TA_assert(AO_char_fetch_and_add_full(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_full(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_full) + TA_assert(AO_char_fetch_and_add1_full(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_full) + TA_assert(AO_char_fetch_and_sub1_full(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_full) + AO_int_store_full(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_full) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_full) + TA_assert(AO_int_fetch_and_add_full(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_full(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_full) + TA_assert(AO_int_fetch_and_add1_full(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_full) + TA_assert(AO_int_fetch_and_sub1_full(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_full) + TA_assert(!AO_compare_and_swap_full(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_full(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_full) + AO_or_full(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_full) + AO_xor_full(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_full) + AO_and_full(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_full) + TA_assert(AO_fetch_compare_and_swap_full(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_full(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_full) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_full(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_full) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_full(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_full(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_full(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_full) + TA_assert(!AO_compare_double_and_swap_double_full(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_full(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_full(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_full(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_full(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_full(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_full(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_full) + TA_assert(!AO_compare_and_swap_double_full(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_full(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_full(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_full(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_full(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_full(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_full) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_full(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_full(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _release_write)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_release_write") + +void test_atomic_release_write(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_release_write) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_release_write) \ + || defined(AO_HAVE_double_load_release_write) \ + || defined(AO_HAVE_double_store_release_write) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_release_write) \ + || defined(AO_HAVE_compare_double_and_swap_double_release_write) \ + || defined(AO_HAVE_double_compare_and_swap_release_write) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_release_write) + AO_nop_release_write(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_release_write) + AO_store_release_write(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_release_write) + TA_assert(AO_load_release_write(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_release_write) + assert(AO_test_and_set_release_write(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_release_write(&z) == AO_TS_SET); + assert(AO_test_and_set_release_write(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_release_write) + TA_assert(AO_fetch_and_add_release_write(&x, 42) == 13); + TA_assert(AO_fetch_and_add_release_write(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_release_write) + TA_assert(AO_fetch_and_add1_release_write(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_release_write) + TA_assert(AO_fetch_and_sub1_release_write(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_release_write) + AO_short_store_release_write(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_release_write) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_release_write) + TA_assert(AO_short_fetch_and_add_release_write(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_release_write(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_release_write) + TA_assert(AO_short_fetch_and_add1_release_write(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_release_write) + TA_assert(AO_short_fetch_and_sub1_release_write(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_release_write) + AO_char_store_release_write(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_release_write) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_release_write) + TA_assert(AO_char_fetch_and_add_release_write(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_release_write(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_release_write) + TA_assert(AO_char_fetch_and_add1_release_write(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_release_write) + TA_assert(AO_char_fetch_and_sub1_release_write(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_release_write) + AO_int_store_release_write(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_release_write) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_release_write) + TA_assert(AO_int_fetch_and_add_release_write(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_release_write(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_release_write) + TA_assert(AO_int_fetch_and_add1_release_write(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_release_write) + TA_assert(AO_int_fetch_and_sub1_release_write(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_release_write) + TA_assert(!AO_compare_and_swap_release_write(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_release_write(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_release_write) + AO_or_release_write(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_release_write) + AO_xor_release_write(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_release_write) + AO_and_release_write(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_release_write) + TA_assert(AO_fetch_compare_and_swap_release_write(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_release_write(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_release_write) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_release_write(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_release_write) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_release_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_release_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_release_write(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_release_write) + TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_release_write(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_release_write(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_release_write(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_release_write(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_release_write) + TA_assert(!AO_compare_and_swap_double_release_write(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_release_write(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_release_write(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_release_write(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_release_write(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_release_write(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_release_write) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_release_write(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_release_write(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +} +/* + * Copyright (c) 2003 by Hewlett-Packard Company. All rights reserved. + * + * This file is covered by the GNU general public license, version 2. + * see COPYING for details. + */ + +/* Some basic sanity tests. These do not test the barrier semantics. */ + +#undef TA_assert +#define TA_assert(e) \ + if (!(e)) { fprintf(stderr, "Assertion failed %s:%d (barrier: _acquire_read)\n", \ + __FILE__, __LINE__), exit(1); } + +#undef MISSING +#define MISSING(name) \ + printf("Missing: %s\n", #name "_acquire_read") + +void test_atomic_acquire_read(void) +{ + AO_t x; + unsigned char b; + unsigned short s; + unsigned int zz; +# if defined(AO_HAVE_test_and_set_acquire_read) + AO_TS_t z = AO_TS_INITIALIZER; +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire_read) \ + || defined(AO_HAVE_double_load_acquire_read) \ + || defined(AO_HAVE_double_store_acquire_read) + AO_double_t old_w; + AO_double_t new_w; +# endif +# if defined(AO_HAVE_compare_and_swap_double_acquire_read) \ + || defined(AO_HAVE_compare_double_and_swap_double_acquire_read) \ + || defined(AO_HAVE_double_compare_and_swap_acquire_read) + AO_double_t w; + w.AO_val1 = 0; + w.AO_val2 = 0; +# endif + +# if defined(AO_HAVE_nop_acquire_read) + AO_nop_acquire_read(); +# elif !defined(AO_HAVE_nop) || !defined(AO_HAVE_nop_full) \ + || !defined(AO_HAVE_nop_read) || !defined(AO_HAVE_nop_write) + MISSING(AO_nop); +# endif +# if defined(AO_HAVE_store_acquire_read) + AO_store_acquire_read(&x, 13); + TA_assert (x == 13); +# else +# if !defined(AO_HAVE_store) || !defined(AO_HAVE_store_full) \ + || !defined(AO_HAVE_store_release) \ + || !defined(AO_HAVE_store_release_write) \ + || !defined(AO_HAVE_store_write) + MISSING(AO_store); +# endif + x = 13; +# endif +# if defined(AO_HAVE_load_acquire_read) + TA_assert(AO_load_acquire_read(&x) == 13); +# elif !defined(AO_HAVE_load) || !defined(AO_HAVE_load_acquire) \ + || !defined(AO_HAVE_load_acquire_read) \ + || !defined(AO_HAVE_load_dd_acquire_read) \ + || !defined(AO_HAVE_load_full) || !defined(AO_HAVE_load_read) + MISSING(AO_load); +# endif +# if defined(AO_HAVE_test_and_set_acquire_read) + assert(AO_test_and_set_acquire_read(&z) == AO_TS_CLEAR); + assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); + assert(AO_test_and_set_acquire_read(&z) == AO_TS_SET); + AO_CLEAR(&z); +# else + MISSING(AO_test_and_set); +# endif +# if defined(AO_HAVE_fetch_and_add_acquire_read) + TA_assert(AO_fetch_and_add_acquire_read(&x, 42) == 13); + TA_assert(AO_fetch_and_add_acquire_read(&x, (AO_t)(-42)) == 55); +# else + MISSING(AO_fetch_and_add); +# endif +# if defined(AO_HAVE_fetch_and_add1_acquire_read) + TA_assert(AO_fetch_and_add1_acquire_read(&x) == 13); +# else + MISSING(AO_fetch_and_add1); + ++x; +# endif +# if defined(AO_HAVE_fetch_and_sub1_acquire_read) + TA_assert(AO_fetch_and_sub1_acquire_read(&x) == 14); +# else + MISSING(AO_fetch_and_sub1); + --x; +# endif +# if defined(AO_HAVE_short_store_acquire_read) + AO_short_store_acquire_read(&s, 13); +# else +# if !defined(AO_HAVE_short_store) || !defined(AO_HAVE_short_store_full) \ + || !defined(AO_HAVE_short_store_release) \ + || !defined(AO_HAVE_short_store_release_write) \ + || !defined(AO_HAVE_short_store_write) + MISSING(AO_short_store); +# endif + s = 13; +# endif +# if defined(AO_HAVE_short_load_acquire_read) + TA_assert(AO_short_load(&s) == 13); +# elif !defined(AO_HAVE_short_load) || !defined(AO_HAVE_short_load_acquire) \ + || !defined(AO_HAVE_short_load_acquire_read) \ + || !defined(AO_HAVE_short_load_dd_acquire_read) \ + || !defined(AO_HAVE_short_load_full) \ + || !defined(AO_HAVE_short_load_read) + MISSING(AO_short_load); +# endif +# if defined(AO_HAVE_short_fetch_and_add_acquire_read) + TA_assert(AO_short_fetch_and_add_acquire_read(&s, 42) == 13); + TA_assert(AO_short_fetch_and_add_acquire_read(&s, (unsigned short)-42) == 55); +# else + MISSING(AO_short_fetch_and_add); +# endif +# if defined(AO_HAVE_short_fetch_and_add1_acquire_read) + TA_assert(AO_short_fetch_and_add1_acquire_read(&s) == 13); +# else + MISSING(AO_short_fetch_and_add1); + ++s; +# endif +# if defined(AO_HAVE_short_fetch_and_sub1_acquire_read) + TA_assert(AO_short_fetch_and_sub1_acquire_read(&s) == 14); +# else + MISSING(AO_short_fetch_and_sub1); + --s; +# endif +# if defined(AO_HAVE_char_store_acquire_read) + AO_char_store_acquire_read(&b, 13); +# else +# if !defined(AO_HAVE_char_store) || !defined(AO_HAVE_char_store_full) \ + || !defined(AO_HAVE_char_store_release) \ + || !defined(AO_HAVE_char_store_release_write) \ + || !defined(AO_HAVE_char_store_write) + MISSING(AO_char_store); +# endif + b = 13; +# endif +# if defined(AO_HAVE_char_load_acquire_read) + TA_assert(AO_char_load(&b) == 13); +# elif !defined(AO_HAVE_char_load) || !defined(AO_HAVE_char_load_acquire) \ + || !defined(AO_HAVE_char_load_acquire_read) \ + || !defined(AO_HAVE_char_load_dd_acquire_read) \ + || !defined(AO_HAVE_char_load_full) || !defined(AO_HAVE_char_load_read) + MISSING(AO_char_load); +# endif +# if defined(AO_HAVE_char_fetch_and_add_acquire_read) + TA_assert(AO_char_fetch_and_add_acquire_read(&b, 42) == 13); + TA_assert(AO_char_fetch_and_add_acquire_read(&b, (unsigned char)-42) == 55); +# else + MISSING(AO_char_fetch_and_add); +# endif +# if defined(AO_HAVE_char_fetch_and_add1_acquire_read) + TA_assert(AO_char_fetch_and_add1_acquire_read(&b) == 13); +# else + MISSING(AO_char_fetch_and_add1); + ++b; +# endif +# if defined(AO_HAVE_char_fetch_and_sub1_acquire_read) + TA_assert(AO_char_fetch_and_sub1_acquire_read(&b) == 14); +# else + MISSING(AO_char_fetch_and_sub1); + --b; +# endif +# if defined(AO_HAVE_int_store_acquire_read) + AO_int_store_acquire_read(&zz, 13); +# else +# if !defined(AO_HAVE_int_store) || !defined(AO_HAVE_int_store_full) \ + || !defined(AO_HAVE_int_store_release) \ + || !defined(AO_HAVE_int_store_release_write) \ + || !defined(AO_HAVE_int_store_write) + MISSING(AO_int_store); +# endif + zz = 13; +# endif +# if defined(AO_HAVE_int_load_acquire_read) + TA_assert(AO_int_load(&zz) == 13); +# elif !defined(AO_HAVE_int_load) || !defined(AO_HAVE_int_load_acquire) \ + || !defined(AO_HAVE_int_load_acquire_read) \ + || !defined(AO_HAVE_int_load_dd_acquire_read) \ + || !defined(AO_HAVE_int_load_full) || !defined(AO_HAVE_int_load_read) + MISSING(AO_int_load); +# endif +# if defined(AO_HAVE_int_fetch_and_add_acquire_read) + TA_assert(AO_int_fetch_and_add_acquire_read(&zz, 42) == 13); + TA_assert(AO_int_fetch_and_add_acquire_read(&zz, (unsigned int)-42) == 55); +# else + MISSING(AO_int_fetch_and_add); +# endif +# if defined(AO_HAVE_int_fetch_and_add1_acquire_read) + TA_assert(AO_int_fetch_and_add1_acquire_read(&zz) == 13); +# else + MISSING(AO_int_fetch_and_add1); + ++zz; +# endif +# if defined(AO_HAVE_int_fetch_and_sub1_acquire_read) + TA_assert(AO_int_fetch_and_sub1_acquire_read(&zz) == 14); +# else + MISSING(AO_int_fetch_and_sub1); + --zz; +# endif +# if defined(AO_HAVE_compare_and_swap_acquire_read) + TA_assert(!AO_compare_and_swap_acquire_read(&x, 14, 42)); + TA_assert(x == 13); + TA_assert(AO_compare_and_swap_acquire_read(&x, 13, 42)); + TA_assert(x == 42); +# else + MISSING(AO_compare_and_swap); + if (x == 13) x = 42; +# endif +# if defined(AO_HAVE_or_acquire_read) + AO_or_acquire_read(&x, 66); + TA_assert(x == 106); +# else + MISSING(AO_or); + x |= 66; +# endif +# if defined(AO_HAVE_xor_acquire_read) + AO_xor_acquire_read(&x, 181); + TA_assert(x == 223); +# else + MISSING(AO_xor); + x ^= 181; +# endif +# if defined(AO_HAVE_and_acquire_read) + AO_and_acquire_read(&x, 57); + TA_assert(x == 25); +# else + MISSING(AO_and); + x &= 57; +# endif +# if defined(AO_HAVE_fetch_compare_and_swap_acquire_read) + TA_assert(AO_fetch_compare_and_swap_acquire_read(&x, 14, 117) == 25); + TA_assert(x == 25); + TA_assert(AO_fetch_compare_and_swap_acquire_read(&x, 25, 117) == 25); + TA_assert(x == 117); +# else + MISSING(AO_fetch_compare_and_swap); + if (x == 25) x = 117; +# endif +# if defined(AO_HAVE_double_load_acquire_read) + old_w.AO_val1 = 3316; + old_w.AO_val2 = 2921; + new_w = AO_double_load_acquire_read(&old_w); + TA_assert(new_w.AO_val1 == 3316 && new_w.AO_val2 == 2921); +# elif !defined(AO_HAVE_double_load) \ + || !defined(AO_HAVE_double_load_acquire) \ + || !defined(AO_HAVE_double_load_acquire_read) \ + || !defined(AO_HAVE_double_load_dd_acquire_read) \ + || !defined(AO_HAVE_double_load_full) \ + || !defined(AO_HAVE_double_load_read) + MISSING(AO_double_load); +# endif +# if defined(AO_HAVE_double_store_acquire_read) + new_w.AO_val1 = 1375; + new_w.AO_val2 = 8243; + AO_double_store_acquire_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + AO_double_store_acquire_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 1375 && old_w.AO_val2 == 8243); + new_w.AO_val1 ^= old_w.AO_val1; + new_w.AO_val2 ^= old_w.AO_val2; + AO_double_store_acquire_read(&old_w, new_w); + TA_assert(old_w.AO_val1 == 0 && old_w.AO_val2 == 0); +# elif !defined(AO_HAVE_double_store) \ + || !defined(AO_HAVE_double_store_full) \ + || !defined(AO_HAVE_double_store_release) \ + || !defined(AO_HAVE_double_store_release_write) \ + || !defined(AO_HAVE_double_store_write) + MISSING(AO_double_store); +# endif +# if defined(AO_HAVE_compare_double_and_swap_double_acquire_read) + TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 0, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 12, 14, 64, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 11, 13, 85, 82)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_double_and_swap_double_acquire_read(&w, 13, 12, 17, 42)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 12, 13, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_double_and_swap_double_acquire_read(&w, 17, 42, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_double_and_swap_double); +# endif +# if defined(AO_HAVE_compare_and_swap_double_acquire_read) + TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 17, 12, 13)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_compare_and_swap_double_acquire_read(&w, 0, 12, 13)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 13, 12, 33)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(!AO_compare_and_swap_double_acquire_read(&w, 1213, 48, 86)); + TA_assert(w.AO_val1 == 12 && w.AO_val2 == 13); + TA_assert(AO_compare_and_swap_double_acquire_read(&w, 12, 17, 42)); + TA_assert(w.AO_val1 == 17 && w.AO_val2 == 42); + TA_assert(AO_compare_and_swap_double_acquire_read(&w, 17, 0, 0)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_compare_and_swap_double); +# endif +# if defined(AO_HAVE_double_compare_and_swap_acquire_read) + old_w.AO_val1 = 4116; + old_w.AO_val2 = 2121; + new_w.AO_val1 = 8537; + new_w.AO_val2 = 6410; + TA_assert(!AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); + TA_assert(AO_double_compare_and_swap_acquire_read(&w, w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = 29; + new_w.AO_val1 = 820; + new_w.AO_val2 = 5917; + TA_assert(!AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = 11; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 3552; + new_w.AO_val2 = 1746; + TA_assert(!AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 8537; + new_w.AO_val1 = 4116; + new_w.AO_val2 = 2121; + TA_assert(!AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 8537 && w.AO_val2 == 6410); + old_w.AO_val1 = old_w.AO_val2; + old_w.AO_val2 = 6410; + new_w.AO_val1 = 1; + TA_assert(AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 1 && w.AO_val2 == 2121); + old_w.AO_val1 = new_w.AO_val1; + old_w.AO_val2 = w.AO_val2; + new_w.AO_val1--; + new_w.AO_val2 = 0; + TA_assert(AO_double_compare_and_swap_acquire_read(&w, old_w, new_w)); + TA_assert(w.AO_val1 == 0 && w.AO_val2 == 0); +# else + MISSING(AO_double_compare_and_swap); +# endif +}