This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Atomic floats on x86_64
- From: Andrew Haley <aph at redhat dot com>
- To: NightStrike <nightstrike at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 10 Nov 2014 15:32:13 +0000
- Subject: Re: Atomic floats on x86_64
- Authentication-results: sourceware.org; auth=none
- References: <CAF1jjLsWNjKFacHn8V_fnc73K9mF9u04G554=qmmcqKw4uN6Jw at mail dot gmail dot com> <54607E4F dot 9070805 at redhat dot com> <CAF1jjLtq14CZ+j--myUwnrpscB9vK-D-d8PrUO8ikdZoKmg1VA at mail dot gmail dot com>
On 11/10/2014 12:50 PM, NightStrike wrote:
> On Mon, Nov 10, 2014 at 3:58 AM, Andrew Haley <aph@redhat.com> wrote:
>> On 09/11/14 18:56, NightStrike wrote:
>>> Is it a bug that I can atomically store a float using __atomic_store,
>>> but not __atomic_store_n? I'd really like to be able to do it without
>>> the extra layer of indirection and the extra requirement of a temp
>>> variable that I don't need.
>>
>> I don't get this. Can you explain a bit more, or provide a test case?
>> There shouldn't be any loss of performance.
>
> For me, it's not a matter of performance (at least I hope, I didn't
> measure). It's more a matter of convenience. I can't just atomically
> stick a literal into a float. I have to create temp variables
> instead.
This stuff is part of C11. Given that what you need is
float b;
atomic_store_explicit(&b, 5.0f, memory_order_release);
I'm having a very difficult time understanding what problem in GCC
you're trying to solve. If you really insist on using an old GCC
or an old standard you can use a trivial inline function.
Andrew.