platform/upstream/libatomic_ops.git
11 years agoMerge remote-tracking branch 'origin/master' into add-aarch64-support
Ivan Maidanski [Thu, 28 Feb 2013 18:40:01 +0000 (22:40 +0400)]
Merge remote-tracking branch 'origin/master' into add-aarch64-support

11 years agoMinimize gcc/generic-arithm template by factoring out barriers
Ivan Maidanski [Thu, 28 Feb 2013 18:38:25 +0000 (22:38 +0400)]
Minimize gcc/generic-arithm template by factoring out barriers
(code refactoring)

* src/Makefile.am (atomic_ops/sysdeps/gcc/generic-arithm.h): Iterate
over XBAR/XGCCBAR (in addition to XSIZE/XCTYPE).
* src/atomic_ops/sysdeps/gcc/generic-arithm.template: Parametrize all
primitives with XBAR (replacing AO none/acquire/release/full barriers)
and with XGCCBAR (replacing GCC atomic RELAXED/ACQUIRE/RELEASE/SEQ_CST
barriers, respectively).
* src/atomic_ops/sysdeps/gcc/generic-arithm.h: Regenerate.

11 years agoImplement char/short/int-wide primitives using GCC built-in atomic/sync
Ivan Maidanski [Thu, 28 Feb 2013 17:55:48 +0000 (21:55 +0400)]
Implement char/short/int-wide primitives using GCC built-in atomic/sync

* src/Makefile.am (EXTRA_DIST): Add gcc/generic-arithm.template,
gcc/generic-small.template entries.
* src/Makefile.am (nobase_private_HEADERS): Move gcc/generic-arithm.h,
atomic_ops/sysdeps/gcc/generic-small.h to BUILT_SOURCES.
* src/Makefile.am (atomic_ops/sysdeps/gcc/generic-arithm.h,
atomic_ops/sysdeps/gcc/generic-small.h): New rules (to generate
AO_char/short/int_X primitives included from gcc/generic.h file.
* src/atomic_ops/sysdeps/gcc/generic-arithm.template: New template
file (based on code moved from generic-arithm.h).
* src/atomic_ops/sysdeps/gcc/generic-small.template: New template file
(based on code moved from generic-small.h).
* src/atomic_ops/sysdeps/gcc/generic-arithm.h: Regenerate.
* src/atomic_ops/sysdeps/gcc/generic-small.h: Likewise.

11 years agoMove gcc-generic AO_t-wide primitives to generic-small/arithm headers
Ivan Maidanski [Thu, 28 Feb 2013 17:17:48 +0000 (21:17 +0400)]
Move gcc-generic AO_t-wide primitives to generic-small/arithm headers
(code refactoring)

* src/atomic_ops/sysdeps/gcc/generic-small.h: New file.
* src/atomic_ops/sysdeps/gcc/generic-arithm.h: Likewise.
* src/atomic_ops/sysdeps/gcc/generic.h: Include generic-small.h file.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_load, AO_load_acquire,
AO_store, AO_store_release, AO_fetch_compare_and_swap,
AO_compare_and_swap): Move to generic-small.h file.
* src/atomic_ops/sysdeps/gcc/generic.h: Include generic-arithm.h file
unless AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_fetch_and_add,
AO_fetch_and_add_acquire, AO_fetch_and_add_release,
AO_fetch_and_add_full, AO_and, AO_and_acquire, AO_and_release,
AO_and_full, AO_or, AO_or_acquire, AO_or_release, AO_or_full, AO_xor,
AO_xor_acquire, AO_xor_release, AO_xor_full): Move to generic-arithm.h
file.
* src/Makefile.am (nobase_private_HEADERS): Add gcc/generic-arithm.h,
gcc/generic-small.h entries.

11 years agoDefine nop_write as 'dmb st' for AArch64
Ivan Maidanski [Thu, 28 Feb 2013 15:46:58 +0000 (19:46 +0400)]
Define nop_write as 'dmb st' for AArch64

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_nop_write): Define via asm
(dmb st) statement unless AO_UNIPROCESSOR (because it seems there is
no equivalent definition using compiler __atomic_thread_fence).
* src/atomic_ops/sysdeps/gcc/generic.h (AO_nop_write): Do not define
if already is.

11 years agoFix AO_double_t definition for AArch64
Ivan Maidanski [Thu, 28 Feb 2013 15:35:01 +0000 (19:35 +0400)]
Fix AO_double_t definition for AArch64

* src/atomic_ops/sysdeps/standard_ao_double_t.h (double_ptr_storage):
Define explicitly for AArch64 (use __int128 instead of long long).

11 years agoFix double_compare_and_swap compile-time error in gcc/generic.h
Yvan Roux [Thu, 28 Feb 2013 14:55:27 +0000 (18:55 +0400)]
Fix double_compare_and_swap compile-time error in gcc/generic.h

* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_compare_and_swap):
Fix access to old_val value.

11 years agoRemove improper comment for AO_XSIZE_load_read
Ivan Maidanski [Thu, 28 Feb 2013 04:46:00 +0000 (08:46 +0400)]
Remove improper comment for AO_XSIZE_load_read

* src/atomic_ops/generalize-small.template (AO_XSIZE_load_read):
Remove improper comment (because nop barrier type matches that of
load primitive).
* src/atomic_ops/generalize-small.template (AO_XSIZE_store_write):
Reorder AO_HAVE_nop_write and AO_HAVE_XSIZE_store checking (to match
that for other primitives in this file).
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoImplement AO_and/or/xor efficiently for ARM
Ivan Maidanski [Thu, 14 Feb 2013 16:34:05 +0000 (20:34 +0400)]
Implement AO_and/or/xor efficiently for ARM

* src/atomic_ops/sysdeps/gcc/arm.h (AO_and, AO_or, AO_xor): Implement
directly using LDREX/STREX (enabled only if not AO_PREFER_GENERALIZED).

11 years agoAdd compile-time assertion for size of 'standard' AO_double_t
Ivan Maidanski [Thu, 14 Feb 2013 15:37:25 +0000 (19:37 +0400)]
Add compile-time assertion for size of 'standard' AO_double_t

* src/atomic_ops/sysdeps/standard_ao_double_t.h
(AO_double_t_size_static_assert): Add compile-time assertion for
AO_double_t size.

11 years agoFix (remove) invalid include of read_ordered.h for ARM
Ivan Maidanski [Thu, 14 Feb 2013 10:08:47 +0000 (14:08 +0400)]
Fix (remove) invalid include of read_ordered.h for ARM
(fix commit 2df9c1e partially)

* src/atomic_ops/sysdeps/gcc/arm.h: Do not include read_ordered.h
(because load_acquire should contain a DMB instruction in a multi-core
case, new load_acquire/read primitives implementation is generalized
using nop_full/read which either contain a DMB instruction, or is just
a compiler barrier for uniprocessor).
* src/atomic_ops/sysdeps/armcc/arm_v6.h: Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h: Likewise.

11 years agoRevert "Fix read_ordered.h inclusion for ARM"
Ivan Maidanski [Thu, 14 Feb 2013 09:59:38 +0000 (10:59 +0100)]
Revert "Fix read_ordered.h inclusion for ARM"
(because it makes load_acquire/read incorrect for multi-core ARM)

This reverts commit fcc838be49c98486c26738764f895d34de0716be.

11 years agoImplement load/store via simple LDR/STR for ARMv6+ (msftc)
Ivan Maidanski [Thu, 14 Feb 2013 08:04:19 +0000 (12:04 +0400)]
Implement load/store via simple LDR/STR for ARMv6+ (msftc)

* src/atomic_ops/sysdeps/msftc/arm.h: Include
all_aligned_atomic_load_store.h instead of all_atomic_load_store.h
(since unaligned accesses are not guaranteed to be atomic).
* src/atomic_ops/sysdeps/msftc/arm.h (AO_load): Remove; include
all_aligned_atomic_load_store.h unconditionally instead (thus
implementing AO[_char/short]_load/store via simple LDR/STR; add
comment about Windows interrupt handlers.
* src/atomic_ops/sysdeps/msftc/arm.h: Add TODO item to implement
AO_test_and_set_full (for pre-ARMv6).

11 years agoDefine AO_nop_full as compiler barrier for pre-ARMv6 single-core case
Ivan Maidanski [Thu, 14 Feb 2013 07:36:06 +0000 (11:36 +0400)]
Define AO_nop_full as compiler barrier for pre-ARMv6 single-core case

* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full): Define for pre-ARMv6
as well (as a compiler barrier) if AO_UNIPROCESSOR; refine comment.
* src/atomic_ops/sysdeps/msftc/arm.h (AO_nop_full): Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h: Eliminate duplicated include of
test_and_set_t_is_ao_t.h.

