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" } */
4
5 #include <math.h>
6
7 extern void abort (void);
8
9 #define NVALS 6
10
11 static double
convert_it(double x)12 convert_it (double x)
13 {
14 return pow (x, 1.0 / 6.0);
15 }
16
17 int
main(int argc,char * argv[])18 main (int argc, char *argv[])
19 {
20 double values[NVALS] = { 3.0, 1.95, 2.227, 729.0, 64.0, .0008797 };
21 unsigned i;
22
23 for (i = 0; i < NVALS; i++)
24 if (convert_it (values[i]) != cbrt (sqrt (values[i])))
25 abort ();
26
27 return 0;
28 }
29
30
31 /* { dg-final { scan-assembler-times "cbrt" 2 { target powerpc*-*-* } } } */
32 /* { dg-final { scan-assembler-not "bl\[\\. \]+pow" { target powerpc*-*-* } } } */
33