platform/upstream/libatomic_ops.git
7 years agoAdd configure --enable-gcov option (enable code coverage analysis)
Ivan Maidanski [Fri, 13 Jan 2017 17:47:35 +0000 (20:47 +0300)]
Add configure --enable-gcov option (enable code coverage analysis)

* configure.ac (gcov): New --enable-* option.
* configure.ac [enable_gcov] (CFLAGS): Add "--coverage" option; filter
out "-O" options.

7 years ago.gitignore: Ignore gcov c/h output files
Ivan Maidanski [Fri, 13 Jan 2017 17:31:12 +0000 (20:31 +0300)]
.gitignore: Ignore gcov c/h output files

7 years agoFix 'atomic_load/store symbols undefined' error on OS X 10.8 i386
Ivan Maidanski [Thu, 12 Jan 2017 20:36:18 +0000 (23:36 +0300)]
Fix 'atomic_load/store symbols undefined' error on OS X 10.8 i386

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__]: Include AvailabilityMacros.h
unless MAC_OS_X_VERSION_MIN_REQUIRED already defined.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& !__x86_64__ && __APPLE__ && __MACH__
&& MAC_OS_X_VERSION_MIN_REQUIRED < 1090] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define.

7 years agoFix AO_stack build failure on OS X 10.7 because of missing CAS (x86)
Ivan Maidanski [Wed, 28 Dec 2016 23:02:27 +0000 (02:02 +0300)]
Fix AO_stack build failure on OS X 10.7 because of missing CAS (x86)
(fix commit 7a6a7cc)

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__] (AO_GCC_FORCE_HAVE_CAS): Define also for arch i386;
refine comment.

7 years agoFix AO_stack build failure on OS X 10.7 because of missing CAS (x86_64)
Ivan Maidanski [Wed, 28 Dec 2016 20:43:05 +0000 (23:43 +0300)]
Fix AO_stack build failure on OS X 10.7 because of missing CAS (x86_64)

Issue #23 (libatomic_ops).

* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__ && __x86_64__] (AO_GCC_FORCE_HAVE_CAS): Define (to
workaround missing __GCC_HAVE_SYNC_COMPARE_AND_SWAP_<n> predefined
macro in Apple clang-425/x86_64); add comment.

7 years ago.gitignore: Properly ignore sym-linked folders of code analysis tools
Ivan Maidanski [Wed, 14 Dec 2016 16:29:58 +0000 (19:29 +0300)]
.gitignore: Properly ignore sym-linked folders of code analysis tools
(fix commit fa3ebc3)

7 years ago.gitignore: Ignore folders and files of static code analysis tools
Ivan Maidanski [Mon, 12 Dec 2016 21:46:56 +0000 (00:46 +0300)]
.gitignore: Ignore folders and files of static code analysis tools

7 years agoSupport CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)
Ivan Maidanski [Fri, 9 Dec 2016 21:31:25 +0000 (00:31 +0300)]
Support CFLAGS_EXTRA to pass extra user-defined compiler flags (configure)

* configure.ac: Add AC_SUBST(CFLAGS_EXTRA).
* src/Makefile.am (CFLAGS): Append $(CFLAGS_EXTRA).
* tests/Makefile.am (CFLAGS): Likewise.

7 years agoTravis CI configuration: turn on assertion checking
Ivan Maidanski [Wed, 7 Dec 2016 23:00:12 +0000 (02:00 +0300)]
Travis CI configuration: turn on assertion checking

7 years agoEliminate 'printf format specifies type void*' GCC pedantic warnings
Ivan Maidanski [Wed, 7 Dec 2016 09:35:47 +0000 (12:35 +0300)]
Eliminate 'printf format specifies type void*' GCC pedantic warnings

This commit also eliminates 'cast from pointer to integer' compiler
warnings and '32-bit value shift followed by expansion to 64-bit'
static analysis tool warning.

* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_malloc, AO_free):
Use %p (instead of %x) format specifier to print pthread_self() value
(and cast pthread_self() to void*).
* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_malloc): Cast result+1
to void* (to match %p printf format specifier).
* src/atomic_ops_malloc.c [AO_TRACE_MALLOC] (AO_free): Use "UL" suffix
for 1 and remove the cast to unsigned long (instead of performing left
shift of an integer value and extending the result to unsigned long).

7 years agoWorkaround 'uninitialized memory use' MemorySanitizer warning (test_atomic)
Ivan Maidanski [Mon, 5 Dec 2016 17:26:16 +0000 (20:26 +0300)]
Workaround 'uninitialized memory use' MemorySanitizer warning (test_atomic)

* tests/test_atomic_include.template (test_atomicXX): Ensure old_w is
always initialized before AO_double_storeXX; add comment about MSan
false warning.

7 years agoUpdate ChangeLog file
Ivan Maidanski [Sat, 26 Nov 2016 18:58:00 +0000 (21:58 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.4 changes)
Ivan Maidanski [Sat, 26 Nov 2016 18:49:24 +0000 (21:49 +0300)]
Update ChangeLog file (v7.4 changes)

7 years agoWorkaround a bug in double-wide intrinsics of Clang/x64 with ASan enabled
Ivan Maidanski [Thu, 24 Nov 2016 17:13:06 +0000 (20:13 +0300)]
Workaround a bug in double-wide intrinsics of Clang/x64 with ASan enabled

As of clang-3.8, double-wide arguments are incorrectly passed to
atomic intrinsic operations for x64 target if Address Sanitizer is
enabled.

* src/atomic_ops.h [__has_feature(address_sanitizer)]
(AO_ADDRESS_SANITIZER): New internal macro.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && __x86_64__ && !__ILP32__]
(AO_SKIPATOMIC_double_compare_and_swap_ANY, AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define also if AO_ADDRESS_SANITIZER;
update comment.

7 years agoCode refactoring of Clang double-wide intrinsic workarounds (gcc/x86)
Ivan Maidanski [Wed, 23 Nov 2016 10:55:00 +0000 (13:55 +0300)]
Code refactoring of Clang double-wide intrinsic workarounds (gcc/x86)
(fix commits 9803386, f6a1b68, eb6d4fd)

* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE
&& !AO_HAVE_double_store] (AO_double_store): Do not define if
AO_SKIPATOMIC_double_store.
* src/atomic_ops/sysdeps/gcc/generic.h [AO_HAVE_DOUBLE_PTR_STORAGE
&& !AO_HAVE_double_store_release] (AO_double_store_release): Do not
define if AO_SKIPATOMIC_double_load.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& __clang__ && !__x86_64__ && !__APPLE_CC__ && !__CYGWIN__
&& !AO_PREFER_BUILTIN_ATOMICS] (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire, AO_SKIPATOMIC_double_store,
AO_SKIPATOMIC_double_store_release): Define internal macro (undefined
at the end of file).
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET
&& (__clang__ && !__x86_64__ && !__APPLE_CC__ && !__CYGWIN__
&& !AO_PREFER_BUILTIN_ATOMICS) || (__APPLE_CC__ && __x86_64__))]
(AO_SKIPATOMIC_double_compare_and_swap_ANY): Move definition here
(remove at other places in this file); undefine at the end of the file.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET]: Check
AO_SKIPATOMIC_double_compare_and_swap_ANY instead of checking multiple
macros to detect whether a workaround for the CAS (and others)
double-wide operations is needed.