11 years agoUse __atomic GCC built-in to implement generic double-wide CAS
Ivan Maidanski [Tue, 12 Feb 2013 21:17:36 +0000 (01:17 +0400)]
Use __atomic GCC built-in to implement generic double-wide CAS

* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_compare_and_swap):
Implement using __atomic_compare_exchange_n(__ATOMIC_RELAXED) instead
of __sync_bool_compare_and_swap.

11 years agoTODO file: move item about sync-base primitives to aarch64.h and generic.h
Ivan Maidanski [Tue, 12 Feb 2013 21:13:10 +0000 (01:13 +0400)]
TODO file: move item about sync-base primitives to aarch64.h and generic.h

11 years agoImplement double-wide load/store and CAS primitives for AArch64
Ivan Maidanski [Sat, 9 Feb 2013 14:31:09 +0000 (18:31 +0400)]
Implement double-wide load/store and CAS primitives for AArch64

* src/atomic_ops/sysdeps/gcc/aarch64.h: Include standard_ao_double_t.h
(before inclusion of generic.h).
* src/atomic_ops/sysdeps/gcc/generic.h (AO_double_load,
AO_double_load_acquire, AO_double_store, AO_double_store_release,
AO_double_compare_and_swap): Implement (only if
AO_HAVE_DOUBLE_PTR_STORAGE defined).

11 years agoImplement nop_read/write and and/or/xor_acquire/release/full for AArch64
Ivan Maidanski [Sat, 9 Feb 2013 14:11:13 +0000 (18:11 +0400)]
Implement nop_read/write and and/or/xor_acquire/release/full for AArch64

* src/atomic_ops/sysdeps/gcc/generic.h (AO_nop_read, AO_nop_write,
AO_and, AO_and_acquire, AO_and_release, AO_and_full, AO_or,
AO_or_acquire, AO_or_release, AO_or_full, AO_xor, AO_xor_acquire,
AO_xor_release, AO_xor_full): Implement.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_nop_full): Implement using
__atomic_thread_fence instead of __sync_synchronize.
* src/atomic_ops/sysdeps/gcc/generic.h: Add comment about AO_load_full
and AO_store_full; update TODO items.

11 years agoAllow to prefer more generalized primitives in gcc/generic.h
Ivan Maidanski [Sat, 9 Feb 2013 12:16:48 +0000 (16:16 +0400)]
Allow to prefer more generalized primitives in gcc/generic.h

* src/atomic_ops/sysdeps/gcc/generic.h (AO_test_and_set,
AO_test_and_set_acquire, AO_test_and_set_release, AO_test_and_set_full,
AO_fetch_and_add, AO_fetch_and_add_acquire, AO_fetch_and_add_release,
AO_fetch_and_add_full): Do not define if AO_PREFER_GENERALIZED.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_compare_and_swap): Do not
define if AO_GENERALIZE_ASM_BOOL_CAS.

11 years agoMove intrinsic-based primitives from gcc/aarch64.h to new gcc/generic.h
Ivan Maidanski [Sat, 9 Feb 2013 10:55:45 +0000 (14:55 +0400)]
Move intrinsic-based primitives from gcc/aarch64.h to new gcc/generic.h
(code refactoring)

* src/Makefile.am (nobase_private_HEADERS): Add generic.h entry.
* src/atomic_ops/sysdeps/gcc/aarch64.h: Move all primitives to
generic.h; include generic.h file.
* src/atomic_ops/sysdeps/gcc/generic.h: New file.
* src/atomic_ops/sysdeps/gcc/generic.h (AO_nop_full): Add comment.

11 years agoFix AO_load_acquire for AArch64
Ivan Maidanski [Sat, 9 Feb 2013 07:43:54 +0000 (11:43 +0400)]
Fix AO_load_acquire for AArch64

* src/atomic_ops/sysdeps/gcc/aarch64.h: Add TODO for AO_nop_read;
uncomment AO_load_acquire definition and remove include of
read_ordered.h file (because AO_load_acquire requires "release"
barrier, AO_load_read is defined in generalize-small.h using
AO_nop_read).

11 years agoMerge branch 'master' into add-aarch64-support
Ivan Maidanski [Sat, 9 Feb 2013 06:22:59 +0000 (10:22 +0400)]
Merge branch 'master' into add-aarch64-support

11 years agoRemove load_read, store_write redundant definition from ordered_X.h
Ivan Maidanski [Tue, 5 Feb 2013 21:38:38 +0000 (01:38 +0400)]
Remove load_read, store_write redundant definition from ordered_X.h
(code refactoring)

* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template
(AO_XSIZE_load_read): Remove prototype (since defined by
generalize-small.template in the same way).
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template
(AO_XSIZE_store_write): Likewise.
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template
(AO_XSIZE_store_release): Define using AO_nop_write and AO_XSIZE_store
directly.
* src/atomic_ops/sysdeps/ordered_except_wr.h: Move include of
ordered_stores_only.h down to be after AO_nop_write definition.
* src/atomic_ops/sysdeps/read_ordered.h: Move include of
ordered_loads_only.h down to be after AO_nop_read definition.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: Regenerate.
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h: Likewise.

11 years agoRevert "Prevent load_acquire redefinition in ordered_loads_only.h"
Ivan Maidanski [Tue, 5 Feb 2013 20:23:22 +0000 (21:23 +0100)]
Revert "Prevent load_acquire redefinition in ordered_loads_only.h"
(That change is not needed because the file defines really only
load_acquire, and load_read is the same as in generalize-small.h)

This reverts commit ad464bf64a139cefa8b6f6e77b5f1f5ea1c51519.

11 years agoMerge branch 'add-dbl-load-store'
Ivan Maidanski [Sun, 3 Feb 2013 08:50:01 +0000 (12:50 +0400)]
Merge branch 'add-dbl-load-store'

11 years agoAdd generalized fetch_and_add_acquire/release (for ARMv6+)
Ivan Maidanski [Sun, 3 Feb 2013 08:29:25 +0000 (12:29 +0400)]
Add generalized fetch_and_add_acquire/release (for ARMv6+)

* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_fetch_and_add_acquire, AO_XSIZE_fetch_and_add_release):
Add generalized template primitives based on AO_XSIZE_fetch_and_add.
* src/atomic_ops/generalize-arithm.h: Regenerate.

11 years agoFix unsupported instruction use in char/short_fetch_and_add for ARMv6
Ivan Maidanski [Sat, 2 Feb 2013 16:46:10 +0000 (20:46 +0400)]
Fix unsupported instruction use in char/short_fetch_and_add for ARMv6

* src/atomic_ops/sysdeps/gcc/arm.h (AO_ARM_HAVE_LDREXBH): Define new
macro for ARMv6K/Z+ (excluding ARMv6, ARMv6J, ARMv6T2).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_char_store, AO_short_store,
AO_char_fetch_and_add, AO_short_fetch_and_add): Define (together with
the corresponding AO_HAVE_x macros) only if AO_ARM_HAVE_LDREXBH (since
otherwise LDREXB/STREXB, LDREXH/STREXH are not supported by the target
processor).
* src/atomic_ops/sysdeps/gcc/arm.h: Include char_atomic_store.h and
short_atomic_store.h only if AO_HAVE_char_store is not defined (by
gcc/arm.h itself).

11 years agoImplement char/short_fetch_and_add for ARMv6+ (GCC)
Ivan Maidanski [Sat, 2 Feb 2013 09:40:27 +0000 (13:40 +0400)]
Implement char/short_fetch_and_add for ARMv6+ (GCC)

* src/atomic_ops/sysdeps/gcc/arm.h: Include char_atomic_store.h and
short_atomic_store.h only if not AO_BROKEN_TASKSWITCH_CLREX.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_store): Update comment.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_char_store, AO_short_store):
Implement using LDREXB/STREXB and LDREXH/STREXH, respectively, if
AO_BROKEN_TASKSWITCH_CLREX defined (only if AO_ARM_HAVE_LDREX).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_char_fetch_and_add,
AO_short_fetch_and_add): Implement (based on using LDREXB/STREXB and
LDREXH/STREXH, respectively) if AO_ARM_HAVE_LDREX.

