OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.target/] [powerpc/] [pr46728-15.c] - Blame information for rev 708

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 691 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-O2 -ffast-math -fno-inline -fno-unroll-loops -lm -mpowerpc-gpopt" } */
3
 
4
#include <math.h>
5
 
6
extern void abort (void);
7
 
8
#define NVALS 6
9
 
10
static double
11
convert_it_1 (double x)
12
{
13
  return pow (x, 10.0 / 3.0);
14
}
15
 
16
static double
17
convert_it_2 (double x)
18
{
19
  return pow (x, 11.0 / 3.0);
20
}
21
 
22
static double
23
convert_it_3 (double x)
24
{
25
  return pow (x, -7.0 / 3.0);
26
}
27
 
28
static double
29
convert_it_4 (double x)
30
{
31
  return pow (x, -8.0 / 3.0);
32
}
33
 
34
int
35
main (int argc, char *argv[])
36
{
37
  double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
38
  double PREC = .999999;
39
  unsigned i;
40
 
41
  for (i = 0; i < NVALS; i++)
42
    {
43
      volatile double x, y;
44
 
45
      x = __builtin_powi (values[i], 3);
46
      y = __builtin_powi (cbrt (values[i]), 1);
47
      if (fabs (convert_it_1 (values[i]) / (x * y)) < PREC)
48
        abort ();
49
 
50
      x = __builtin_powi (values[i], 3);
51
      y = __builtin_powi (cbrt (values[i]), 2);
52
      if (fabs (convert_it_2 (values[i]) / (x * y)) < PREC)
53
        abort ();
54
 
55
      x = __builtin_powi (values[i], -3);
56
      y = __builtin_powi (cbrt (values[i]), 2);
57
      if (fabs (convert_it_3 (values[i]) / (x * y)) < PREC)
58
        abort ();
59
 
60
      x = __builtin_powi (values[i], -3);
61
      y = __builtin_powi (cbrt (values[i]), 1);
62
      if (fabs (convert_it_4 (values[i]) / (x * y)) < PREC)
63
        abort ();
64
    }
65
 
66
  return 0;
67
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.