On Tue, Jul 29, 2014 at 2:10 PM, Nathan Hjelm <hjelmn_at_[hidden]> wrote:
> Is there a reason why the
> current implementations of opal atomics (add, cmpset) do not return the
> old value?
Because some CPUs don't implement such an atomic instruction?
On any CPU one *can* certainly synthesize the desired operation with an
added read before the compare-and-swap to return a value that was present
at some time before a failed cmpset. That is almost certainly sufficient
for your purposes. However, the added load makes it (marginally) more
expensive on some CPUs that only have the native equivalent of gcc's
Paul H. Hargrove PHHargrove_at_[hidden]
Future Technologies Group
Computer and Data Sciences Department Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory Fax: +1-510-486-6900