[PATCH, middle end]: Fix PR 37908, thinko with atomic NAND operation

Richard Guenther richard.guenther@gmail.com
Wed Oct 29 15:13:00 GMT 2008


On Tue, Oct 28, 2008 at 11:04 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Oct 28, 2008 at 02:42:49PM -0700, David Daney wrote:
>> Lu, Hongjiu wrote:
>>> According to Dan, __sync_fetch_and_nand intrinsic should be implemented as ~(target & val). Uros's patch is correct.
>>
>> At a minimum, it is incomplete.  If one were to change the semantics of
>> __sync_fetch_and_nand, they probably should do it universally rather
>> than just for a subset of GCC's targets.
>>
>> The MIPS port would have to be changed, and IIRC sparc as well.
>
> mips, alpha, ia64 and rs6000 to be precise.
> And certainly big fat warning in the documentation, both in the builtins
> section and in gcc-4.4 release notes.

I would even say we should unconditionally warn on the use of
__sync_fetch_and_nand
(discouraging its use effectively) :/  And we should backport this
warning patch but not
the change in semantics.

Of course we should be _really_ sure that we do the correct thing this time ;)

Richard.

>        Jakub
>



More information about the Gcc-patches mailing list