11 years agoAdjust type of 'flag' and 'tmp' local variables in gcc/arm.h
Ivan Maidanski [Sat, 2 Feb 2013 08:47:07 +0000 (12:47 +0400)]
Adjust type of 'flag' and 'tmp' local variables in gcc/arm.h
(code refactoring)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_store,
AO_fetch_compare_and_swap): Change type of "flag" local variable from
AO_t to int (only if AO_BROKEN_TASKSWITCH_CLREX).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_test_and_set, AO_fetch_and_add,
AO_fetch_and_add1, AO_fetch_and_sub1): Change type of "flag" local
variable from unsigned long to int.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_fetch_and_add,
AO_fetch_and_add1, AO_fetch_and_sub1): Change type of "tmp" local
variable from unsigned long to AO_t.

11 years agoImplement atomic store using direct write by default on ARMv6+
Ivan Maidanski [Wed, 30 Jan 2013 21:35:19 +0000 (01:35 +0400)]
Implement atomic store using direct write by default on ARMv6+

* src/atomic_ops/sysdeps/gcc/arm.h (AO_store): Define only if
AO_BROKEN_TASKSWITCH_CLREX, otherwise include atomic_store.h; update
and refine comment.

11 years agoImplement char/short_store primitives at aligned addresses for ARM
Ivan Maidanski [Tue, 29 Jan 2013 22:33:22 +0000 (02:33 +0400)]
Implement char/short_store primitives at aligned addresses for ARM

* src/atomic_ops/sysdeps/gcc/arm.h: Include char_atomic_store.h and
short_atomic_store.h if AO_ARM_HAVE_LDREX (after
AO_ACCESS_x_CHECK_ALIGNED defined); add comment.
* src/atomic_ops/sysdeps/gcc/arm.h: Include
all_aligned_atomic_load_store.h instead of all_atomic_load_store.h
(only if not AO_ARM_HAVE_LDREX).

11 years ago.gitignore: Ignore .gch files
Ivan Maidanski [Sun, 27 Jan 2013 10:33:01 +0000 (14:33 +0400)]
.gitignore: Ignore .gch files

11 years agoImplement double_store for ARMv7 using LDREXD/STREXD
Ivan Maidanski [Sat, 26 Jan 2013 15:07:36 +0000 (19:07 +0400)]
Implement double_store for ARMv7 using LDREXD/STREXD

* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full, AO_nop_write,
AO_double_load, AO_double_compare_and_swap): Add comment about missing
AO_THUMB_GO_ARM.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_double_load): Add comment.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_double_store): New primitive
(implemented directly using LDREXD/STREXD).

11 years agoImplement char/short_load primitives for ARMv6+
Ivan Maidanski [Sat, 26 Jan 2013 09:48:15 +0000 (13:48 +0400)]
Implement char/short_load primitives for ARMv6+

* src/atomic_ops/sysdeps/armcc/arm_v6.h: Include all_atomic_only_load.h
(with defined AO_ACCESS_CHECK_ALIGNED, AO_ACCESS_short_CHECK_ALIGNED
and AO_ACCESS_int_CHECK_ALIGNED).
* src/atomic_ops/sysdeps/gcc/arm.h: Likewise.
* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_load, AO_HAVE_load):
Remove (since defined by all_atomic_only_load.h).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_load, AO_HAVE_load): Likewise.
* src/atomic_ops/sysdeps/gcc/arm.h: Adjust atomic_store.h filename in
comment.

11 years agoPrevent load_acquire redefinition in ordered_loads_only.h
Ivan Maidanski [Sat, 26 Jan 2013 08:58:34 +0000 (12:58 +0400)]
Prevent load_acquire redefinition in ordered_loads_only.h

* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template
(AO_XSIZE_load_acquire, AO_HAVE_XSIZE_load_acquire): Do not define
if AO_HAVE_XSIZE_load_acquire already defined.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: Regenerate.

11 years agoGeneralize AArch64 add1/sub1 primitives
Ivan Maidanski [Fri, 25 Jan 2013 20:46:30 +0000 (00:46 +0400)]
Generalize AArch64 add1/sub1 primitives

* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_fetch_and_add1,
AO_fetch_and_add1_acquire, AO_fetch_and_add1_release,
AO_fetch_and_add1_full, AO_fetch_and_sub1, AO_fetch_and_sub1_acquire,
AO_fetch_and_sub1_release, AO_fetch_and_sub1_full): Remove (since
generalized to the same expression).

11 years agoFix AO_nop_full and AO_load_read for AArch64
Ivan Maidanski [Wed, 23 Jan 2013 21:36:12 +0000 (01:36 +0400)]
Fix AO_nop_full and AO_load_read for AArch64

* src/atomic_ops/sysdeps/gcc/aarch64.h: Place include of
read_ordered.h to the end of file (to be after AO_load definition).
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_nop_full): Force compiler
barrier for the uni-processor case.
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_load_acquire): Comment out
and add FIXME (due to read_ordered.h).
* src/atomic_ops/sysdeps/gcc/aarch64.h (AO_test_and_set,
AO_test_and_set_acquire, AO_test_and_set_release,
AO_test_and_set_full): Cast result to AO_TS_VAL_t (since
__atomic_test_and_set returns AO_TS_t value).

11 years agoAdd TODO items to gcc/aarch64.h
Ivan Maidanski [Wed, 23 Jan 2013 21:23:41 +0000 (01:23 +0400)]
Add TODO items to gcc/aarch64.h

* src/atomic_ops/sysdeps/gcc/aarch64.h: Add TODO items.
* src/atomic_ops/sysdeps/gcc/arm.h: Remove FIXME for 64-bit ARM.

11 years agoReformat code of gcc/aarch64.h
Ivan Maidanski [Wed, 23 Jan 2013 21:20:49 +0000 (01:20 +0400)]
Reformat code of gcc/aarch64.h

11 years agoUpdate AUTHORS file
Ivan Maidanski [Wed, 23 Jan 2013 20:48:28 +0000 (00:48 +0400)]
Update AUTHORS file

11 years agoAdd AArch64 (64-bit ARM) target initial support
Yvan Roux [Wed, 23 Jan 2013 20:47:58 +0000 (00:47 +0400)]
Add AArch64 (64-bit ARM) target initial support

* src/Makefile.am (nobase_private_HEADERS): Add gcc/aarch64.h entry.
* src/atomic_ops.h: Include gcc/aarch64.h if __aarch64__.
* src/atomic_ops/sysdeps/gcc/aarch64.h: New file.

11 years agoAdd internal header containing only char/short/int/AO_t atomic loads
Ivan Maidanski [Sun, 20 Jan 2013 19:12:12 +0000 (23:12 +0400)]
Add internal header containing only char/short/int/AO_t atomic loads
(code refactoring)

