0001 C ISA2+pooncerelease+poacquirerelease+poacquireonce
0002
0003 (*
0004 * Result: Never
0005 *
0006 * This litmus test demonstrates that a release-acquire chain suffices
0007 * to order P0()'s initial write against P2()'s final read. The reason
0008 * that the release-acquire chain suffices is because in all but one
0009 * case (P2() to P0()), each process reads from the preceding process's
0010 * write. In memory-model-speak, there is only one non-reads-from
0011 * (AKA non-rf) link, so release-acquire is all that is needed.
0012 *)
0013
0014 {}
0015
0016 P0(int *x, int *y)
0017 {
0018 WRITE_ONCE(*x, 1);
0019 smp_store_release(y, 1);
0020 }
0021
0022 P1(int *y, int *z)
0023 {
0024 int r0;
0025
0026 r0 = smp_load_acquire(y);
0027 smp_store_release(z, 1);
0028 }
0029
0030 P2(int *x, int *z)
0031 {
0032 int r0;
0033 int r1;
0034
0035 r0 = smp_load_acquire(z);
0036 r1 = READ_ONCE(*x);
0037 }
0038
0039 exists (1:r0=1 /\ 2:r0=1 /\ 2:r1=0)