[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr57744.c
blob9e51dc7fb9c03e5ae86a958d50b852962809aa34
1 /* { dg-do run { target { powerpc*-*-* && lp64 } } } */
2 /* { dg-skip-if "" { powerpc*-*-darwin* } } */
3 /* { dg-require-effective-target powerpc_vsx_ok } */
4 /* { dg-options "-mdejagnu-cpu=power8 -mvsx -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;