* src/Makefile.am (nobase_private_HEADERS): Add all_atomic_only_load.h
entry.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Include
all_atomic_load_store.h instead of including X_atomic_load.h and
X_atomic_store.h directly; add comment for char type.
* src/atomic_ops/sysdeps/all_atomic_load_store.h: Include
all_atomic_only_load.h instead of including X_atomic_load.h directly.
* src/atomic_ops/sysdeps/all_atomic_only_load.h: New file (contains
only inclusion of atomic_load.h, char_atomic_load.h,
short_atomic_load.h and int_atomic_load.h files.

11 years agoReplace atomic_load_store.template with atomic_load and atomic_store ones
Ivan Maidanski [Wed, 16 Jan 2013 21:13:39 +0000 (01:13 +0400)]
Replace atomic_load_store.template with atomic_load and atomic_store ones
(code refactoring)

* src/Makefile.am (EXTRA_DIST): Replace atomic_load_store.template
entry with atomic_load.template and atomic_store.template.
* src/Makefile.am (BUILT_SOURCES): Replace atomic_load_store.h,
char_atomic_load_store.h, int_atomic_load_store.h,
short_atomic_load_store.h entries with atomic_load.h, atomic_store.h,
char_atomic_load.h, char_atomic_store.h, int_atomic_load.h,
int_atomic_store.h, short_atomic_load.h, short_atomic_store.h,
respectively.
* src/Makefile.am (atomic_ops/sysdeps/loadstore/atomic_load_store.h,
atomic_ops/sysdeps/loadstore/char_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/int_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/short_atomic_load_store.h): Replace with
atomic_ops/sysdeps/loadstore/<T>_atomic_load.h and
atomic_ops/sysdeps/loadstore/<T>_atomic_store.h rules.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Include
all <T>_atomic_load.h and <T>_atomic_store.h instead of all removed
<T>_atomic_load_store.h files.
* src/atomic_ops/sysdeps/all_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/gcc/alpha.h: Include atomic_load.h and
atomic_store.h instead of removed atomic_load_store.h file.
* src/atomic_ops/sysdeps/hpc/hppa.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load.template: New template
file (half of code copied from atomic_load_store.template).
* src/atomic_ops/sysdeps/loadstore/atomic_store.template: Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.template: Remove
file.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/int_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/short_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load.h: Regenerate.
* src/atomic_ops/sysdeps/loadstore/atomic_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_load.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/int_atomic_load.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/int_atomic_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/short_atomic_load.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/short_atomic_store.h: Likewise.

11 years agoFix README regarding _acquire_read barrier
Ivan Maidanski [Mon, 14 Jan 2013 20:56:35 +0000 (00:56 +0400)]
Fix README regarding _acquire_read barrier

* doc/README.txt (_acquire_read): Add information about memory
barrier (similar as in atomic_ops.h).
* doc/README.txt (_release_read): Remove information about
non-existing barrier.

11 years agoDefine AO_int_and/or/xor primitives in ao_t_is_int header
Ivan Maidanski [Sun, 13 Jan 2013 20:27:16 +0000 (00:27 +0400)]
Define AO_int_and/or/xor primitives in ao_t_is_int header

* src/atomic_ops/sysdeps/ao_t_is_int.template: Update comment; remove
TODO item.
* src/atomic_ops/sysdeps/ao_t_is_int.template (AO_int_and_XBAR,
AO_int_or_XBAR, AO_int_xor_XBAR): Define template primitive (and
define the corresponding AO_HAVE_int_X macro).
* src/atomic_ops/sysdeps/ao_t_is_int.h: Regenerate.

11 years agoGenerate ao_t_is_int header from template
Ivan Maidanski [Sun, 13 Jan 2013 19:39:51 +0000 (23:39 +0400)]
Generate ao_t_is_int header from template

* src/Makefile.am (EXTRA_DIST): Add ao_t_is_int.template entry.
* src/Makefile.am (BUILT_SOURCES): Add ao_t_is_int.h entry.
* src/Makefile.am (nobase_private_HEADERS): Remove ao_t_is_int.h
entry (since added to BUILT_SOURCES).
* src/Makefile.am (atomic_ops/sysdeps/ao_t_is_int.h): New rule (to
generate the header from ao_t_is_int.template substituting XBAR
parameter with the corresponding barrier type).
* src/atomic_ops/sysdeps/ao_t_is_int.h: Regenerate.

11 years agoFix a typo in ao_t_is_int.h comment
Ivan Maidanski [Sun, 13 Jan 2013 20:10:48 +0000 (00:10 +0400)]
Fix a typo in ao_t_is_int.h comment

* src/atomic_ops/sysdeps/ao_t_is_int.h: Fix a typo in comment.

11 years agoFix return type of AO_int_X primitives defined in ao_t_is_int header
Ivan Maidanski [Sun, 13 Jan 2013 18:42:52 +0000 (22:42 +0400)]
Fix return type of AO_int_X primitives defined in ao_t_is_int header

* src/atomic_ops/sysdeps/ao_t_is_int.h
(AO_int_fetch_compare_and_swap_full,
AO_int_fetch_compare_and_swap_acquire,
AO_int_fetch_compare_and_swap_release,
AO_int_fetch_compare_and_swap_write,
AO_int_fetch_compare_and_swap_read, AO_int_fetch_compare_and_swap,
AO_int_load_acquire, AO_int_fetch_and_add_full,
AO_int_fetch_and_add1_acquire, AO_int_fetch_and_add1_release,
AO_int_fetch_and_sub1_acquire, AO_int_fetch_and_sub1_release): Cast
result to unsigned int instead of signed int.

11 years agoFix ordered_except_wr header inclusion for s390
Ivan Maidanski [Sun, 13 Jan 2013 16:19:51 +0000 (20:19 +0400)]
Fix ordered_except_wr header inclusion for s390

* src/atomic_ops/sysdeps/gcc/s390.h: Move include of
ordered_except_wr.h down to be after all_aligned_atomic_load_store.h
inclusion (since the latter defines AO_X_load/store primitives used by
the former header).

11 years agoFix read_ordered.h inclusion for ARM
Ivan Maidanski [Sun, 13 Jan 2013 16:04:36 +0000 (20:04 +0400)]
Fix read_ordered.h inclusion for ARM

* src/atomic_ops/sysdeps/armcc/arm_v6.h: Move include of read_ordered.h
down to the end of the file to be after AO_load/store definition
(since read_ordered.h depends on these primitives).
* src/atomic_ops/sysdeps/gcc/arm.h: Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h: Likewise.

11 years agoRemove AO_store_full from msftc/arm.h in favor of generalized primitive
Ivan Maidanski [Sun, 13 Jan 2013 13:33:16 +0000 (17:33 +0400)]
Remove AO_store_full from msftc/arm.h in favor of generalized primitive
(code refactoring)

* src/atomic_ops/sysdeps/msftc/arm.h (AO_store_full): Remove since
similar definition exists in generalize-small.h.
* src/atomic_ops/sysdeps/msftc/arm.h: Add TODO item for AO_store().

11 years agoFix a typo in comment in msftc/arm.h
Ivan Maidanski [Sun, 13 Jan 2013 12:08:12 +0000 (16:08 +0400)]
Fix a typo in comment in msftc/arm.h

* src/atomic_ops/sysdeps/msftc/arm.h: Fix a typo in comment (about
SWP).

11 years agoAdd AO_double_store pthread-based implementation and tests
Ivan Maidanski [Sat, 12 Jan 2013 19:55:52 +0000 (23:55 +0400)]
Add AO_double_store pthread-based implementation and tests

* src/atomic_ops/sysdeps/generic_pthread.h (AO_double_store_full): New
primitive.
* tests/test_atomic_include.template (test_atomicXX): Add test of
AO_double_storeXX.

11 years agoAdd AO_store generalization based on CAS
Ivan Maidanski [Sat, 12 Jan 2013 19:52:34 +0000 (23:52 +0400)]
Add AO_store generalization based on CAS

* src/atomic_ops/generalize-small.template (AO_XSIZE_store_write,
AO_XSIZE_store, AO_XSIZE_store_release, AO_XSIZE_store_full): Add
generalization template primitive based on CAS.
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoCast away volatile on dereference in CAS-based generalization primitives
Ivan Maidanski [Sat, 12 Jan 2013 16:36:34 +0000 (20:36 +0400)]
Cast away volatile on dereference in CAS-based generalization primitives

* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_fetch_and_add_full, AO_XSIZE_fetch_and_add_acquire,
AO_XSIZE_fetch_and_add_release, AO_XSIZE_fetch_and_add,
AO_XSIZE_and_full, AO_XSIZE_or_full, AO_XSIZE_xor_full): Cast away the
volatile (when reading old value before CAS) for architectures like
IA64 (where volatile adds barrier semantics).
* src/atomic_ops/generalize-small.template (AO_XSIZE_load_read,
AO_XSIZE_load_full, AO_XSIZE_load_acquire, AO_XSIZE_load): Likewise.
* src/atomic_ops/generalize-arithm.h: Regenerate.
* src/atomic_ops/generalize-small.h: Likewise.

11 years agoAdd TODO items about missing double-wide operations for some targets
Ivan Maidanski [Tue, 8 Jan 2013 10:52:16 +0000 (14:52 +0400)]
Add TODO items about missing double-wide operations for some targets

* src/atomic_ops/sysdeps/gcc/mips.h: Add TODO items (about double-wide
operations like load/store and CAS).
* src/atomic_ops/sysdeps/gcc/powerpc.h: Likewise.
* src/atomic_ops/sysdeps/gcc/s390.h: Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h: Likewise.

11 years agoDefine double-wide ordered loads/stores for x86
Ivan Maidanski [Mon, 7 Jan 2013 16:17:49 +0000 (20:17 +0400)]
Define double-wide ordered loads/stores for x86

* src/Makefile.am (atomic_ops/sysdeps/loadstore/ordered_loads_only.h,
atomic_ops/sysdeps/loadstore/ordered_stores_only.h): Generate
primitives for AO_double_t as well (from the template).
* src/atomic_ops/sysdeps/gcc/x86.h: Move include of ordered_except_wr.h
(together with the comment) to the end of the file to be after
inclusion of double_atomic_load_store.h (because the former uses the
primitives defined the latter).
* src/atomic_ops/sysdeps/msftc/x86.h: Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: Regenerate.
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h: Likewise.

