[LLVMdev] Floating point atomic load and add

Philip Reames listmail at philipreames.com
Sun Apr 26 12:54:59 PDT 2015


On 04/24/2015 01:53 PM, Tyler Denniston wrote:
> Hello,
>
> 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".
The AtomicRMW instruction doesn't natively support floating point 
types.  You can emulate what you're looking for with a bitcast of the 
float to an appropriately sized integer, a AtomicRMW on that, and then a 
bitcast of the result.  This would have the result of CASing in the 
bitpattern of the original float which is probably what you intend.
>
> I am using LLVM 3.4 and the only system I need to support is x86.
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list