| 1 |
/* { dg-options "-O2 -std=c11" } */ |
| 2 |
/* { dg-require-effective-target lp64 } */ |
| 3 |
|
| 4 |
/* This tests if the instructions used for C atomic are optimised properly |
| 5 |
as atomic by the target code, too. */ |
| 6 |
|
| 7 |
#include <stdatomic.h> |
| 8 |
|
| 9 |
int load(_Atomic int *ptr) |
| 10 |
{ |
| 11 |
return atomic_load_explicit(ptr, memory_order_relaxed); |
| 12 |
} |
| 13 |
|
| 14 |
/* There should be only two machine instructions, an lwa and a blr: */ |
| 15 |
/* { dg-final { scan-assembler-times {(?n)^\s+[a-z]} 2 } } */ |
| 16 |
/* { dg-final { scan-assembler-times {\mlwa\M} 1 } } */ |