7 years agoUndefine internal macros that are defined solely for generic.h
Ivan Maidanski [Wed, 23 Nov 2016 17:02:39 +0000 (20:02 +0300)]
Undefine internal macros that are defined solely for generic.h
(fix commits 03a0465f3c52619c66f7a4d3)

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire): Undefine at the end of file.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_SKIPATOMIC_ANY_and_ANY,
AO_SKIPATOMIC_ANY_or_ANY, AO_SKIPATOMIC_ANY_xor_ANY,
AO_SKIPATOMIC_char_store, AO_SKIPATOMIC_char_store_release,
AO_SKIPATOMIC_int_store, AO_SKIPATOMIC_int_store_release,
AO_SKIPATOMIC_short_store, AO_SKIPATOMIC_short_store_release,
AO_SKIPATOMIC_store, AO_SKIPATOMIC_store_release): Likewise.

7 years agoFix GCC -Wpedantic checking in configure
Ivan Maidanski [Tue, 22 Nov 2016 01:48:41 +0000 (04:48 +0300)]
Fix GCC -Wpedantic checking in configure
(fix commit 96a8fd9)

* configure.ac [GCC] (ac_cv_cc_pedantic): Compile code that contains
"extern int quiet" (since the translation unit cannot be empty).

7 years agoReport gcc/clang pedantic warnings (configure)
Ivan Maidanski [Tue, 22 Nov 2016 01:18:08 +0000 (04:18 +0300)]
Report gcc/clang pedantic warnings (configure)

* configure.ac [GCC] (WPEDANTIC): New variable (set to
"-Wpedantic -Wno-long-long" if supported by the compiler).
* configure.ac [GCC] (CFLAGS): Add $WPEDANTIC.

7 years agoRefine AO_nop_write comment for ARM big.LITTLE architecture
Ivan Maidanski [Fri, 18 Nov 2016 15:22:00 +0000 (18:22 +0300)]
Refine AO_nop_write comment for ARM big.LITTLE architecture

* src/atomic_ops/sysdeps/gcc/arm.h [!AO_UNIPROCESSOR && AO_ARM_HAVE_DMB
&& !AO_PREFER_BUILTIN_ATOMICS] (AO_nop_write): Refine comment about
"dmb ishst" for big.LITTLE architecture.

7 years agoFix powerpc detection on AIX (gcc)
Tobias Leich [Thu, 17 Nov 2016 22:05:42 +0000 (01:05 +0300)]
Fix powerpc detection on AIX (gcc)

GCC/powerpc-ibm-aix does not define any of __powerpc__, __ppc__,
__PPC__, __powerpc64__, __ppc64__; but it does define _ARCH_PPC (and
_POWER).

* src/atomic_ops.h [_ARCH_PPC]: Include gcc/powerpc.h.

7 years agoDo not define print_list() unless used (tests)
Ivan Maidanski [Mon, 14 Nov 2016 20:09:57 +0000 (23:09 +0300)]
Do not define print_list() unless used (tests)

* tests/test_malloc.c (print_list): Define only if DEBUG_RUN_ONE_TEST.
* tests/test_stack.c (print_list): Define only if VERBOSE.

7 years agoFix indentation of #endif in s390.h
Ivan Maidanski [Sat, 12 Nov 2016 06:47:57 +0000 (09:47 +0300)]
Fix indentation of #endif in s390.h
(fix commit c2edeab)

* src/atomic_ops/sysdeps/gcc/s390.h (AO_fetch_compare_and_swap_full):
Adjust indentation of #endif.

7 years agoUpdate AUTHORS file (add 'Tobias Leich')
Ivan Maidanski [Thu, 10 Nov 2016 09:28:35 +0000 (12:28 +0300)]
Update AUTHORS file (add 'Tobias Leich')

7 years agoImplement fetch-CAS for s390[x] (gcc)
Tobias Leich [Thu, 10 Nov 2016 08:02:56 +0000 (09:02 +0100)]
Implement fetch-CAS for s390[x] (gcc)

* src/atomic_ops/sysdeps/gcc/s390.h (AO_compare_and_swap_full): Do not
define if AO_GENERALIZE_ASM_BOOL_CAS.
* src/atomic_ops/sysdeps/gcc/s390.h (AO_fetch_compare_and_swap_full):
Implement; remove TODO item.

7 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 8 Nov 2016 17:24:53 +0000 (20:24 +0300)]
Update ChangeLog file

7 years agoUpdate ChangeLog file (v7.4 changes)
Ivan Maidanski [Tue, 8 Nov 2016 06:04:28 +0000 (09:04 +0300)]
Update ChangeLog file (v7.4 changes)

7 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Fri, 4 Nov 2016 21:34:00 +0000 (00:34 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)
(Cherry-pick commit 03a1704 from 'release-7_4' branch.)

7 years agoRemove spaces at EOLn in asm code
Ivan Maidanski [Tue, 8 Nov 2016 05:31:21 +0000 (08:31 +0300)]
Remove spaces at EOLn in asm code

* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_test_and_set,
AO_compare_and_swap, AO_fetch_compare_and_swap): Remove spaces
preceding "\n".
* src/atomic_ops/sysdeps/gcc/mips.h (AO_nop_full, AO_fetch_and_add,
AO_test_and_set, AO_compare_and_swap): Likewise.
* src/atomic_ops/sysdeps/gcc/hexagon.h (AO_fetch_and_add,
AO_test_and_set, AO_fetch_compare_and_swap): Align comments.

7 years agoFix (improve) AO_REQUIRE_CAS description in README
Ivan Maidanski [Wed, 2 Nov 2016 08:15:15 +0000 (11:15 +0300)]
Fix (improve) AO_REQUIRE_CAS description in README

* doc/README.txt: Document AO_REQUIRE_CAS better (replace
"compare-and-swap" with "AO_compare_and_swap*").

7 years agoAdd *_and/or/xor* and *_[fetch_]compare_and_swap* tests to test_atomic
Ivan Maidanski [Tue, 1 Nov 2016 09:18:33 +0000 (12:18 +0300)]
Add *_and/or/xor* and *_[fetch_]compare_and_swap* tests to test_atomic

Previously, only AO_and/or/xor and AO_[fetch]_CAS tests (for AO_t)
existed in test_atomic.

* tests/test_atomic_include.template (test_atomicXX): Add minimal
testing of AO_short_compare_and_swapXX, AO_short_orXX, AO_short_xorXX,
AO_short_andXX, AO_short_fetch_compare_and_swapXX,
AO_char_compare_and_swapXX, AO_char_orXX, AO_char_xorXX, AO_char_andXX,
AO_char_fetch_compare_and_swapXX, AO_int_compare_and_swapXX,
AO_int_orXX, AO_int_xorXX, AO_int_andXX,
AO_int_fetch_compare_and_swapXX.

7 years agoFix reporting about missing and/or/xor_dd_acquire_read (test_atomic)
Ivan Maidanski [Tue, 1 Nov 2016 08:25:39 +0000 (11:25 +0300)]
Fix reporting about missing and/or/xor_dd_acquire_read (test_atomic)

