18c2ecf20Sopenharmony_ciC ISA2+pooncerelease+poacquirerelease+poacquireonce
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci(*
48c2ecf20Sopenharmony_ci * Result: Never
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This litmus test demonstrates that a release-acquire chain suffices
78c2ecf20Sopenharmony_ci * to order P0()'s initial write against P2()'s final read.  The reason
88c2ecf20Sopenharmony_ci * that the release-acquire chain suffices is because in all but one
98c2ecf20Sopenharmony_ci * case (P2() to P0()), each process reads from the preceding process's
108c2ecf20Sopenharmony_ci * write.  In memory-model-speak, there is only one non-reads-from
118c2ecf20Sopenharmony_ci * (AKA non-rf) link, so release-acquire is all that is needed.
128c2ecf20Sopenharmony_ci *)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci{}
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ciP0(int *x, int *y)
178c2ecf20Sopenharmony_ci{
188c2ecf20Sopenharmony_ci	WRITE_ONCE(*x, 1);
198c2ecf20Sopenharmony_ci	smp_store_release(y, 1);
208c2ecf20Sopenharmony_ci}
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciP1(int *y, int *z)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	int r0;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci	r0 = smp_load_acquire(y);
278c2ecf20Sopenharmony_ci	smp_store_release(z, 1);
288c2ecf20Sopenharmony_ci}
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciP2(int *x, int *z)
318c2ecf20Sopenharmony_ci{
328c2ecf20Sopenharmony_ci	int r0;
338c2ecf20Sopenharmony_ci	int r1;
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci	r0 = smp_load_acquire(z);
368c2ecf20Sopenharmony_ci	r1 = READ_ONCE(*x);
378c2ecf20Sopenharmony_ci}
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ciexists (1:r0=1 /\ 2:r0=1 /\ 2:r1=0)
40