* gcc.target/powerpc/builtins-1-be.c <vclzb>: Rename duplicate test
[official-gcc.git] / gcc / testsuite / gcc.target / powerpc / pr46728-8.c
blob7d2af12db859fd3e50e503ed06776e461cf8996f
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_1 (double x)
14 return pow (x, 10.0 / 3.0);
17 static double
18 convert_it_2 (double x)
20 return pow (x, 11.0 / 3.0);
23 static double
24 convert_it_3 (double x)
26 return pow (x, -7.0 / 3.0);
29 static double
30 convert_it_4 (double x)
32 return pow (x, -8.0 / 3.0);
35 int
36 main (int argc, char *argv[])
38 double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
39 unsigned i;
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))
45 abort ();
46 if (convert_it_2 (values[i]) !=
47 __builtin_powi (values[i], 3) * __builtin_powi (cbrt (values[i]), 2))
48 abort ();
49 if (convert_it_3 (values[i]) !=
50 __builtin_powi (values[i], -3) * __builtin_powi (cbrt (values[i]), 2))
51 abort ();
52 if (convert_it_4 (values[i]) !=
53 __builtin_powi (values[i], -3) * __builtin_powi (cbrt (values[i]), 1))
54 abort ();
57 return 0;
61 /* { dg-final { scan-assembler-times "cbrt" 5 { target powerpc*-*-* } } } */
62 /* { dg-final { scan-assembler-not "bl\[\\. \]+pow" { target powerpc*-*-* } } } */