blob: 2de04e57e9ee4b61dab60198e652589e9efb5e7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* { dg-do compile } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler "xchg4 .*, r0" } } */
/* { dg-final { scan-assembler "cmpxchg4.*, r0, .*" } } */
/* { dg-final { scan-assembler "cmpxchg8.*, r0, .*" { target lp64 } } } */
int
foo1 (int *p)
{
return __sync_lock_test_and_set (p, 0);
}
int
foo2 (int *p, int v)
{
return __sync_bool_compare_and_swap (p, v, 0);
}
long
foo3 (long *p, long v)
{
return __sync_bool_compare_and_swap (p, v, 0);
}
|