This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Atomic floats on x86_64


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]