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

Subversion Repositories openrisc

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

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, 1.5);
14
}
15
 
16
static double
17
convert_it_2 (double x)
18
{
19
  return pow (x, 2.5);
20
}
21
 
22
static double
23
convert_it_3 (double x)
24
{
25
  return pow (x, -0.5);
26
}
27
 
28
static double
29
convert_it_4 (double x)
30
{
31
  return pow (x, 10.5);
32
}
33
 
34
static double
35
convert_it_5 (double x)
36
{
37
  return pow (x, -3.5);
38
}
39
 
40
int
41
main (int argc, char *argv[])
42
{
43
  double values[NVALS] = { 3.0, 1.95, 2.227, 4.0, 256.0, .0008797 };
44
  double PREC = .999999;
45
  unsigned i;
46
 
47
  for (i = 0; i < NVALS; i++)
48
    {
49
      volatile double x, y;
50
 
51
      x = sqrt (values[i]);
52
      y = __builtin_powi (values[i], 1);
53
      if (fabs (convert_it_1 (values[i]) / (x * y)) < PREC)
54
        abort ();
55
 
56
      x = sqrt (values[i]);
57
      y = __builtin_powi (values[i], 2);
58
      if (fabs (convert_it_2 (values[i]) / (x * y)) < PREC)
59
        abort ();
60
 
61
      x = sqrt (values[i]);
62
      y = __builtin_powi (values[i], -1);
63
      if (fabs (convert_it_3 (values[i]) / (x * y)) < PREC)
64
        abort ();
65
 
66
      x = sqrt (values[i]);
67
      y = __builtin_powi (values[i], 10);
68
      if (fabs (convert_it_4 (values[i]) / (x * y)) < PREC)
69
        abort ();
70
 
71
      x = sqrt (values[i]);
72
      y = __builtin_powi (values[i], -4);
73
      if (fabs (convert_it_5 (values[i]) / (x * y)) < PREC)
74
        abort ();
75
    }
76
 
77
  return 0;
78
}

powered by: WebSVN 2.1.0

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