AO_XSIZE_and/or/xor_dd_acquire_read are meaningless and not implemented,
thus their absence is not reported in the tests.

* tests/test_atomic_include.template [!AO_HAVE_orXX] (test_atomicXX):
Do not call MISSING(AO_or) if all AO_HAVE_or* excluding
AO_HAVE_or_dd_acquire_read are not defined.
* tests/test_atomic_include.template [!AO_HAVE_xorXX] (test_atomicXX):
Do not call MISSING(AO_xor) if all AO_HAVE_xor* excluding
AO_HAVE_xor_dd_acquire_read are not defined.
* tests/test_atomic_include.template [!AO_HAVE_andXX] (test_atomicXX):
Do not call MISSING(AO_and) if all AO_HAVE_and* excluding
AO_HAVE_and_dd_acquire_read are not defined.

7 years agoFix missing double_compare_and_swap_dd_acquire_read
Ivan Maidanski [Tue, 1 Nov 2016 08:12:21 +0000 (11:12 +0300)]
Fix missing double_compare_and_swap_dd_acquire_read

This matters only if AO_double_compare_and_swap[_acquire_read] actually
defined in generalize.h too.

* src/atomic_ops/generalize.h
[!AO_HAVE_double_compare_and_swap_dd_acquire_read]
(AO_double_compare_and_swap_dd_acquire_read): Define (same as definition
as auto-generated in generalize-small.h).

7 years agoWorkaround 'value of MAP_ANON unknown' cppcheck info message
Ivan Maidanski [Wed, 26 Oct 2016 08:57:13 +0000 (11:57 +0300)]
Workaround 'value of MAP_ANON unknown' cppcheck info message
(fix commit 4c303bc)

* src/atomic_ops_malloc.c [USE_MMAP_ANON && CPPCHECK] (OPT_MAP_ANON):
Define to immediate non-zero value (taken from Linux libc) instead of
MAP_ANON (because the latter is used in ifdef).

7 years agoSuppress 'ISO C does not support __int128 type' GCC/Clang pedantic warning
Ivan Maidanski [Tue, 25 Oct 2016 08:13:05 +0000 (11:13 +0300)]
Suppress 'ISO C does not support __int128 type' GCC/Clang pedantic warning

* src/atomic_ops/sysdeps/standard_ao_double_t.h [!__ILP32__
&& (__GNUC__ >= 4.7 ||  __clang__ >= 3.6)] (double_ptr_storage): Turn
off pedantic warnings reporting (for this typedef only).

7 years agoFix test_malloc failure if CPPCHECK is defined
Ivan Maidanski [Tue, 25 Oct 2016 07:31:29 +0000 (10:31 +0300)]
Fix test_malloc failure if CPPCHECK is defined
(fix commit c1a7aad)

* src/atomic_ops_malloc.c [USE_MMAP_ANON && MAP_ANONYMOUS]
(OPT_MAP_ANON): Define to MAP_ANON (instead of 0) if CPPCHECK.

7 years agoWorkaround 'function is never used' cppcheck style warnings
Ivan Maidanski [Tue, 25 Oct 2016 07:13:35 +0000 (10:13 +0300)]
Workaround 'function is never used' cppcheck style warnings

* src/atomic_ops.h [AO_CAN_EMUL_CAS]: Include emul_cas.h also if
CPPCHECK (to define AO_store_full as AO_store_full_emulation).
* tests/test_atomic_include.template [CPPCHECK] (list_atomicXX,
char_list_atomicXX, short_list_atomicXX, int_list_atomicXX,
double_list_atomicXX): Declare function.
* tests/test_atomic_include.template test_atomicXX (test_atomicXX):
Call list_atomicXX, char_list_atomicXX, short_list_atomicXX,
int_list_atomicXX and double_list_atomicXX if CPPCHECK.

7 years agoAdd dd_acquire_read case to test_atomic
Ivan Maidanski [Mon, 24 Oct 2016 22:07:49 +0000 (01:07 +0300)]
Add dd_acquire_read case to test_atomic

* tests/Makefile.am (test_atomic_include.h): Add "_dd_acquire_read"
test generation.
* tests/test_atomic.c [!AO_NO_PTHREADS || !AO_USE_PTHREAD_DEFS] (main):
Call test_atomic_dd_acquire_read().

7 years agoHide AO_locks symbol
Ivan Maidanski [Mon, 24 Oct 2016 21:53:20 +0000 (00:53 +0300)]
Hide AO_locks symbol

* src/atomic_ops.c [!_MSC_VER && !__MINGW32__] (AO_locks): Define as
static.

7 years agoWorkaround 'value of macro is unknown' cppcheck information messages
Ivan Maidanski [Tue, 18 Oct 2016 07:44:10 +0000 (10:44 +0300)]
Workaround 'value of macro is unknown' cppcheck information messages

* src/atomic_ops_malloc.c [USE_MMAP_ANON] (OPT_MAP_ANON): Define to 0
(do not use MAP_ANONYMOUS value) if CPPCHECK.
* src/atomic_ops_malloc.c [SIZE_MAX] (AO_SIZE_MAX): Do not use SIZE_MAX
value if CPPCHECK.

7 years agoMerge branch 'ppc-aix'
Ivan Maidanski [Mon, 17 Oct 2016 05:35:43 +0000 (08:35 +0300)]
Merge branch 'ppc-aix'

7 years agoFix 'variable new value is never used' cppcheck style warning
Ivan Maidanski [Mon, 17 Oct 2016 05:22:53 +0000 (08:22 +0300)]
Fix 'variable new value is never used' cppcheck style warning

Assertion for v value after fetch_and_sub1(&v) is added.

* tests/test_atomic_include.template (test_atomicXX): Call TA_assert
for s, b, zz values after they are decremented (use volatile pointer to
avoid "condition is always true" compiler warning).

7 years agoWorkaround 'overflow in pointer subtraction' cppcheck warning
Ivan Maidanski [Mon, 17 Oct 2016 05:08:18 +0000 (08:08 +0300)]
Workaround 'overflow in pointer subtraction' cppcheck warning

* src/atomic_ops_malloc.c (AO_free): Do not perform subtraction from
"p" argument if its value is null; change type of "base" local variable
from char* to AO_t*.

7 years agoEliminate 'ISO C90 does not support long long' compiler pedantic warning
Ivan Maidanski [Tue, 11 Oct 2016 14:52:54 +0000 (17:52 +0300)]
Eliminate 'ISO C90 does not support long long' compiler pedantic warning

Long (32-bit) type is sufficient to represent time delta (duration)
in test_stack.

* tests/test_stack.c (get_msecs): Change return type from long long
to unsigned long (use lowest 32 bits of time value).
* tests/test_stack.c (main): Change type of start_time local variable
to unsigned long; remove redundant type cast.

7 years agoEliminate 'cast to long from void*' compiler warning in test_atomic
Ivan Maidanski [Wed, 12 Oct 2016 06:17:01 +0000 (09:17 +0300)]
Eliminate 'cast to long from void*' compiler warning in test_atomic

* tests/run_parallel.h (AO_PTRDIFF_T): Define to ptrdiff_t for all
targets.

