Commit Graph

361 Commits

Author SHA1 Message Date
Andrey Semashev
8c48149323 Disabled build jobs not supported by AppVeyor and Boost.Thread. Trying to find MinGW 32-bit compiler. 2017-09-25 12:02:28 +03:00
Andrey Semashev
a6443ca5b9 Updated test jobs to fix compilation. 2017-09-25 00:53:23 +03:00
Andrey Semashev
b8bc4f372b Fixed ADDRESS_MODEL setting. 2017-09-24 22:54:18 +03:00
Andrey Semashev
31be8fe513 Added CI build scripts. 2017-09-24 22:50:08 +03:00
Andrey Semashev
de22c6a203 Added a link to a gcc bug in the comment about consume/acquire MO. 2017-09-20 13:50:33 +03:00
Andrey Semashev
d826930e86 Added support for returning values in flags from asm blocks for gcc x86 backend. 2017-09-02 19:30:55 +03:00
Andrey Semashev
f2aae8936a Avoid passing storage types via template parameters as it generates warnings about dropping attributes in gcc 7. 2017-09-02 19:17:27 +03:00
Andrey Semashev
1972f1c96e Added support for returning values in flags from asm blocks in x86 DCAS. 2017-09-02 19:07:20 +03:00
Andrey Semashev
87a904edf4 Updated DCAS compatibility with gcc 7 on x86-64.
Gcc 7 removed support for __atomic intrinsics on 16-byte operands on x86-64 and
instead always generates library calls to libatomic, thus breaking user's code
compilation due to having to link with the library. Also, the assembler tends
to generate warnings when implicit zero displacement is used in memory operands.
2017-09-02 17:47:13 +03:00
Andrey Semashev
fbe1e8baf2 Revert "Revert "Use BOOST_MAY_ALIAS from Boost.Config.""
This reverts commit 06c36dce48.
2017-08-26 15:10:15 +03:00
Andrey Semashev
06c36dce48 Revert "Use BOOST_MAY_ALIAS from Boost.Config."
This reverts commit bbd32145ef.

This is a temporary revert until Boost.Config is merged to master.
2017-08-24 13:17:44 +03:00
Andrey Semashev
23d5770bde Minor docs formatting correction. 2017-08-06 22:09:41 +03:00
Andrey Semashev
b23afe4b0c Added docs for atomic_flag. 2017-08-06 22:04:26 +03:00
Andrey Semashev
573732ea4a Added a workaround for libstdc++ not specializing numeric_limits for __int128 in strict mode. 2017-07-29 18:13:27 +03:00
Andrey Semashev
bbd32145ef Use BOOST_MAY_ALIAS from Boost.Config. 2017-07-29 16:54:52 +03:00
Andrey Semashev
a980d1c3ba Attempt to work around absent opereator<< for __int128 in some libstdc++ versions. 2017-07-20 23:46:54 +03:00
Andrey Semashev
4467cfbd3b Documented the extra operations added as an extension of Boost.Atomic.
Also made a few wording corrections and added is_always_lock_free and
a section about atomic<> typedefs. Clarified the status quo regarding
memory_order_consume. Removed the obsolete preudo-header for doxygen
that was not used for docs (if we want doxygen, it's better to
add comments to the real headers anyway).
2017-07-19 22:05:20 +03:00
Andrey Semashev
c172831e5d Added a workaround for gcc on PPC not providing operator<< for __int128. 2017-07-17 01:15:04 +03:00
Andrey Semashev
6a5928759a Added extra ops for PPC. Added 8 and 16-bit ops for PPC8+.
The new implementation of 8 and 16-bit ops uses the lbarx/stbcx and
lharx/sthcx instructions available in Power8 and later architectures.
This allows to use smaller storage types, similar to those used by
compiler intrinsics.

Also added detection of 128-bit instructions lqarx/stqcx, which can
later be used to implement 128-bit ops.
2017-07-17 00:39:20 +03:00
Andrey Semashev
c4f757d6bb Added extra ops implementation for ARM on gcc. 2017-07-16 18:15:18 +03:00
Andrey Semashev
a41cdf093e Extracted common hardware capabilities macros to separate headers.
Also refactored ARM hwcaps detection a bit and fixed compilation for
generic ARMv7, which does not provide 64-bit ldrexd/strexd.
2017-07-14 22:43:19 +03:00
Andrey Semashev
b2c6d37a1a Added byte/word-wide implementations of atomic ops on ARM.
Use ldrexb/w and strexb/w on ARMv7 and later to implement byte/word-wide
atomic ops. On the older ARM versions we still have to use 32-bit
widening implementation.

Also allowed immediate constants in some of the operations to improve
generated code.

Common ARM code extracted to a separate header to reuse with extra ops.
2017-07-14 19:25:01 +03:00
Andrey Semashev
ffb529c4c3 Silence MSVC warnings. 2017-07-11 23:00:52 +03:00
Andrey Semashev
5b28e12f1d Fixed tests to accommodate MSVC bugs and improved diagnostics.
Fixed incorrect calculation of the min distance limit for arithmetic tests.

Moved some of the arithmetic tests to a separate function because
otherwise MSVC-10 for x64 generated broken code (the code would use
garbage values in registers to pass arguments to
add_and_test/sub_and_test).

