This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix parisc atomic locking builtins for libgomp
On Mon, Nov 24, 2008 at 2:38 PM, John David Anglin
<dave@hiauly1.hia.nrc.ca> wrote:
>> When is the store at 2 not completed?
>
> The store is not executed when r28 != r25 (the instruction after
> the sub is nullified) by the completer "<>". So, the exchange doesn't
> occur when the old value passed by the caller doesn't equal the
> old value in the memory relocation.
Thanks for explaining that. Looking over the GCC code I understand the issue.
The error code returned by the kernel helper indicates if the function
completed atomically, not if the cmpxchg was successful at writing a
new value into the address.
> It might have been better to return an error code when the exchange
> doesn't occur. This would have avoided the extra check.
We want to avoid adding instructions to the uninterruptable fast-path.
Thanks for tracking this down Helge!
Cheers,
Carlos.