7 years agoFix missing printed value names (test_stack)
Ivan Maidanski [Tue, 11 Oct 2016 14:45:01 +0000 (17:45 +0300)]
Fix missing printed value names (test_stack)

* tests/test_stack.c [VERBOSE] (main): Print value name along with the
value itself; print "ms" for time value; remove extra get_msecs() call.

7 years agoEliminate 'scope of variable can be reduced' cppcheck warning in AO_stack
Ivan Maidanski [Tue, 11 Oct 2016 07:01:35 +0000 (10:01 +0300)]
Eliminate 'scope of variable can be reduced' cppcheck warning in AO_stack

* src/atomic_ops_stack.c [AO_HAVE_compare_and_swap_double]
(AO_stack_push_release): Move local variable declaration to the inner
scope where the variable is actually used.

8 years agoUpdate AUTHORS file
Ivan Maidanski [Mon, 10 Oct 2016 20:15:06 +0000 (23:15 +0300)]
Update AUTHORS file

8 years agoSupport AIX/ppc (gcc)
Jean Girardet [Mon, 10 Oct 2016 08:04:24 +0000 (11:04 +0300)]
Support AIX/ppc (gcc)

* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_PPC_L, AO_PPC_BR_A): New
internal macros (undefined at the end of file); definition depends on
_AIX macro presence.
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire,
AO_test_and_set, AO_compare_and_swap, AO_fetch_compare_and_swap,
AO_fetch_and_add): Use AO_PPC_L for label definitions; use AO_PPC_BR_A
to specify jump target.

8 years agoCode refactoring of gcc/powerpc.h to avoid code duplication
Ivan Maidanski [Fri, 7 Oct 2016 16:27:09 +0000 (19:27 +0300)]
Code refactoring of gcc/powerpc.h to avoid code duplication

* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_PPC_LD, AO_PPC_LxARX,
AO_PPC_CMPx, AO_PPC_STxCXd, AO_PPC_LOAD_CLOBBER): New internal macros
(undefined at the end of the file).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_T_IS_INT): Move definition
upper (to have single check of __ppc64__).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_load_acquire): Use AO_PPC_LD,
AO_PPC_LOAD_CLOBBER (and eliminate code duplication).
* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_test_and_set,
AO_compare_and_swap, AO_fetch_compare_and_swap, AO_fetch_and_add): Use
AO_PPC_LxARX, AO_PPC_CMPx, AO_PPC_STxCXd (and eliminate code
duplication).

8 years agoFix 'visibility' of some CPU-specific internal macros
Ivan Maidanski [Thu, 6 Oct 2016 22:14:08 +0000 (01:14 +0300)]
Fix 'visibility' of some CPU-specific internal macros

Undefine internal macros that are defined and used solely in a single
CPU-specific file.

* src/atomic_ops/sysdeps/gcc/arm.h (AO_BR_ALIGN, AO_MASK_PTR,
AO_THUMB_GO_ARM, AO_THUMB_RESTORE_MODE, AO_THUMB_SWITCH_CLOBBERS):
Undefine at the end of file.
* src/atomic_ops/sysdeps/gcc/hppa.h (AO_PA_LDCW_ALIGNMENT, AO_ldcw,
AO_ldcw_align): Likewise.
* src/atomic_ops/sysdeps/gcc/ia64.h (AO_IN_ADDR, AO_LEN, AO_MASK,
AO_OUT_ADDR, AO_SWIZZLE): Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_MIPS_LL, AO_MIPS_LL_1,
AO_MIPS_SC, AO_MIPS_SET_ISA): Likewise.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_PA_LDCW_ALIGNMENT, AO_ldcw,
AO_ldcw_align): Likewise.
* src/atomic_ops/sysdeps/hpc/ia64.h (AO_T_FASIZE, AO_T_SIZE): Likewise.
* src/atomic_ops/sysdeps/icc/ia64.h (AO_INTEL_PTR_t): Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_char.h (AO_TS_SET_TRUEVAL):
Likewise.

8 years agoWorkaround '#error' cppcheck error messages
Ivan Maidanski [Wed, 5 Oct 2016 19:13:13 +0000 (22:13 +0300)]
Workaround '#error' cppcheck error messages

* src/atomic_ops.h [AO_REQUIRE_CAS && !AO_CAN_EMUL_CAS]: Skip #error
pragma if CPPCHECK.
* src/atomic_ops/generalize.h [AO_HAVE_nop_acquire]: Likewise.
* src/atomic_ops/generalize.h [AO_HAVE_nop_release]: Likewise.
* src/atomic_ops/sysdeps/armcc/arm_v6.h [__TARGET_ARCH_ARM < 6]:
Likewise.

8 years agoFix typos in 'error' pragma messages
Ivan Maidanski [Wed, 5 Oct 2016 18:47:35 +0000 (21:47 +0300)]
Fix typos in 'error' pragma messages

* src/atomic_ops.h [_HPUX_SOURCE && !__ia64] (AO_barrier_dummy):
Fix typo ("do not") in comment.
* src/atomic_ops/generalize.h [AO_HAVE_nop_acquire]: Fix typo
("do not") in #error message.
* src/atomic_ops/generalize.h [AO_HAVE_nop_release]: Likewise.
* src/atomic_ops/sysdeps/armcc/arm_v6.h [__TARGET_ARCH_ARM < 6]:
Likewise.
* src/atomic_ops/sysdeps/armcc/arm_v6.h [__TARGET_ARCH_ARM < 6]: Add
#error pragma.
* src/atomic_ops_stack.c [AO_HAVE_compare_and_swap_double]: Fix typo
("does not") in #error message.

8 years agoFix SIZET_SAT_ADD for the case of size_t is signed (SunOS 4.X)
Ivan Maidanski [Fri, 16 Sep 2016 17:45:32 +0000 (20:45 +0300)]
Fix SIZET_SAT_ADD for the case of size_t is signed (SunOS 4.X)

Negative size_t value is impossible in a correct C implementation,
but quite possible under SunOS 4.X.

* src/atomic_ops_malloc.c: Include limits.h (unless SIZE_MAX already
defined).
* src/atomic_ops_malloc.c (AO_SIZE_MAX): New macro.
* src/atomic_ops_malloc.c (SIZET_SAT_ADD): Use AO_SIZE_MAX instead of
~(size_t)0.

8 years agoWorkaround 'condition always true', 'unused stored value' cppcheck warnings
Ivan Maidanski [Wed, 24 Aug 2016 08:22:56 +0000 (11:22 +0300)]
Workaround 'condition always true', 'unused stored value' cppcheck warnings

* tests/test_atomic_include.template (test_atomicXX): Treat "x"
variable as volatile one to suppress cppcheck warning that x==13 is
always true.
* tests/test_atomic_include.template (test_atomicXX): Make
TA_assert(x==117) unconditional to suppress cppcheck warning that the
value assigned by x=117 is never used.

8 years agoFix assertions style in test_atomic_include
Ivan Maidanski [Wed, 24 Aug 2016 08:07:38 +0000 (11:07 +0300)]
Fix assertions style in test_atomic_include

Use TA_assert consistently (not assert).

* tests/test_atomic_include.template (test_atomicXX): Replace assert()
calls with TA_assert().

