Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr102566-7.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 #include <stdatomic.h>
5 #include <stdbool.h>
6
7 typedef int __attribute__ ((mode (__word__))) int_type;
8
9 #define BIT (1 << 0)
10
11 bool
12 foo0 (_Atomic int_type *v)
13 {
14 return atomic_fetch_or_explicit (v, BIT, memory_order_relaxed) & ~1;
15 }
16
17 bool
18 foo1 (_Atomic int_type *v)
19 {
20 return atomic_fetch_or_explicit (v, BIT, memory_order_relaxed) & ~2;
21 }
22
23 bool
24 foo2 (_Atomic int_type *v)
25 {
26 return atomic_fetch_or_explicit (v, BIT, memory_order_relaxed) & ~3;
27 }
28
29 /* { dg-final { scan-assembler-times "lock;?\[ \t\]*cmpxchg" 3 } } */
30 /* { dg-final { scan-assembler-not "bts" } } */