11 years agoGenerate ordered_loads/stores_only headers from templates
Ivan Maidanski [Mon, 7 Jan 2013 14:26:01 +0000 (18:26 +0400)]
Generate ordered_loads/stores_only headers from templates
(code refactoring)

* src/Makefile.am (EXTRA_DIST): Add ordered_loads_only.template,
ordered_stores_only.template entries.
* src/Makefile.am (BUILT_SOURCES): Add ordered_loads_only.h,
ordered_stores_only.h entries (move from nobase_private_HEADERS).
* src/Makefile.am (atomic_ops/sysdeps/loadstore/ordered_loads_only.h,
atomic_ops/sysdeps/loadstore/ordered_stores_only.h): New rule (to
generate header from the corresponding template).
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: Regenerate
(from the corresponding template).
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.template: New
template header (code copied from the corresponding header of
"loadstore" folder and parameterized with XSIZE and XCTYPE).
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.template:
Likewise.

11 years agoMove definitions of ordered loads/stores to inner separate headers
Ivan Maidanski [Mon, 7 Jan 2013 09:43:38 +0000 (13:43 +0400)]
Move definitions of ordered loads/stores to inner separate headers
(code refactoring)

* src/Makefile.am (nobase_private_HEADERS): Add ordered_loads_only.h,
ordered_stores_only.h entries.
* src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h: New file.
* src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h: Likewise.
* src/atomic_ops/sysdeps/ordered_except_wr.h: Include
ordered_stores_only.h.
* src/atomic_ops/sysdeps/ordered_except_wr.h (AO_store_write,
AO_store_release, AO_char_store_write, AO_char_store_release,
AO_short_store_write, AO_short_store_release, AO_int_store_write,
AO_int_store_release): Move to ordered_stores_only.h (with the
corresponding AO_HAVE_x macros).
* src/atomic_ops/sysdeps/read_ordered.h: Include ordered_loads_only.h.
* src/atomic_ops/sysdeps/read_ordered.h (AO_load_read,
AO_load_acquire, AO_char_load_read, AO_char_load_acquire,
AO_short_load_read, AO_short_load_acquire, AO_int_load_read,
AO_int_load_acquire): Move to ordered_loads_only.h (with the
corresponding AO_HAVE_x macros).

11 years agoFix return type of AO_char/short/int_load_read() in read_ordered.h
Ivan Maidanski [Mon, 7 Jan 2013 15:24:02 +0000 (19:24 +0400)]
Fix return type of AO_char/short/int_load_read() in read_ordered.h

* src/atomic_ops/sysdeps/read_ordered.h (AO_char_load_read,
AO_short_load_read, AO_int_load_read): Change return type (and the
type of "result" local variable) from AO_t to the type matching the
name of the function (i.e., unsigned char/short/int, respectively).

11 years agoImplement AO_nop_full/write using 'dmb' instruction if available (gcc/arm)
Ivan Maidanski [Mon, 7 Jan 2013 08:52:59 +0000 (12:52 +0400)]
Implement AO_nop_full/write using 'dmb' instruction if available (gcc/arm)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_ARM_HAVE_DMB): New macro
(defined for ARMv6M and ARMv7+).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full): Update comment;
use "dmb" instruction if AO_ARM_HAVE_DMB (and not AO_UNIPROCESSOR).
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_write): Implement using
"dmb st" instruction and define AO_HAVE_nop_write (only if
AO_ARM_HAVE_DMB and not AO_UNIPROCESSOR).

11 years agoFix missing abort() usage in atomic_ops_malloc and tests on WinCE
Ivan Maidanski [Mon, 7 Jan 2013 08:31:48 +0000 (12:31 +0400)]
Fix missing abort() usage in atomic_ops_malloc and tests on WinCE

* src/atomic_ops_malloc.c (abort): Define to _exit(-1) if _WIN32_WCE
or __MINGW32CE__ (since there is no abort() in WinCE).
* tests/run_parallel.h (abort): Likewise.
* tests/test_stack.c (abort): Likewise.

11 years agoFix missing compiler barrier in AO_nop_full for uniprocessor ARM
Ivan Maidanski [Sun, 6 Jan 2013 18:04:48 +0000 (22:04 +0400)]
Fix missing compiler barrier in AO_nop_full for uniprocessor ARM

* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_nop_full): Insert
AO_compiler_barrier for AO_UNIPROCESSOR case.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_nop_full): Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h (AO_nop_full): Likewise.
* src/atomic_ops/sysdeps/msftc/arm.h (AO_nop_full): Refine comment.

11 years agoImplement AO_double_load/store based on guaranteed x86 access atomicity
Ivan Maidanski [Sun, 6 Jan 2013 15:51:57 +0000 (19:51 +0400)]
Implement AO_double_load/store based on guaranteed x86 access atomicity

* src/atomic_ops/sysdeps/gcc/x86.h: Define
AO_ACCESS_double_CHECK_ALIGNED and include double_atomic_load_store.h
after inclusion of standard_ao_double_t.h (only if AO_t is 32-bit).
* src/atomic_ops/sysdeps/msftc/x86.h: Likewise.
* src/atomic_ops/sysdeps/sunc/x86.h: Likewise.

11 years agoRemove redundant 'cc' clobber for LDREXD instruction (gcc/arm)
Ivan Maidanski [Sun, 6 Jan 2013 11:08:12 +0000 (15:08 +0400)]
Remove redundant 'cc' clobber for LDREXD instruction (gcc/arm)
(revert commit 07e9ea9 partially)

* src/atomic_ops/sysdeps/gcc/arm.h (AO_fetch_compare_and_swap): Remove
redundant "cc" clobber for assembly code that consists of a single
LDREXD instruction.

11 years agoImplement AO_double_load for gcc/arm
Ivan Maidanski [Sun, 6 Jan 2013 11:03:56 +0000 (15:03 +0400)]
Implement AO_double_load for gcc/arm

* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_load_ex): Add 'const'
qualifier to argument pointer type.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_fetch_and_add,
AO_fetch_and_add1, AO_fetch_and_sub1, AO_compare_and_swap): Remove
useless comment.
* src/atomic_ops/sysdeps/gcc/arm.h (AO_double_load): Implement (only
for ARMv7+).
* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_double_load): Likewise.

11 years agoAdd generic implementation of AO_double_load primitives
Ivan Maidanski [Sat, 5 Jan 2013 21:00:44 +0000 (01:00 +0400)]
Add generic implementation of AO_double_load primitives

* src/Makefile.am (nobase_private_HEADERS): Add
double_atomic_load_store.h entry.
* src/Makefile.am (atomic_ops/generalize-small.h):
Generate primitives for AO_double_t as well (from the template).
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/sysdeps/generic_pthread.h (AO_double_load_full): New
primitive.
* src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h: New
header (most code copied from atomic_load_store template).
* tests/test_atomic_include.template (test_atomicXX): Add test of
AO_double_loadXX.

11 years agoEliminate redundant underscore symbols in sed arguments in Makefile
Ivan Maidanski [Sat, 5 Jan 2013 15:59:21 +0000 (19:59 +0400)]
Eliminate redundant underscore symbols in sed arguments in Makefile
(revert commit 75b9e67 partially)

* src/Makefile.am (atomic_ops/generalize-small.h,
atomic_ops/generalize-arithm.h,
atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/char_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/int_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/short_atomic_load_store.h): Remove
redundant '_' (underscore) symbol in sed "search" and "replace-to"
strings.

11 years agoDo not duplicate BUILT_SOURCES entries in nobase_private_HEADERS (Makefile)
Ivan Maidanski [Sat, 5 Jan 2013 15:37:59 +0000 (19:37 +0400)]
Do not duplicate BUILT_SOURCES entries in nobase_private_HEADERS (Makefile)

* src/Makefile.am (nobase_private_HEADERS): Add "$(BUILT_SOURCES)"
instead of specifying generalize-arithm.h, generalize-small.h,
acquire_release_volatile.h, atomic_load_store.h,
char_acquire_release_volatile.h, char_atomic_load_store.h,
int_acquire_release_volatile.h, int_atomic_load_store.h,
short_acquire_release_volatile.h, short_atomic_load_store.h entries
directly.

