| 1 |
/* PR target/103068 */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-additional-options "-O2 -march=x86-64 -mtune=generic -mrelax-cmpxchg-loop" } */ |
| 4 |
/* { dg-final { scan-assembler-times "rep;?\[ \\t\]+nop" 32 } } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
#define FUNC_ATOMIC(TYPE, OP) \ |
| 9 |
__attribute__ ((noinline, noclone)) \ |
| 10 |
TYPE f_##TYPE##_##OP##_fetch (TYPE *a, TYPE b) \ |
| 11 |
{ \ |
| 12 |
return __atomic_##OP##_fetch (a, b, __ATOMIC_RELAXED); \ |
| 13 |
} \ |
| 14 |
__attribute__ ((noinline, noclone)) \ |
| 15 |
TYPE f_##TYPE##_fetch_##OP (TYPE *a, TYPE b) \ |
| 16 |
{ \ |
| 17 |
return __atomic_fetch_##OP (a, b, __ATOMIC_RELAXED); \ |
| 18 |
} |
| 19 |
|
| 20 |
FUNC_ATOMIC (int64_t, and) |
| 21 |
FUNC_ATOMIC (int64_t, nand) |
| 22 |
FUNC_ATOMIC (int64_t, or) |
| 23 |
FUNC_ATOMIC (int64_t, xor) |
| 24 |
FUNC_ATOMIC (int, and) |
| 25 |
FUNC_ATOMIC (int, nand) |
| 26 |
FUNC_ATOMIC (int, or) |
| 27 |
FUNC_ATOMIC (int, xor) |
| 28 |
FUNC_ATOMIC (short, and) |
| 29 |
FUNC_ATOMIC (short, nand) |
| 30 |
FUNC_ATOMIC (short, or) |
| 31 |
FUNC_ATOMIC (short, xor) |
| 32 |
FUNC_ATOMIC (char, and) |
| 33 |
FUNC_ATOMIC (char, nand) |
| 34 |
FUNC_ATOMIC (char, or) |
| 35 |
FUNC_ATOMIC (char, xor) |