Debian Codegraph @

gcc/testsuite/gcc.target/riscv/amo/pr114130.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-march=rv64gc -mabi=lp64" } */
3 #include <stdint-gcc.h>
4
5 void foo(uint32_t *p) {
6 uintptr_t x = *(uintptr_t *)p;
7 uint32_t e = !p ? 0 : (uintptr_t)p >> 1;
8 uint32_t d = (uintptr_t)x;
9 __atomic_compare_exchange(p, &e, &d, 0, __ATOMIC_RELAXED, __ATOMIC_RELAXED);
10 }
11
12 /* { dg-final { scan-assembler-bound {sext.w\t} >= 1 } } */