…
AArch64 RfiSwp
(*
Test the specific total order case of atomicity,
where extern write (by P0) is gmo-in-between
of R and W of an atomic pair (by P1).
P2 is here to force store-forwarding on P1.
Swap version.
*)
{
0:X1=x;
1:X1=x; 1:X5=y;
2:X1=x; 2:X5=y;
}
P0 | P1 | P2 ;
MOV W0,#1 | MOV W0,#2 | MOV W0,#1 ;
STR W0,[X1] | STR W0,[X1] | STR W0,[X5] ;
| MOV W3,#3 | DMB SY ;
| SWP W3,W2,[X1] | LDR W2,[X1] ;
| AND W9,W2,#128 | ;
| LDR W8,[X5,W9,SXTW] | ;
Observed
x=3; 2:X2=2; 1:X8=0; 1:X2=2;
and x=1; 2:X2=2; 1:X8=0; 1:X2=2;
and x=3; 2:X2=1; 1:X8=0; 1:X2=2;
and x=1; 2:X2=0; 1:X8=0; 1:X2=2;
and x=3; 2:X2=1; 1:X8=0; 1:X2=1;