1 /* { dg-do compile { target { powerpc*-*-* } } } */
2 /* { dg-require-effective-target powerpc_p8vector_ok } */
3 /* { dg-skip-if "" { powerpc*-*-aix* } } */
4 /* { dg-options "-mdejagnu-cpu=power7" } */
5 
6 /* This test should succeed on both 32- and 64-bit configurations.  */
7 #include <altivec.h>
8 
9 /* Test for the byte atomic operations on power8 using lbarx/stbcx.  */
10 __attribute__((target("cpu=power8")))
11 char
char_fetch_add_relaxed(char * ptr,int value)12 char_fetch_add_relaxed (char *ptr, int value)
13 {
14   return __atomic_fetch_add (ptr, value, __ATOMIC_RELAXED);
15 }
16 
17 /* { dg-final { scan-assembler-times "lbarx" 1 } } */
18