8 years agoEliminate 'scope of variable can be reduced' cppcheck warnings
Ivan Maidanski [Tue, 23 Aug 2016 21:50:49 +0000 (00:50 +0300)]
Eliminate 'scope of variable can be reduced' cppcheck warnings

* src/atomic_ops_malloc.c (msb): Declare "v" variable exactly in the
scope where the variable is used in.
* tests/run_parallel.h [USE_PTHREADS || USE_WINTHREADS] (run_parallel):
Declare "code" variable exactly in the scope where the variable is
used in.

8 years agoFix size value wrap around in AO_malloc_large
Ivan Maidanski [Mon, 22 Aug 2016 17:12:19 +0000 (20:12 +0300)]
Fix size value wrap around in AO_malloc_large

AO_malloc(SIZE_MAX) should return NULL now.

* src/atomic_ops_malloc.c (SIZET_SAT_ADD): New macro.
* src/atomic_ops_malloc.c (AO_malloc_large): Use SIZET_SAT_ADD to
avoid integer overflow when computing the memory size to map (i.e.,
malloc should handle arguments close to SIZE_MAX correctly).

8 years agoWorkaround a bug in double-wide CAS intrinsic of Apple clang-600/x64
Ivan Maidanski [Sat, 20 Aug 2016 15:39:25 +0000 (18:39 +0300)]
Workaround a bug in double-wide CAS intrinsic of Apple clang-600/x64

The bug causes test_stack failure.

* src/atomic_ops/sysdeps/gcc/x86.h
[AO_GCC_ATOMIC_TEST_AND_SET && __APPLE_CC__ && __x86_64__]: Fall-back
to asm-based implementation of double-wide CAS
(AO_compare_double_and_swap_double_full); add comment explaining the
reason.
* src/atomic_ops/sysdeps/gcc/x86.h
[__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 && AO_GCC_ATOMIC_TEST_AND_SET
&& __APPLE_CC__] (AO_SKIPATOMIC_double_compare_and_swap_ANY): Define.

8 years agoUse C11 double-wide atomic intrinsics for Clang/x86 on Cygwin and OS X
Ivan Maidanski [Sat, 20 Aug 2016 14:46:48 +0000 (17:46 +0300)]
Use C11 double-wide atomic intrinsics for Clang/x86 on Cygwin and OS X

Others (e.g., NDK clang/i686) still might need -latomic linker option.

* src/atomic_ops/sysdeps/gcc/x86.h
[AO_GCC_ATOMIC_TEST_AND_SET && __clang__]: Do not fallback to
non-intrinsic implementation if __APPLE_CC__ or __CYGWIN__.

8 years agoCode refactoring of int-wide primitives in gcc/x86.h
Ivan Maidanski [Sat, 20 Aug 2016 14:12:08 +0000 (17:12 +0300)]
Code refactoring of int-wide primitives in gcc/x86.h

* src/atomic_ops/sysdeps/gcc/x86.h (AO_int_fetch_and_add_full,
AO_int_and_full, AO_int_or_full, AO_int_xor_full, AO_T_IS_INT): Move
to separate 'ifdef' block (inside AO_DISABLE_GCC_ATOMICS case).

8 years agoAvoid extra nop_full in stack_pop_acquire if atomic intrinsics used (x86)
Ivan Maidanski [Thu, 18 Aug 2016 22:05:39 +0000 (01:05 +0300)]
Avoid extra nop_full in stack_pop_acquire if atomic intrinsics used (x86)

* src/atomic_ops/generalize.h [AO_HAVE_double_compare_and_swap_acquire]
(AO_compare_double_and_swap_double_acquire): Implement (by redirecting
to AO_double_compare_and_swap_acquire).
* src/atomic_ops/generalize.h [AO_HAVE_double_compare_and_swap_release]
(AO_compare_double_and_swap_double_release): Implement (by redirecting
to AO_double_compare_and_swap_release).

8 years agoAdd CI (continuous integration) badges to README
Ivan Maidanski [Thu, 18 Aug 2016 18:04:00 +0000 (21:04 +0300)]
Add CI (continuous integration) badges to README

8 years agoRefine README how to build the library source from the repository
Ivan Maidanski [Thu, 18 Aug 2016 09:10:51 +0000 (12:10 +0300)]
Refine README how to build the library source from the repository

* README.md (Installation and Usage): Add information that autogen.sh
should be launched first if building from the development repository.

8 years agoRefine README about library downloading
Ivan Maidanski [Thu, 18 Aug 2016 09:03:15 +0000 (12:03 +0300)]
Refine README about library downloading

* README.md (Download): New section; add link to Download page (located
on GitHub); add information about the code repository.

8 years agoAdd asm-based and/or/xor implementation for char/short/int (gcc/x86)
Ivan Maidanski [Thu, 18 Aug 2016 08:03:32 +0000 (11:03 +0300)]
Add asm-based and/or/xor implementation for char/short/int (gcc/x86)

* src/atomic_ops/sysdeps/gcc/x86.h [AO_DISABLE_GCC_ATOMICS]
(AO_char_and_full, AO_char_or_full, AO_char_xor_full,
AO_short_and_full, AO_short_or_full, AO_short_xor_full): New inline
function.
* src/atomic_ops/sysdeps/gcc/x86.h [AO_DISABLE_GCC_ATOMICS
&& !AO_T_IS_INT] (AO_int_and_full, AO_int_or_full, AO_int_xor_full):
Likewise.

8 years agoFix (delete) comment for AO_and_full (x86)
Ivan Maidanski [Wed, 17 Aug 2016 16:51:30 +0000 (19:51 +0300)]
Fix (delete) comment for AO_and_full (x86)

* src/atomic_ops/sysdeps/gcc/x86.h [!AO_PREFER_GENERALIZED]
(AO_and_full): Remove incorrect comment (the code should work even for
i386).
* src/atomic_ops/sysdeps/sunc/x86.h [!AO_PREFER_GENERALIZED]
(AO_and_full): Likewise.

8 years agoAdd configuration file for AppVeyor CI
Ivan Maidanski [Mon, 15 Aug 2016 19:44:10 +0000 (22:44 +0300)]
Add configuration file for AppVeyor CI

* appveyor.yml: New file (not a part of the distribution archive).

8 years agoAdd configure '--disable-atomic-intrinsics' option
Ivan Maidanski [Mon, 15 Aug 2016 17:08:56 +0000 (20:08 +0300)]
Add configure '--disable-atomic-intrinsics' option

* configure.ac (atomic-intrinsics): New configure option.
* configure.ac (AO_DISABLE_GCC_ATOMICS): Replace AH_TEMPLATE with
AC_DEFINE depending atomic-intrinsics option.

8 years agoFix store-load ordering in AO_stack_pop_explicit_aux_acquire (PowerPC)
Hans Boehm [Mon, 15 Aug 2016 08:32:33 +0000 (11:32 +0300)]
Fix store-load ordering in AO_stack_pop_explicit_aux_acquire (PowerPC)

Issue #15.

The core issue is that AO_stack_pop_explicit_aux_acquire really needs
to ensure that the store to the blacklist via
AO_compare_and_swap_acquire becomes visible before the load to check
the list head.  This effectively needs store-load ordering.
Currently the only ordering here is imposed by the _acquire on the
compare_and_swap.  On PowerPC that turns into an lwsync, which is too
weak to enforce store to load ordering.

