[LLVMdev] AtomicRMW Additions
Philip Reames
listmail at philipreames.com
Thu Jan 2 22:03:07 PST 2014
On 01/02/2014 07:40 PM, William Moses wrote:
> All,
>
> I was wondering if the following operations could be implemented
> atomically in LLVM (a la AtomicRMW): Multiplication, Division,
> Remainder, Bit Shifting, or Logical Not (this could be implemented by
> xor with a value of all 1's).
>
> Is there a reason implementation-wise that they are not there?
>
If all your concerned about is atomicity (and not progress or
efficiency), any of these can be implemented using CAS and their normal
non-atomic arithmetic instructions. As such, they would not require any
extensions.
> Additionally, would it be possible to create something similar to
> AtomicRMW that returned the new value instead of the old one?
This seems like a straight forward operation that could be described
easily in the existing IR. Are you trying to model a particular
hardware architecture? Generally, any background you can provide would
be helpful in understanding your problem.
Philip
More information about the llvm-dev
mailing list