11 years agoRemove X_aligned_atomic_load_store headers and template
Ivan Maidanski [Sat, 5 Jan 2013 14:56:53 +0000 (18:56 +0400)]
Remove X_aligned_atomic_load_store headers and template
(code refactoring)

* src/Makefile.am (EXTRA_DIST): Remove
aligned_atomic_load_store.template entry.
* src/Makefile.am (BUILT_SOURCES, nobase_private_HEADERS): Remove
aligned_atomic_load_store.h, int_aligned_atomic_load_store.h,
short_aligned_atomic_load_store.h entries.
* src/Makefile.am
(atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h):
Remove rules.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Refine
comment; include X_atomic_load_store.h instead of the corresponding
X_aligned_atomic_load_store.h file.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h
(AO_ACCESS_CHECK_ALIGNED, AO_ACCESS_short_CHECK_ALIGNED,
AO_ACCESS_int_CHECK_ALIGNED): New macros (defined before inclusion
of the corresponding X_atomic_load_store.h file).
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h:
Remove.
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.template:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.template
(AO_XSIZE_load, AO_XSIZE_store): Add conditional assertion check of
(*addr) alignment (enabled only if AO_ACCESS_<XSIZE>_CHECK_ALIGNED).
* src/atomic_ops/sysdeps/loadstore/short_atomic_load_store.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/int_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.h: Likewise.

11 years agoAdd missing 'const' in aligned-atomic AO_XSIZE_load implementation
Ivan Maidanski [Sat, 5 Jan 2013 09:43:57 +0000 (13:43 +0400)]
Add missing 'const' in aligned-atomic AO_XSIZE_load implementation

* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.template
(AO_XSIZE_load): Add missing 'const' (when casting away volatile).
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h:
Likewise.

11 years agoGenerate 'loadstore' headers from templates
Ivan Maidanski [Fri, 4 Jan 2013 17:27:42 +0000 (21:27 +0400)]
Generate 'loadstore' headers from templates

* src/Makefile.am (EXTRA_DIST): Add acquire_release_volatile.template,
aligned_atomic_load_store.template, atomic_load_store.template
entires.
* src/Makefile.am (BUILT_SOURCES): Add acquire_release_volatile.h,
aligned_atomic_load_store.h, atomic_load_store.h,
char_acquire_release_volatile.h, char_atomic_load_store.h,
int_acquire_release_volatile.h, int_aligned_atomic_load_store.h,
int_atomic_load_store.h, short_acquire_release_volatile.h,
short_aligned_atomic_load_store.h, short_atomic_load_store.h entires.
* src/Makefile.am
(atomic_ops/sysdeps/loadstore/acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h,
atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/atomic_load_store.h,
atomic_ops/sysdeps/loadstore/char_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/int_atomic_load_store.h,
atomic_ops/sysdeps/loadstore/short_atomic_load_store.h): New rules (to
generate header from the corresponding template).
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template:
New template header (code copied from the corresponding header of
"loadstore" folder and parameterized with XSIZE and XCTYPE); update
header comment.
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.template:
Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.template:
Likewise.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.template
(AO_GCC_BARRIER): Add TODO item.
* src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h:
Regenerate.
* src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/int_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/short_atomic_load_store.h:
Likewise.

11 years agoGroup all X_acquire_release_volatile.h and X_[aligned_]atomic_load_store.h
Ivan Maidanski [Fri, 4 Jan 2013 11:49:45 +0000 (15:49 +0400)]
Group all X_acquire_release_volatile.h and X_[aligned_]atomic_load_store.h
in separate folder

* src/Makefile.am (nobase_private_HEADERS): Update path to
acquire_release_volatile.h, aligned_atomic_load_store.h,
atomic_load_store.h, char_acquire_release_volatile.h,
char_atomic_load_store.h, int_acquire_release_volatile.h,
int_aligned_atomic_load_store.h, int_atomic_load_store.h,
short_acquire_release_volatile.h, short_aligned_atomic_load_store.h,
short_atomic_load_store.h entries (add "loadstore" to prefix).
* src/atomic_ops/sysdeps/all_acquire_release_volatile.h: Likewise.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/all_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/gcc/alpha.h: Likewise.
* src/atomic_ops/sysdeps/gcc/mips.h: Likewise.
* src/atomic_ops/sysdeps/hpc/hppa.h: Likewise.
* src/atomic_ops/sysdeps/acquire_release_volatile.h: Move file to
src/atomic_ops/sysdeps/loadstore folder.
* src/atomic_ops/sysdeps/loadstore/aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/char_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/int_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_aligned_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/loadstore/short_atomic_load_store.h:
Likewise.
* src/atomic_ops/sysdeps/all_acquire_release_volatile.h: Reformat
comment.
* src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h: Likewise.
* src/atomic_ops/sysdeps/all_atomic_load_store.h: Likewise.

11 years agoFix template-based headers regeneration order in src/Makefile
Ivan Maidanski [Fri, 4 Jan 2013 19:28:42 +0000 (23:28 +0400)]
Fix template-based headers regeneration order in src/Makefile

* src/Makefile.am (BUILT_SOURCES): Define to force regeneration
of generalize-arithm.h, generalize-small.h (if the corresponding
source template is changed) before compilation of .c files (that use
atomic_ops.h).

11 years agoAdd AO_load primitives generalization based on CAS
Ivan Maidanski [Thu, 3 Jan 2013 20:09:50 +0000 (00:09 +0400)]
Add AO_load primitives generalization based on CAS

* src/atomic_ops/generalize-small.template (AO_XSIZE_load_acquire,
AO_XSIZE_load, AO_XSIZE_load_read, AO_XSIZE_load_acquire_read,
AO_XSIZE_load_full, AO_XSIZE_load_dd_acquire_read,
AO_XSIZE_store_release, AO_XSIZE_store, AO_XSIZE_store_write,
AO_XSIZE_store_release_write, AO_XSIZE_store_full): Move primitive
down to be after CAS defintion section.
* src/atomic_ops/generalize-small.template (AO_XSIZE_load_read,
AO_XSIZE_load_full, AO_XSIZE_load_acquire, AO_XSIZE_load): Add
generalization template primitive based on CAS.
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoEnable generalization of all variants of CAS via fetch_compare_and_swap
Ivan Maidanski [Thu, 3 Jan 2013 15:18:11 +0000 (19:18 +0400)]
Enable generalization of all variants of CAS via fetch_compare_and_swap

* src/atomic_ops/generalize.h (AO_compare_and_swap_full,
AO_compare_and_swap_acquire, AO_compare_and_swap_release,
AO_compare_and_swap, AO_TS_COMPARE_AND_SWAP_FULL,
AO_TS_COMPARE_AND_SWAP_ACQUIRE, AO_TS_COMPARE_AND_SWAP_RELEASE,
AO_TS_COMPARE_AND_SWAP): Define (in this file) only if required for
AO_test_and_set_X generalization.
* src/atomic_ops/generalize-arithm.template
(AO_XSIZE_compare_and_swap_write, AO_XSIZE_compare_and_swap_read,
AO_XSIZE_compare_and_swap_release_write,
AO_XSIZE_compare_and_swap_acquire_read,
AO_XSIZE_compare_and_swap_dd_acquire_read): Add missing variant of
generalized template CAS primitives based fetch_compare_and_swap; add
the corresponding AO_HAVE_XSIZE_compare_and_swap_X macros.
* src/atomic_ops/generalize-arithm.h: Regenerate.

11 years agoMove generalized arithmetical primitives to 'generalize-arithm' template
Ivan Maidanski [Thu, 3 Jan 2013 11:57:35 +0000 (15:57 +0400)]
Move generalized arithmetical primitives to 'generalize-arithm' template
(code refactoring)

* src/Makefile.am (EXTRA_DIST): Add generalize-arithm.template.
* src/Makefile.am (nobase_private_HEADERS): Add generalize-arithm.h.
* src/Makefile.am (atomic_ops/generalize-arithm.h): New rule (similar
as generalize-small.h but using generalize-arithm.template).
* src/atomic_ops/generalize-arithm.template: New file.
* src/atomic_ops/generalize-small.template: Move compare_and_swap
(only which is based on fetch_compare_and_swap), fetch_and_add,
fetch_and_add, fetch_and_add1, fetch_and_sub1, and/or/xor template
primitives to generalize-arithm.template).
* src/atomic_ops/generalize-arithm.h: Regenerate (new file).
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/generalize.h: Include generalize-arithm.h (just after
inclusion of generalize-small.h).