Added output operators and employed newer test macros that output compared
values in case of test failure.
2017-07-11 23:00:52 +03:00
Andrey Semashev
4f38bb4f85 Added opaque variants of negate and complement ops for MSVC. 2017-07-11 23:00:52 +03:00
Andrey Semashev
538b411c4a Added MSVC backend for extra operations. 2017-07-11 23:00:52 +03:00
Andrey Semashev
3622ce85c7 Updated test to avoid signed overflows when add_and_test/sub_and_test is
called on pointer types.
2017-07-11 23:00:52 +03:00
Andrey Semashev
d375cf0dff Modified 8 and 16-bit CAS loops to employ register renaming. 2017-07-11 23:00:52 +03:00
Andrey Semashev
e30c54754b Replaced fixed temporary register in CAS loops with a temporary variable
This allows for more flexibility in register allocation and potentially
more efficient code. Also, the temporary register was not exactly
customizable in the previous code, so it should have been cleaned up
anyway.
2017-07-11 23:00:52 +03:00
Andrey Semashev
537656d67d Reworked extra operations definition.
In order to support more flexible definition of the extra operations for
different platforms, define extra_operations as an addon to the existing
operations template. The extra_operations template will be used only by
the non-standard operations added by Boost.Atomic.
2017-07-11 23:00:52 +03:00
Andrey Semashev
6d7c0ec2ee Added generic implementation of extended ops. Reorganized platform macros. 2017-07-11 23:00:52 +03:00
Andrey Semashev
65d0d557f1 Fixed a test constant, added a few more checks. 2017-07-11 23:00:52 +03:00
Andrey Semashev
17ebc37de8 Fixed incorrect asm constraints. Also optimized 64-bit asm to allow 32-bit immediates. 2017-07-11 23:00:52 +03:00
Andrey Semashev
158a114325 Corrected test constants. 2017-07-11 23:00:52 +03:00
Andrey Semashev
ce42659b6d Fixed compilation issues and incorrect use of cmpxchg. Added extended ops to the interface. 2017-07-11 23:00:52 +03:00
Andrey Semashev
add6f5640c Added tests for the new operations. 2017-07-11 23:00:52 +03:00
Andrey Semashev
42024329d7 Corrected constant constraints for bit test ops. 2017-07-11 23:00:52 +03:00
Andrey Semashev
5c554ee284 Preliminary version of extended atomic ops for x86. 2017-07-11 23:00:52 +03:00
Andrey Semashev
a6b01a8429 Disable cast-based implementation for MSVC because it generates broken code sometimes. 2017-07-11 23:00:02 +03:00
Andrey Semashev
b23c406f94 Converted Unicode characters in comments to ASCII. 2017-06-25 16:22:44 +03:00
Andrey Semashev
4ee227c6f2 Simplified use of __has_attribute. Also use __may_alias__ instead of may_alias. 2017-05-29 12:02:04 +03:00
Andrey Semashev
0786398120 Silence bogus gcc warnings about missing struct member initializers. 2017-05-29 11:49:27 +03:00
Andrey Semashev
be5ed8a1c5 Fixed compilation with gcc <= 4.9. Renamed BOOST_ATOMIC_DETAIL_STORAGE_MAY_ALIAS to BOOST_ATOMIC_DETAIL_STORAGE_TYPE_MAY_ALIAS as it is a more precise naming. 2017-05-27 18:11:06 +03:00
Andrey Semashev
7919698b2a Changed is_lock_free() implementation to always use is_always_lock_free.
This is to follow C++17, which says is_lock_free(), for any object of a given
atomic<> type, must return values consistent with is_always_lock_free.
2017-05-25 13:38:39 +03:00
Andrey Semashev
b7dba02b73 In addition to compiler checks for may_alias support, use __has_attribute as well. 2017-05-25 12:54:34 +03:00
Andrey Semashev
ca151bedb4 Fixed warnings about left-shifting negative signed integers. 2017-05-22 15:21:22 +03:00
Andrey Semashev
7c6917948d Use BOOST_INTEL_CXX_VERSION instead of __INTEL_COMPILER to use workarounds for compiler bugs present in Boost.Config. 2017-05-21 21:44:20 +03:00
Andrey Semashev
11967cc8e2 Mark storage type capable of aliasing other types and simplify CAS when possible
This is an attempt to improve generated code in the calling application that
involves CAS in a tight loop. The neccessity to cast between the value type and
the storage type for the `expected` argument results in inefficient code
that involves copying of the expected value and also saving the CAS result on
the stack. This has been observed at least with gcc 6.3 with a tight loop
on the user's side.

When we can ensure that the storage type can safely alias other types, and the
value type has the same size as the storage type, we can simplify CAS by
performing type punning on the `expected` reference instead of copying it back
and forth.
2017-05-21 17:50:16 +03:00
Andrey Semashev
cf3c4a2d5a Fixed a typo. 2017-04-04 15:54:53 +03:00
Andrey Semashev
f1dc715e41 Added __ARM_ARCH_8A__ to the preprocessor check for ARM. 2017-04-04 15:53:18 +03:00