[RS6000] Tests that use int128_t and -m32
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr57744.c
blob617ac56f09c2a5f9551a44a589db4288456b95a7
1 /* { dg-do run { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_p8vector_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -O3" } */
6 void abort (void);
8 typedef unsigned U_16 __attribute__((mode(TI)));
10 extern int libat_compare_exchange_16 (U_16 *, U_16 *, U_16, int, int)
11 __attribute__((__noinline__));
13 /* PR 57744: lqarx/stqcx needs even/odd register pairs. The assembler will
14 complain if the compiler gets an odd/even register pair. Create a function
15 which has the 16 byte compare and exchange instructions, but don't actually
16 execute it, so that we can detect these failures on older machines. */
18 int
19 libat_compare_exchange_16 (U_16 *mptr, U_16 *eptr, U_16 newval,
20 int smodel, int fmodel __attribute__((unused)))
22 if (((smodel) == 0))
23 return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 0, 0);
24 else if (((smodel) != 5))
25 return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 4, 0);
26 else
27 return __atomic_compare_exchange_n (mptr, eptr, newval, 0, 5, 0);
30 U_16 a = 1, b = 1, c = -2;
31 volatile int do_test = 0;
33 int main (void)
35 if (do_test && !libat_compare_exchange_16 (&a, &b, c, 0, 0))
36 abort ();
38 return 0;