core.sync: add atomic compare-and-swap primitive based on CMPXCHG
core.sync: add atomic compare-and-swap primitive based on CMPXCHG

The cas function provided in this commit is quite primitive: it expects its
arguments to be of type int (no other types supported, unsigned ints will work
unless they are truncated during type conversion). Time will show if fancier
type support is required or desired.

snabbco/snabb,dpino/snabbswitch,eugeneia/snabb,dpino/snabb,alexandergall/snabbswitch,Igalia/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,Igalia/snabb,eugeneia/snabb,snabbco/snabb,snabbco/snabb,Igalia/snabbswitch,snabbco/snabb,eugeneia/snabbswitch,Igalia/snabb,dpino/snabb,Igalia/snabbswitch,SnabbCo/snabbswitch,Igalia/snabbswitch,eugeneia/snabb,dpino/snabbswitch,eugeneia/snabb,dpino/snabb,snabbco/snabb,eugeneia/snabbswitch,alexandergall/snabbswitch,eugeneia/snabb,eugeneia/snabb,snabbco/snabb,Igalia/snabbswitch,eugeneia/snabb,SnabbCo/snabbswitch,Igalia/snabb,eugeneia/snabbswitch,alexandergall/snabbswitch,SnabbCo/snabbswitch,eugeneia/snabbswitch,snabbco/snabb,alexandergall/snabbswitch,dpino/snabb,dpino/snabb,eugeneia/snabb,dpino/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,alexandergall/snabbswitch,Igalia/snabb,Igalia/snabb,dpino/snabb,SnabbCo/snabbswitch,dpino/snabbswitch,Igalia/snabb,alexandergall/snabbswitch,snabbco/snabb,dpino/snabb