11 years agoRemote duplicate definition of test_and_set_acquire in generalize.h
Ivan Maidanski [Wed, 2 Jan 2013 21:02:08 +0000 (01:02 +0400)]
Remote duplicate definition of test_and_set_acquire in generalize.h

* src/atomic_ops/generalize.h (AO_test_and_set_acquire): Remove
redundant (duplicate) definition.

11 years agoAdd generalized CAS primitives of char/short/int size
Ivan Maidanski [Wed, 2 Jan 2013 20:30:33 +0000 (00:30 +0400)]
Add generalized CAS primitives of char/short/int size

* src/atomic_ops/generalize-small.template
(AO_XSIZE_fetch_compare_and_swap_acquire,
AO_XSIZE_fetch_compare_and_swap_release,
AO_XSIZE_fetch_compare_and_swap_write,
AO_XSIZE_fetch_compare_and_swap_read, AO_XSIZE_fetch_compare_and_swap,
AO_XSIZE_fetch_compare_and_swap_full,
AO_XSIZE_fetch_compare_and_swap_release_write,
AO_XSIZE_fetch_compare_and_swap_acquire_read,
AO_XSIZE_fetch_compare_and_swap_dd_acquire_read,
AO_XSIZE_compare_and_swap_acquire, AO_XSIZE_compare_and_swap_release,
AO_XSIZE_compare_and_swap_write, AO_XSIZE_compare_and_swap_read,
AO_XSIZE_compare_and_swap, AO_XSIZE_compare_and_swap_full,
AO_XSIZE_compare_and_swap_release_write,
AO_XSIZE_compare_and_swap_acquire_read,
AO_XSIZE_compare_and_swap_dd_acquire_read): New template primitive
(code copied from generalize.h for AO_t); define the corresponding
AO_HAVE_XSIZE_x.
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/generalize.h (AO_compare_and_swap_acquire,
AO_compare_and_swap_release, AO_compare_and_swap_write,
AO_compare_and_swap_read, AO_compare_and_swap,
AO_compare_and_swap_full, AO_compare_and_swap_release_write,
AO_compare_and_swap_acquire_read, AO_compare_and_swap_dd_acquire_read,
AO_fetch_compare_and_swap_acquire, AO_fetch_compare_and_swap_release,
AO_fetch_compare_and_swap_write, AO_fetch_compare_and_swap_read,
AO_fetch_compare_and_swap, AO_fetch_compare_and_swap_full,
AO_fetch_compare_and_swap_release_write,
AO_fetch_compare_and_swap_acquire_read,
AO_fetch_compare_and_swap_dd_acquire_read): Remove (since present in
the auto-generated generalize-small.h) together with the corresponding
AO_HAVE_x.

11 years agoAdd generalized atomic and/or/xor operations for char/short/int types
Ivan Maidanski [Wed, 2 Jan 2013 18:22:17 +0000 (22:22 +0400)]
Add generalized atomic and/or/xor operations for char/short/int types

* src/atomic_ops/generalize-small.template (AO_XSIZE_and_full,
AO_XSIZE_and_release, AO_XSIZE_and_acquire, AO_XSIZE_and_write,
AO_XSIZE_and_read, AO_XSIZE_and, AO_XSIZE_and_release_write,
AO_XSIZE_and_acquire_read, AO_XSIZE_or_full, AO_XSIZE_or_release,
AO_XSIZE_or_acquire, AO_XSIZE_or_write, AO_XSIZE_or_read,
AO_XSIZE_or, AO_XSIZE_or_release_write, AO_XSIZE_or_acquire_read,
AO_XSIZE_xor_full, AO_XSIZE_xor_release, AO_XSIZE_xor_acquire,
AO_XSIZE_xor_write, AO_XSIZE_xor_read, AO_XSIZE_xor,
AO_XSIZE_xor_release_write, AO_XSIZE_xor_acquire_read): New template
primitive (code copied from generalize.h for AO_t); define the
corresponding AO_HAVE_x.
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/generalize.h (AO_and_full, AO_and_release,
AO_and_acquire, AO_and_write, AO_and_read, AO_and,
AO_and_release_write, AO_and_acquire_read, AO_or_full,
AO_or_release, AO_or_acquire, AO_or_write, AO_or_read, AO_xor,
AO_or_release_write, AO_or_acquire_read, AO_xor_full, AO_xor_release,
AO_xor_acquire, AO_xor_write, AO_xor_read, AO_xor,
AO_xor_release_write, AO_xor_acquire_read): Remove (since present in
the autogenerated generalize-small.h) together with the corresponding
AO_HAVE_x.
* src/atomic_ops/sysdeps/generic_pthread.h (AO_char_and_full,
AO_char_or_full, AO_char_xor_full, AO_short_and_full,
AO_short_or_full, AO_short_xor_full, AO_int_and_full, AO_int_or_full,
AO_int_xor_full): Implement primitive (and define the corresponding
AO_HAVE_x).

11 years agoAdd lock-based implementation of char/short/int_fetch_compare_and_swap
Ivan Maidanski [Wed, 2 Jan 2013 14:34:00 +0000 (18:34 +0400)]
Add lock-based implementation of char/short/int_fetch_compare_and_swap

* src/atomic_ops/sysdeps/generic_pthread.h
(AO_char_fetch_compare_and_swap_full,
AO_short_fetch_compare_and_swap_full,
AO_int_fetch_compare_and_swap_full): Implement primitives.

11 years agoGenerate generalized AO_t load/store/fetch_and_add primitives from template
Ivan Maidanski [Wed, 2 Jan 2013 13:51:04 +0000 (17:51 +0400)]
Generate generalized AO_t load/store/fetch_and_add primitives from template
(code refactoring)

* src/Makefile.am (atomic_ops/generalize-small.h): Append
generalize-small.template to generalize-small.h replacing XCTYPE with
AO_t (and "XSIZE_" with empty sequence).
* src/atomic_ops/generalize-small.h: Regenerate.
* src/atomic_ops/generalize.h (AO_load_acquire, AO_load, AO_load_read,
AO_load_acquire_read, AO_load_full, AO_load_dd_acquire_read,
AO_store_release, AO_store, AO_store_write, AO_store_release_write,
AO_store_full, AO_fetch_and_add_full, AO_fetch_and_add_acquire,
AO_fetch_and_add_release, AO_fetch_and_add, AO_fetch_and_add_write,
AO_fetch_and_add_read, AO_fetch_and_add_release_write,
AO_fetch_and_add_acquire_read, AO_fetch_and_add_dd_acquire_read,
AO_fetch_and_add1_full, AO_fetch_and_add1_release,
AO_fetch_and_add1_acquire, AO_fetch_and_add1_write,
AO_fetch_and_add1_read, AO_fetch_and_add1_release_write,
AO_fetch_and_add1_acquire_read, AO_fetch_and_add1,
AO_fetch_and_add1_dd_acquire_read, AO_fetch_and_sub1_full,
AO_fetch_and_sub1_release, AO_fetch_and_sub1_acquire,
AO_fetch_and_sub1_write, AO_fetch_and_sub1_read,
AO_fetch_and_sub1_release_write, AO_fetch_and_sub1_acquire_read,
AO_fetch_and_sub1, AO_fetch_and_sub1_dd_acquire_read): Remove
generalized primitives (and the corresponding AO_HAVE_x macros) that
exist in auto-generated generalize-small.h file.

11 years agoAdd missing generalization of no-barrier CAS in template
Ivan Maidanski [Wed, 2 Jan 2013 09:40:21 +0000 (13:40 +0400)]
Add missing generalization of no-barrier CAS in template

* src/atomic_ops/generalize-small.template
(AO_XSIZE_compare_and_swap): Add missed definition (based on
AO_XSIZE_fetch_compare_and_swap).
* src/atomic_ops/generalize-small.template
(AO_XSIZE_fetch_and_add_full): Add comment (copy from generalize.h).
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoMove 'unsigned' keyword to XCTYPE in generalize-small template
Ivan Maidanski [Tue, 1 Jan 2013 16:26:28 +0000 (20:26 +0400)]
Move 'unsigned' keyword to XCTYPE in generalize-small template
(code refactoring)