This patch should fix the issue.  But this is suboptimal on x86, and
we may want to make the fence conditional on "not x86", where the CAS
already includes sufficient ordering.  (With C++11 atomics, this would
also be tricky and probably involve making a bunch of accesses seq_cst.)

* src/atomic_ops_stack.c [AO_USE_ALMOST_LOCK_FREE]
(AO_stack_pop_explicit_aux_acquire): Call AO_compare_and_swap instead
of AO_compare_and_swap_acquire; call AO_nop_full just before
(first != AO_load(list)).

8 years agoAdd configuration for Travis CI
Ivan Maidanski [Thu, 11 Aug 2016 19:29:46 +0000 (22:29 +0300)]
Add configuration for Travis CI

* .travis.yml: New file.

8 years agoUpdate ChangeLog file
Ivan Maidanski [Fri, 29 Jul 2016 08:08:53 +0000 (11:08 +0300)]
Update ChangeLog file

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Mon, 23 May 2016 21:41:16 +0000 (00:41 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

8 years agoAdd disclaimer to README to favor C11/C++14 atomics over libatomic_ops use
Hans Boehm [Mon, 23 May 2016 18:24:33 +0000 (21:24 +0300)]
Add disclaimer to README to favor C11/C++14 atomics over libatomic_ops use

* README.md: Add top-level disclaimer that it is better to use
C11 or C++14 atomic primitives instead of this library for the
newly-developed code.

8 years agogcc/generic-small.h: Add TODO items
Hans Boehm [Thu, 12 May 2016 20:28:36 +0000 (23:28 +0300)]
gcc/generic-small.h: Add TODO items

* src/atomic_ops/sysdeps/gcc/generic-small.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-small.template: Add TODO items
for XSIZE_load_read, XSIZE_load_full, XSIZE_load_dd_acquire_read,
XSIZE_store_write.

8 years agoRefine documentation about _full memory ordering suffix
Hans Boehm [Thu, 12 May 2016 06:21:18 +0000 (09:21 +0300)]
Refine documentation about _full memory ordering suffix

* doc/README.txt (_full): Refine documentation (regarding AO_nop_full
mostly).

8 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 11 May 2016 19:27:10 +0000 (22:27 +0300)]
Update AUTHORS file

8 years agoBasic support of TILE-Gx and TILEPro CPUs
Chris Metcalf [Wed, 11 May 2016 19:19:57 +0000 (22:19 +0300)]
Basic support of TILE-Gx and TILEPro CPUs

This patch is an updated version of the CentOS 6 patch that we have
been carrying as part of our own CentOS-like distribution since 2012.

* src/Makefile.am (nobase_private_HEADERS): Add tile.h.
* src/atomic_ops.h [__tile__]: Include tile.h file.
* src/atomic_ops/sysdeps/gcc/tile.h: New file.

8 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 26 Apr 2016 22:14:22 +0000 (01:14 +0300)]
Update ChangeLog file

8 years agoUpdate ChangeLog file (v7.2 - v7.4 changes only)
Ivan Maidanski [Tue, 26 Apr 2016 08:36:34 +0000 (11:36 +0300)]
Update ChangeLog file (v7.2 - v7.4 changes only)

8 years agoUse GCC atomic intrinsics for x86 and x64 (gcc 4.8+ and clang 3.4+)
Ivan Maidanski [Mon, 25 Apr 2016 18:26:28 +0000 (21:26 +0300)]
Use GCC atomic intrinsics for x86 and x64 (gcc 4.8+ and clang 3.4+)

* src/atomic_ops/sysdeps/gcc/generic.h (AO_GCC_HAVE_double_SYNC_CAS):
Do not define if AO_SKIPATOMIC_double_compare_and_swap_ANY.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_GCC_ATOMIC_TEST_AND_SET): Define
if gcc4.8+ (but not Intel compiler) or clang3.4+ (if not
AO_DISABLE_GCC_ATOMICS).
* src/atomic_ops/sysdeps/gcc/x86.h [AO_GCC_ATOMIC_TEST_AND_SET]: Do not
include all_aligned_atomic_load_store.h, test_and_set_t_is_char.h,
ordered_except_wr.h.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_nop_full, AO_fetch_and_add_full,
AO_char_fetch_and_add_full, AO_short_fetch_and_add_full, AO_and_full,
AO_or_full, AO_xor_full, AO_test_and_set_full,
AO_compare_and_swap_full) [AO_GCC_ATOMIC_TEST_AND_SET]: Do not define.
* src/atomic_ops/sysdeps/gcc/x86.h: Include standard_ao_double_t.h if
AO_PREFER_BUILTIN_ATOMICS, or AO_GCC_ATOMIC_TEST_AND_SET and not
clang/x86.
* src/atomic_ops/sysdeps/gcc/x86.h (AO_double_load_acquire,
AO_double_store_release, AO_SKIPATOMIC_double_compare_and_swap_ANY):
Define if AO_GCC_ATOMIC_TEST_AND_SET and clang/x86 (unless
AO_PREFER_BUILTIN_ATOMICS).
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full) [x86]: Define also for
clang/x86 if AO_GCC_ATOMIC_TEST_AND_SET (unless
AO_PREFER_BUILTIN_ATOMICS).
* src/atomic_ops/sysdeps/gcc/x86.h
(AO_compare_double_and_swap_double_full) [x86_64]: Remove TODO item;
check __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 to detect presence of
cmpxchg16b.
* src/atomic_ops/sysdeps/gcc/x86.h: Include generic.h if
AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/standard_ao_double_t.h (double_ptr_storage):
Use unsigned __int128 instead of __m128 for GCC x86_64 atomic
intrinsics.

8 years agoDo not force GCC atomic intrinsics usage if AO_PREFER_BUILTIN_ATOMICS
Ivan Maidanski [Thu, 21 Apr 2016 07:59:18 +0000 (10:59 +0300)]
Do not force GCC atomic intrinsics usage if AO_PREFER_BUILTIN_ATOMICS

The macro should only prevent usage of assembly completely but only
if at least some of GCC atomic intrinsics are available.

* src/atomic_ops/sysdeps/gcc/arm.h (AO_PREFER_BUILTIN_ATOMICS): Remove
from the condition whether to include generic.h.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_PREFER_BUILTIN_ATOMICS):
Likewise.

8 years agoAdd AO_DISABLE_GCC_ATOMICS, AO_PREFER_BUILTIN_ATOMICS macros to configure
Ivan Maidanski [Tue, 19 Apr 2016 06:23:44 +0000 (09:23 +0300)]
Add AO_DISABLE_GCC_ATOMICS, AO_PREFER_BUILTIN_ATOMICS macros to configure

* configure.ac (AO_DISABLE_GCC_ATOMICS, AO_PREFER_BUILTIN_ATOMICS):
Declare and document (using AH_TEMPLATE).

8 years agoFix typo in configure.ac (in description of AO_ASM_X64_AVAILABLE)
Ivan Maidanski [Mon, 18 Apr 2016 21:42:30 +0000 (00:42 +0300)]
Fix typo in configure.ac (in description of AO_ASM_X64_AVAILABLE)

