Debian Codegraph @

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

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