* src/Makefile.am (atomic_ops/generalize-small.h): Add trailing '_'
to XSIZE and to its replacement; add "unsigned" prefix to the types
replacing XCTYPE (using empty comment as a delimiter between
"unsigned" keyword and char/short).
* src/atomic_ops/generalize-small.template: Remove "unsigned" keyword
at every XCTYPE.
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoFix generalize-small template adding missed CAS-based fetch_and_add
Ivan Maidanski [Wed, 2 Jan 2013 09:10:34 +0000 (13:10 +0400)]
Fix generalize-small template adding missed CAS-based fetch_and_add

* src/atomic_ops/generalize-small.template (AO_XSIZE_fetch_and_add):
Add missed definition based on CAS.
* src/atomic_ops/generalize-small.h: Regenerate.

11 years agoFix AO_XSIZE_load/store definition order in generalize-small template
Ivan Maidanski [Wed, 2 Jan 2013 08:31:08 +0000 (12:31 +0400)]
Fix AO_XSIZE_load/store definition order in generalize-small template

* src/atomic_ops/generalize-small.template (AO_XSIZE_load): Move
definition (which is based on AO_XSIZE_load_acquire) down to be after
AO_XSIZE_load_acquire definition.
* src/atomic_ops/generalize-small.template (AO_XSIZE_store): Move
definition (which is based on AO_XSIZE_store_release) down to be after
AO_XSIZE_store_release definition.
* src/atomic_ops/generalize-small.h : Regenerate.

11 years agoUse AO_ prefix for internal functions in arm_v6.h
Ivan Maidanski [Sun, 16 Dec 2012 16:07:02 +0000 (20:07 +0400)]
Use AO_ prefix for internal functions in arm_v6.h
(code refactoring)

* src/atomic_ops/sysdeps/armcc/arm_v6.h (AO_fetch_and_add,
AO_fetch_and_add1, AO_fetch_and_sub1, AO_compare_and_swap): Remove
useless comment.
* src/atomic_ops/sysdeps/armcc/arm_v6.h (load_ex, store_ex): Add
"AO_" prefix.

11 years agoUpdate TODO (add more targets with test_stack failure)
Ivan Maidanski [Sat, 15 Dec 2012 09:26:16 +0000 (13:26 +0400)]
Update TODO (add more targets with test_stack failure)

11 years agoUse AO_ prefix for inner routines in hppa.h; define AO_ldcw_align inner
Ivan Maidanski [Sat, 15 Dec 2012 09:09:45 +0000 (13:09 +0400)]
Use AO_ prefix for inner routines in hppa.h; define AO_ldcw_align inner
macro as expressions instead of block statement (code refactoring)

* src/atomic_ops/sysdeps/gcc/hppa.h (__ldcw, __PA_LDCW_ALIGNMENT,
__ldcw_align): Add "AO" prefix.
* src/atomic_ops/sysdeps/hpc/hppa.h (__ldcw, __PA_LDCW_ALIGNMENT,
__ldcw_align): Likewise.
* src/atomic_ops/sysdeps/gcc/hppa.h (AO_ldcw): Pass "ret" variable
name as macro argument instead of returning value; remove "{", "}"
braces.
* src/atomic_ops/sysdeps/gcc/hppa.h (AO_ldcw_align): Rename "a"
argument to "addr"; convert macro body from block statement to
expression.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_ldcw_align): Likewise.
* src/atomic_ops/sysdeps/gcc/hppa.h (AO_test_and_set_full): Declare
"ret" local volatile varible, pass it to AO_ldcw and return.
* src/atomic_ops/sysdeps/gcc/hppa.h (AO_test_and_set_full): Cast
result to AO_TS_VAL_t.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_test_and_set_full): Likewise.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_ldcw): Remove redundant
trailing ';' symbol.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_ldcw_align): Remove "ret"
argument, pass returned value as expression result instead; cast
returned value to "volatile unsigned *" type.
* src/atomic_ops/sysdeps/hpc/hppa.h (AO_pa_clear): Change "a" local
variable type from "unsigned long" to "volatile unsigned *" (matching
AO_ldcw_align returned value type).

11 years agoAdd missing parentheses to GC_MMAP_FLAGS in atomic_ops_malloc
Ivan Maidanski [Sat, 15 Dec 2012 08:24:24 +0000 (12:24 +0400)]
Add missing parentheses to GC_MMAP_FLAGS in atomic_ops_malloc

* src/atomic_ops_malloc.c (GC_MMAP_FLAGS): Add missing outermost
parentheses.

11 years agoImprove debug printing in test_stack
Thorsten Glaser [Sun, 9 Dec 2012 06:29:54 +0000 (10:29 +0400)]
Improve debug printing in test_stack

* tests/test_stack.c (main): Add debug printing of exper_n, nthreads,
max_nthreads and list_length before add_elements call (if VERBOSE).

11 years agoUpdate TODO file (remove gcc/alpha bug)
Ivan Maidanski [Fri, 9 Nov 2012 05:15:05 +0000 (09:15 +0400)]
Update TODO file (remove gcc/alpha bug)

11 years agoFix AO_stack_pop_explicit_aux_acquire for gcc-4.6.3/alpha
Ivan Maidanski [Fri, 9 Nov 2012 04:36:28 +0000 (08:36 +0400)]
Fix AO_stack_pop_explicit_aux_acquire for gcc-4.6.3/alpha

* src/atomic_ops_stack.c (AO_stack_pop_explicit_aux_acquire): Do not
use AO_EXPECT_FALSE for gcc-4/alpha (to workaround GCC v4.6.3 bug
causing test_stack failure).

12 years agoAdjust fprintf arguments type matching format specifier in test_stack
Ivan Maidanski [Tue, 23 Oct 2012 03:33:34 +0000 (07:33 +0400)]
Adjust fprintf arguments type matching format specifier in test_stack

* tests/test_stack.c (main): Cast "code" argument of fprintf calls to
unsigned int to match printf format specifier.

12 years agoAdd comment to AO_nop_write in ordered_except_wr.h
Ivan Maidanski [Tue, 23 Oct 2012 03:23:39 +0000 (07:23 +0400)]
Add comment to AO_nop_write in ordered_except_wr.h

* src/atomic_ops/sysdeps/ordered_except_wr.h (AO_nop_write): Add
comment (to outline that the implementation matches that of
AO_nop_read).

12 years agoSpecify AO_fetch_and_add/sub1 result is unused in test_atomic
Ivan Maidanski [Thu, 18 Oct 2012 15:53:34 +0000 (19:53 +0400)]
Specify AO_fetch_and_add/sub1 result is unused in test_atomic

* tests/test_atomic.c (add1sub1_thr): Explicitly cast result of
AO_fetch_and_sub1 and AO_fetch_and_add1 to void (to outline that the
result is unused intentionally); reformat code.

12 years agoUpdate ChangeLog file
Ivan Maidanski [Tue, 9 Oct 2012 07:44:04 +0000 (11:44 +0400)]
Update ChangeLog file

12 years agoReorder AO_double_t union elements for AO_DOUBLE_T_INITIALIZER portability
Ivan Maidanski [Tue, 9 Oct 2012 06:30:28 +0000 (10:30 +0400)]
Reorder AO_double_t union elements for AO_DOUBLE_T_INITIALIZER portability

* src/atomic_ops/sysdeps/standard_ao_double_t.h (AO_double_t):
Make "AO_parts" element to be the first one in the enum so that
AO_DOUBLE_T_INITIALIZER could be defined both strictly complying with
ANSI C standard (thus preventing "missing braces around initializer"
64-bit compiler warning) and independently of __m128 type definition;
add comment.
* src/atomic_ops/sysdeps/standard_ao_double_t.h
(AO_DOUBLE_T_INITIALIZER): Update to reflect the change in AO_double_t.

12 years agoEliminate warning for fetch_and_add argument in test_atomic_include
Ivan Maidanski [Mon, 8 Oct 2012 20:14:46 +0000 (00:14 +0400)]
Eliminate warning for fetch_and_add argument in test_atomic_include

* tests/test_atomic_include.template (test_atomicXX): Cast negative
"incr" argument (passed to fetch_and_add) to the unsigned proper type
(to eliminate MS VC compiler "signed/unsigned mismatch" warning).

12 years agoFix variable type to match printf format specifier in test_stack
Ivan Maidanski [Mon, 8 Oct 2012 20:06:19 +0000 (00:06 +0400)]
Fix variable type to match printf format specifier in test_stack

* tests/test_stack.c (run_one_test): Change type of "index" local
variable from long to int to match printf format specifier (when
VERBOSE defined); cast from "arg" pointer to integer via size_t (to
avoid 64-bit compiler warning).