aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2016-01-13 19:07:21 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2016-01-13 19:07:21 +0000
commit260936f29d63bb0cebfd624804c915e528aea575 (patch)
tree71bba69fcc54ed2e710937d7b5b9304f6c25f93f /gcc
parent398d6febaf20997eedb94bec295e50bd7fc6ed82 (diff)
downloadgcc-260936f29d63bb0cebfd624804c915e528aea575.zip
gcc-260936f29d63bb0cebfd624804c915e528aea575.tar.gz
gcc-260936f29d63bb0cebfd624804c915e528aea575.tar.bz2
Clarify __atomic_compare_exchange effects
* doc/extend.texi (__atomic Builtins): Clarify compare_exchange effects. From-SVN: r232341
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/doc/extend.texi13
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ae3afde..a759568 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2016-01-13 Jonathan Wakely <jwakely@redhat.com>
+
+ * doc/extend.texi (__atomic Builtins): Clarify compare_exchange
+ effects.
+
2016-01-13 Richard Henderson <rth@redhat.com>
PR tree-opt/68964
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 8122c4c..b85c34c 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -9559,17 +9559,18 @@ This compares the contents of @code{*@var{ptr}} with the contents of
@code{*@var{expected}}. If equal, the operation is a @emph{read-modify-write}
operation that writes @var{desired} into @code{*@var{ptr}}. If they are not
equal, the operation is a @emph{read} and the current contents of
-@code{*@var{ptr}} is written into @code{*@var{expected}}. @var{weak} is true
-for weak compare_exchange, and false for the strong variation. Many targets
+@code{*@var{ptr}} are written into @code{*@var{expected}}. @var{weak} is true
+for weak compare_exchange, which may fail spuriously, and false for
+the strong variation, which never fails spuriously. Many targets
only offer the strong variation and ignore the parameter. When in doubt, use
the strong variation.
-True is returned if @var{desired} is written into
-@code{*@var{ptr}} and the operation is considered to conform to the
+If @var{desired} is written into @code{*@var{ptr}} then true is returned
+and memory is affected according to the
memory order specified by @var{success_memorder}. There are no
restrictions on what memory order can be used here.
-False is returned otherwise, and the operation is considered to conform
+Otherwise, false is returned and memory is affected according
to @var{failure_memorder}. This memory order cannot be
@code{__ATOMIC_RELEASE} nor @code{__ATOMIC_ACQ_REL}. It also cannot be a
stronger order than that specified by @var{success_memorder}.
@@ -9678,7 +9679,7 @@ alignment. A value of 0 indicates typical alignment should be used. The
compiler may also ignore this parameter.
@smallexample
-if (_atomic_always_lock_free (sizeof (long long), 0))
+if (__atomic_always_lock_free (sizeof (long long), 0))
@end smallexample
@end deftypefn