herd / herdtools7

The Herd toolsuite to deal with .cat memory models (version 7.xx)
Other
215 stars 54 forks source link

Implementation of atomic_add_unless #868

Open hernanponcedeleon opened 2 months ago

hernanponcedeleon commented 2 months ago

I am taking a look to the implementation of atomic_add_unless from the kernel.

From the parser, it seems there are two variants: one value returning (associated to atomic_add_unless) and a non-value returning one (associated to __atomic_add_unless). This seems to divert from other instructions where __atomic_X is the internal herd7's representation and atomic_X is defined in terms of the previous one in the .def file. There is nothing in the current .def file about atomic_add_unless.

Unless I am missing something, I think we can remove the ret bool parameter in the constructor, always return a value (AFAIK this is the intended behavior of this instruction in LKMM), remove atomic_add_unless from the parser and define it in the .def file as atomic_add_unless(X,V,U) __atomic_add_unless(X,V,U).