* configure.ac (AO_ASM_X64_AVAILABLE): Fix typo ("available").

8 years agoRemove AO_T_IS_INT definition for GCC atomic intrinsics case
Ivan Maidanski [Mon, 18 Apr 2016 07:19:20 +0000 (10:19 +0300)]
Remove AO_T_IS_INT definition for GCC atomic intrinsics case
(Code refactoring)

In case of GCC/C11 atomic intrinsics are used, AO_int_* are defined in
generic-arithm.h and generic-small.h files.

* src/atomic_ops/sysdeps/gcc/arm.h (AO_T_IS_INT): Do not define if
AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_T_IS_INT): Likewise.
* src/atomic_ops/sysdeps/gcc/nios2.h (AO_T_IS_INT): Do not define.

8 years agoFix AO_TS_VAL_t used for __atomic_test_and_set (gcc)
Ivan Maidanski [Fri, 15 Apr 2016 08:00:44 +0000 (11:00 +0300)]
Fix AO_TS_VAL_t used for __atomic_test_and_set (gcc)

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_ATOMIC_TEST_AND_SET):
Remove.
* src/atomic_ops/sysdeps/gcc/mips.h [!AO_DISABLE_GCC_ATOMICS]
(AO_GCC_ATOMIC_TEST_AND_SET): Likewise.
* src/atomic_ops/sysdeps/gcc/nios2.h (AO_GCC_ATOMIC_TEST_AND_SET):
Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_SET_TRUEVAL):
Likewise.
* src/atomic_ops/sysdeps/gcc/aarch64.h: Remove include
test_and_set_t_is_ao_t.h file.
* src/atomic_ops/sysdeps/gcc/mips.h [!AO_DISABLE_GCC_ATOMICS]: Likewise.
* src/atomic_ops/sysdeps/gcc/nios2.h: Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Include test_and_set_t_is_ao_t.h
only if not AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_GCC_ATOMIC_TEST_AND_SET):
Define macro.
* src/atomic_ops/sysdeps/gcc/generic.h: Include
test_and_set_t_is_char.h file.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_val): Define
AO_TS_set to 1; update comment.

8 years agoFix typo in gcc/arm.h (ARMv6)
Ivan Maidanski [Fri, 15 Apr 2016 06:23:29 +0000 (09:23 +0300)]
Fix typo in gcc/arm.h (ARMv6)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_SKIPATOMIC_ANY_and_ANY): Fix
CPU architecture version in comment (ARMv6).

8 years agoAvoid __atomic_and/or/xor_fetch if unsupported (clang/arm-v5te)
Ivan Maidanski [Wed, 13 Apr 2016 23:19:58 +0000 (02:19 +0300)]
Avoid __atomic_and/or/xor_fetch if unsupported (clang/arm-v5te)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_SKIPATOMIC_ANY_and_ANY,
AO_SKIPATOMIC_ANY_or_ANY, AO_SKIPATOMIC_ANY_xor_ANY): Define new
internal macro (before include "generic.h") if
AO_GCC_ATOMIC_TEST_AND_SET and __clang__, and not AO_ARM_HAVE_LDREX.
* src/atomic_ops/sysdeps/gcc/generic-arithm.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-arithm.template
(AO_XSIZE_and_XBAR): Do not define if AO_SKIPATOMIC_ANY_and_ANY.
* src/atomic_ops/sysdeps/gcc/generic-arithm.template
(AO_XSIZE_or_XBAR): Do not define if AO_SKIPATOMIC_ANY_or_ANY.
* src/atomic_ops/sysdeps/gcc/generic-arithm.template
(AO_XSIZE_xor_XBAR): Do not define if AO_SKIPATOMIC_ANY_xor_ANY.

8 years agoUse GCC atomic intrinsics for ARM (gcc 4.8+ and clang 3.5+)
Ivan Maidanski [Mon, 11 Apr 2016 19:20:07 +0000 (22:20 +0300)]
Use GCC atomic intrinsics for ARM (gcc 4.8+ and clang 3.5+)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_GCC_ATOMIC_TEST_AND_SET): Define
if gcc 4.8+ or clang 3.5+ or AO_PREFER_BUILTIN_ATOMICS unless
AO_DISABLE_GCC_ATOMICS.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_write, AO_store,
AO_char_store, AO_short_store): Do not define (in assembly code) if
AO_PREFER_BUILTIN_ATOMICS.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_SKIPATOMIC_store,
AO_SKIPATOMIC_store_release, AO_SKIPATOMIC_char_store,
AO_SKIPATOMIC_char_store_release, AO_SKIPATOMIC_short_store,
AO_SKIPATOMIC_short_store_release, AO_SKIPATOMIC_int_store,
AO_SKIPATOMIC_int_store_release): Define if AO_BROKEN_TASKSWITCH_CLREX.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full, AO_test_and_set,
AO_fetch_and_add, AO_fetch_and_add1, AO_fetch_and_sub1, AO_and, AO_or,
AO_xor, AO_char_fetch_and_add, AO_short_fetch_and_add,
AO_compare_and_swap, AO_fetch_compare_and_swap, AO_double_load,
AO_double_store, AO_double_compare_and_swap, AO_test_and_set_full): Do
not define (in assembly code) if AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/arm.h: Do not include atomic_store.h,
all_atomic_only_load.h, char_atomic_store.h, short_atomic_store.h,
all_aligned_atomic_load_store.h if AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/arm.h: Include generic.h (at the end of
the file) if AO_GCC_ATOMIC_TEST_AND_SET.
* src/atomic_ops/sysdeps/gcc/generic-small.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-small.template (AO_XSIZE_store):
Do not define if AO_SKIPATOMIC_XSIZE_store.
* src/atomic_ops/sysdeps/gcc/generic-small.template
(AO_XSIZE_store_release): Do not define if
AO_SKIPATOMIC_XSIZE_store_release.

8 years agoUse GCC atomic intrinsics for MIPS (GCC 4.9+ and clang 3.5+)
Ivan Maidanski [Mon, 4 Apr 2016 21:27:50 +0000 (00:27 +0300)]
Use GCC atomic intrinsics for MIPS (GCC 4.9+ and clang 3.5+)

* src/atomic_ops/sysdeps/gcc/mips.h: Include generic.h and do not
include all_aligned_atomic_load_store.h if AO_PREFER_BUILTIN_ATOMICS or
GCC 4.9+ or clang 3.5+ unless AO_DISABLE_GCC_ATOMICS.
* src/atomic_ops/sysdeps/gcc/mips.h (AO_MIPS_SET_ISA, AO_MIPS_LL_1,
AO_MIPS_SC, AO_MIPS_LL, AO_nop_full, AO_fetch_and_add, AO_test_and_set,
AO_compare_and_swap, AO_fetch_compare_and_swap): Do not define if
generic.h included.

8 years agoImplement CAS_acquire/release/full using __atomic_compare_exchange_n (gcc)
Ivan Maidanski [Fri, 8 Apr 2016 08:29:08 +0000 (11:29 +0300)]
Implement CAS_acquire/release/full using __atomic_compare_exchange_n (gcc)

