[LLVMdev] Floating point atomic load and add

Tim Northover
Fri, 24 Apr 2015 21:06:05 -0000

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).

Cheers.

Tim.