This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH v3, middle end]: Fix PR 37908, thinko with atomic NAND operation, doc addendum
- From: "Uros Bizjak" <ubizjak at gmail dot com>
- To: "Richard Guenther" <richard dot guenther at gmail dot com>
- Cc: "Andrew Haley" <aph at redhat dot com>, "Jakub Jelinek" <jakub at redhat dot com>, "David Daney" <ddaney at caviumnetworks dot com>, "Lu, Hongjiu" <hongjiu dot lu at intel dot com>, "Lavery, Daniel M" <daniel dot m dot lavery at intel dot com>, "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 5 Nov 2008 14:50:52 +0100
- Subject: Re: [PATCH v3, middle end]: Fix PR 37908, thinko with atomic NAND operation, doc addendum
Hello!
Just a small documentation update as a followup to the patch:
Index: extend.texi
===================================================================
--- extend.texi (revision 141602)
+++ extend.texi (working copy)
@@ -5774,9 +5774,12 @@
@smallexample
@{ tmp = *ptr; *ptr @var{op}= value; return tmp; @}
-@{ tmp = *ptr; *ptr = ~tmp & value; return tmp; @} // nand
+@{ tmp = *ptr; *ptr = ~(tmp & value); return tmp; @} // nand
@end smallexample
+@emph{Note:} GCC 4.4 and later implement @code{__sync_fetch_and_nand}
+builtin as @code{*ptr = ~(tmp & value)} instead of @code{*ptr = tmp & value}.
+
@item @var{type} __sync_add_and_fetch (@var{type} *ptr, @var{type} value, ...)
@itemx @var{type} __sync_sub_and_fetch (@var{type} *ptr, @var{type} value, ...)
@itemx @var{type} __sync_or_and_fetch (@var{type} *ptr, @var{type} value, ...)
@@ -5794,9 +5797,13 @@
@smallexample
@{ *ptr @var{op}= value; return *ptr; @}
-@{ *ptr = ~*ptr & value; return *ptr; @} // nand
+@{ *ptr = ~(*ptr & value); return *ptr; @} // nand
@end smallexample
+@emph{Note:} GCC 4.4 and later implement @code{__sync_nand_and_fetch}
+builtin as @code{*ptr = ~(*ptr & value)} instead of
+@code{*ptr = ~*ptr & value}.
+
@item bool __sync_bool_compare_and_swap (@var{type} *ptr, @var{type}
oldval @var{type} newval, ...)
@itemx @var{type} __sync_val_compare_and_swap (@var{type} *ptr,
@var{type} oldval @var{type} newval, ...)
@findex __sync_bool_compare_and_swap
Uros.