[LLVMdev] Floating point atomic load and add

Tyler Denniston tyler at csail.mit.edu
Fri Apr 24 14:15:40 PDT 2015


Quoting Tim Northover <t.p.northover at gmail.com>:

> On 24 April 2015 at 13:53, Tyler Denniston <tyler at csail.mit.edu> wrote:
>> I'm wondering how I can create an atomic load and add instruction for
>> floating point values. If I use      IRBuilder::CreateAtomicRMW() I get the
>> error message: "atomicrmw operand must have integer type".
>
> I don't think x86 allows you to use a lock prefix on floating point
> instructions, just basic arithmetic and cmpxchg. You'll probably need
> to put a loop around cmpxchg instructions to emulate it. (and might
> well need to cast the pointers to integer type for the cmpxchg, I know
> we talked about allowing floats there but I'm not sure it's happened
> yet).

Hmm, ok. Can you briefly expand on how I should emulate this behavior?  
I don't understand what you mean by adding a loop around cmpxchg.

Thanks,

Tyler




More information about the llvm-dev mailing list