[testsuite] require sqrt_insn effective target where needed
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr46728-4.c
blob249898ac0361bd0a5d30650cde2944e5cfc6b8fa
1 /* { dg-do compile } */
2 /* { dg-skip-if "No __builtin_cbrt" { powerpc*-*-darwin* } } */
3 /* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt -fno-ident" } */
5 #include <math.h>
7 extern void abort (void);
9 #define NVALS 6
11 static double
12 convert_it (double x)
14 return pow (x, 1.0 / 3.0);
17 int
18 main (int argc, char *argv[])
20 double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
21 unsigned i;
23 for (i = 0; i < NVALS; i++)
24 if (convert_it (values[i]) != cbrt (values[i]))
25 abort ();
27 return 0;
31 /* { dg-final { scan-assembler-times "cbrt" 2 { target powerpc*-*-* } } } */
32 /* { dg-final { scan-assembler-not "bl\[\\. \]+pow" { target powerpc*-*-* } } } */