Debian Codegraph @

gcc/testsuite/gcc.target/i386/pr102566-10a.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2" } */
3
4 #include <stdatomic.h>
5 #include <stdbool.h>
6
7 bool
8 foo (_Atomic int *v, int bit)
9 {
10 int mask = 1 << bit;
11 return atomic_fetch_and_explicit (v, ~mask, memory_order_relaxed) & mask;
12 }
13
14 /* { dg-final { scan-assembler-times "lock;?\[ \t\]*btrl" 1 } } */
15 /* { dg-final { scan-assembler-not "cmpxchg" } } */