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" } */
7 extern void abort (void);
12 convert_it_1 (double x
)
14 return pow (x
, 10.0 / 3.0);
18 convert_it_2 (double x
)
20 return pow (x
, 11.0 / 3.0);
24 convert_it_3 (double x
)
26 return pow (x
, -7.0 / 3.0);
30 convert_it_4 (double x
)
32 return pow (x
, -8.0 / 3.0);
36 main (int argc
, char *argv
[])
38 double values
[NVALS
] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
41 for (i
= 0; i
< NVALS
; i
++)
43 if (convert_it_1 (values
[i
]) !=
44 __builtin_powi (values
[i
], 3) * __builtin_powi (cbrt (values
[i
]), 1))
46 if (convert_it_2 (values
[i
]) !=
47 __builtin_powi (values
[i
], 3) * __builtin_powi (cbrt (values
[i
]), 2))
49 if (convert_it_3 (values
[i
]) !=
50 __builtin_powi (values
[i
], -3) * __builtin_powi (cbrt (values
[i
]), 2))
52 if (convert_it_4 (values
[i
]) !=
53 __builtin_powi (values
[i
], -3) * __builtin_powi (cbrt (values
[i
]), 1))
61 /* { dg-final { scan-assembler-times "cbrt" 5 { target powerpc*-*-* } } } */
62 /* { dg-final { scan-assembler-not "bl\[\\. \]+pow" { target powerpc*-*-* } } } */