aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63661.c
blob: a5ffd2f4f57a9f01c08c29e2b6ded0d7518c08f7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* PR target/63661 */
/* { dg-do run } */
/* { dg-require-effective-target fpic } */
/* { dg-options "-mtune=nehalem -fPIC -O2" } */

static void __attribute__((noinline,noclone,hot))
foo (double a, double q, double *ff, double *gx, int e, int ni)
{
  union
    {
      double n;
      unsigned long long o;
    } punner;
  double d;

  punner.n = q;
   __builtin_printf("B: 0x%016llx ---- %g\n", punner.o, q);

  d = q - 5;
  if(d < 0)
    d = -d;
  if (d > 0.1)
    __builtin_abort();
}

static int __attribute__((noinline,noclone,hot))
bar (int order, double q, double c[])
{
  int ni, nn, i, e;
  double g2, x2, de, s, ratio, ff;

  nn = 0;
  e = order & 1;
  s = 0;
  ratio = 0;
  x2 = 0;
  g2 = 0;

  if(q == 0.0)
    return 0;

  if (order < 5)
    {
      ratio = 1.0 / q;
      nn = order;
    }

  ni = -nn;

  while(1)
    {
      de = ratio - g2 - x2;

      foo (0, q, &ff, &g2, e, ni);

      if((int)de == 0)
        break;
    }

  s += 2 * nn * c[nn];

  for (i = 0; i < 1; i++)
    {
      c[0] = nn;
      for (; i < 10; i++)
        c[i] = 0.0;
      c[0] /= s;
    }

  return 0;
}

int
main ()
{
  double c[1000];

  bar (1, 5.0, c);
  return 0;
}