blob: 39ea1f56a28d284db9fff3ad082bf67ed7ddd737 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
C cmpxchg-fail-unordered-1
(*
* Result: Sometimes
*
* Demonstrate that a failing cmpxchg() operation does not act as a
* full barrier. (In contrast, a successful cmpxchg() does act as a
* full barrier.)
*)
{}
P0(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*x, 1);
r1 = cmpxchg(z, 1, 0);
r0 = READ_ONCE(*y);
}
P1(int *x, int *y, int *z)
{
int r0;
int r1;
WRITE_ONCE(*y, 1);
r1 = cmpxchg(z, 1, 0);
r0 = READ_ONCE(*x);
}
locations[0:r1;1:r1]
exists (0:r0=0 /\ 1:r0=0)
|