* src/atomic_ops/sysdeps/gcc/generic-small.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-small.template
(AO_XSIZE_fetch_compare_and_swap, AO_XSIZE_compare_and_swap): Use
__atomic_compare_exchange_n(RELAXED) instead of
__sync_val/bool_compare_and_swap.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_compare_and_swap):
Likewise.
* src/atomic_ops/sysdeps/gcc/generic-small.template
[AO_GCC_HAVE_XSIZE_SYNC_CAS] (AO_XSIZE_fetch_compare_and_swap_acquire,
AO_XSIZE_fetch_compare_and_swap_release,
AO_XSIZE_fetch_compare_and_swap_full): New inline function; remove
TODO item.
* src/atomic_ops/sysdeps/gcc/generic-small.template
[AO_GCC_HAVE_XSIZE_SYNC_CAS && !AO_GENERALIZE_ASM_BOOL_CAS]
(AO_XSIZE_compare_and_swap_acquire, AO_XSIZE_compare_and_swap_release,
AO_XSIZE_compare_and_swap_full): Likewise.
* src/atomic_ops/sysdeps/gcc/generic.h [AO_GCC_HAVE_double_SYNC_CAS]
(AO_double_compare_and_swap_acquire,
AO_double_compare_and_swap_release, AO_double_compare_and_swap_full):
Likewise.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_compare_and_swap_acquire):
Reformat code.

8 years agoAvoid atomic_compare_exchange_n if no __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n
Ivan Maidanski [Wed, 6 Apr 2016 08:40:45 +0000 (11:40 +0300)]
Avoid atomic_compare_exchange_n if no __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_FORCE_HAVE_CAS,
AO_GCC_HAVE_double_SYNC_CAS): Define macro before include generic.h
if __clang__ (workaround).
* src/atomic_ops/sysdeps/gcc/generic-small.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-small.template
(AO_XSIZE_fetch_compare_and_swap, AO_XSIZE_compare_and_swap): Do not
define unless AO_GCC_HAVE_XSIZE_SYNC_CAS.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_GCC_HAVE_char_SYNC_CAS,
AO_GCC_HAVE_short_SYNC_CAS, AO_GCC_HAVE_int_SYNC_CAS,
AO_GCC_HAVE_SYNC_CAS): New internal macro (based on
__GCC_HAVE_SYNC_COMPARE_AND_SWAP_<n> or AO_GCC_FORCE_HAVE_CAS presence).
* src/atomic_ops/sysdeps/gcc/generic.h (AO_GCC_HAVE_double_SYNC_CAS):
New internal macro if AO_HAVE_DOUBLE_PTR_STORAGE.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_compare_and_swap):
Check AO_GCC_HAVE_double_SYNC_CAS instead of AO_HAVE_DOUBLE_PTR_STORAGE.

8 years agoEliminate redundant lwsync 2nd call in CAS_full on fail (gcc/PowerPC)
Ivan Maidanski [Tue, 5 Apr 2016 21:10:56 +0000 (00:10 +0300)]
Eliminate redundant lwsync 2nd call in CAS_full on fail (gcc/PowerPC)

* src/atomic_ops/sysdeps/gcc/powerpc.h (AO_compare_and_swap_full,
AO_fetch_compare_and_swap_full): Do not call AO_lwsync 2nd time if
CAS is not successful.

8 years agoDefine AO_TS_SET as __GCC_ATOMIC_TEST_AND_SET_TRUEVAL if applicable
Ivan Maidanski [Mon, 4 Apr 2016 06:58:22 +0000 (09:58 +0300)]
Define AO_TS_SET as __GCC_ATOMIC_TEST_AND_SET_TRUEVAL if applicable

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_GCC_ATOMIC_TEST_AND_SET):
Define (before include test_and_set_t_is_ao_t.h).
* src/atomic_ops/sysdeps/gcc/nios2.h (AO_GCC_ATOMIC_TEST_AND_SET):
Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h: Refine comment.
* src/atomic_ops/sysdeps/test_and_set_t_is_char.h: Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_SET_TRUEVAL):
New internal macro (defined via __GCC_ATOMIC_TEST_AND_SET_TRUEVAL).
* src/atomic_ops/sysdeps/test_and_set_t_is_char.h (AO_TS_SET_TRUEVAL):
Likewise.
* src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h (AO_TS_val): Use
AO_TS_SET_TRUEVAL instead of 1.
* src/atomic_ops/sysdeps/test_and_set_t_is_char.h (AO_BYTE_TS_val):
Use AO_TS_SET_TRUEVAL instead of 0xff; reformat code.
* src/atomic_ops/sysdeps/test_and_set_t_is_char.h (AO_TS_t): Move down
(to be after AO_TS_SET).

8 years agoNew macro AO_PREFER_BUILTIN_ATOMICS to rely on C11 atomics fully (AArch64)
Ivan Maidanski [Fri, 1 Apr 2016 17:34:30 +0000 (20:34 +0300)]
New macro AO_PREFER_BUILTIN_ATOMICS to rely on C11 atomics fully (AArch64)

If AO_PREFER_BUILTIN_ATOMICS is defined then inline assembly
implementation is not used.

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_SKIPATOMIC_double_load,
AO_SKIPATOMIC_double_load_acquire): Define if AO_PREFER_BUILTIN_ATOMICS.
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_nop_write, AO_double_load,
AO_double_load_acquire, AO_double_store, AO_double_store_release,
AO_double_compare_and_swap, AO_double_compare_and_swap_acquire,
AO_double_compare_and_swap_release, AO_double_compare_and_swap_full):
Do not define if AO_PREFER_BUILTIN_ATOMICS.
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_nop_write): Add comment;
remove TODO.
* src/atomic_ops/sysdeps/gcc/generic.h: Remove TODO about including
this header for other targets.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_load): Do not define
if AO_SKIPATOMIC_double_load.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_load_acquire): Do not
define if AO_SKIPATOMIC_double_load_acquire.

8 years agoRemove obsolete information from README about C++0x standard future
Ivan Maidanski [Thu, 24 Mar 2016 20:32:39 +0000 (23:32 +0300)]
Remove obsolete information from README about C++0x standard future

* doc/README.txt (Future directions): Remove.

8 years agoUpdate ChangeLog file
Ivan Maidanski [Thu, 17 Mar 2016 08:29:13 +0000 (11:29 +0300)]
Update ChangeLog file

8 years agoUpdate ChangeLog file (v7.4 changes)
Ivan Maidanski [Thu, 17 Mar 2016 08:21:18 +0000 (11:21 +0300)]
Update ChangeLog file (v7.4 changes)

8 years agoUpdate ChangeLog file
Ivan Maidanski [Thu, 17 Mar 2016 07:23:42 +0000 (10:23 +0300)]
Update ChangeLog file
(v7.2 - v7.4 changes only)

8 years agoUpdate AUTHORS file
Ivan Maidanski [Tue, 15 Mar 2016 07:11:05 +0000 (10:11 +0300)]
Update AUTHORS file

8 years agoAdd initial nios2 architecture support
Marek Vasut [Tue, 15 Mar 2016 07:09:26 +0000 (10:09 +0300)]
Add initial nios2 architecture support

* src/Makefile.am (nobase_private_HEADERS): Add nios2.h.
* src/atomic_ops.h: Include nios2.h if __nios2__.
* src/atomic_ops/sysdeps/gcc/nios2.h: New file.