2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr63661.c
bloba5ffd2f4f57a9f01c08c29e2b6ded0d7518c08f7
1 /* PR target/63661 */
2 /* { dg-do run } */
3 /* { dg-require-effective-target fpic } */
4 /* { dg-options "-mtune=nehalem -fPIC -O2" } */
6 static void __attribute__((noinline,noclone,hot))
7 foo (double a, double q, double *ff, double *gx, int e, int ni)
9 union
11 double n;
12 unsigned long long o;
13 } punner;
14 double d;
16 punner.n = q;
17 __builtin_printf("B: 0x%016llx ---- %g\n", punner.o, q);
19 d = q - 5;
20 if(d < 0)
21 d = -d;
22 if (d > 0.1)
23 __builtin_abort();
26 static int __attribute__((noinline,noclone,hot))
27 bar (int order, double q, double c[])
29 int ni, nn, i, e;
30 double g2, x2, de, s, ratio, ff;
32 nn = 0;
33 e = order & 1;
34 s = 0;
35 ratio = 0;
36 x2 = 0;
37 g2 = 0;
39 if(q == 0.0)
40 return 0;
42 if (order < 5)
44 ratio = 1.0 / q;
45 nn = order;
48 ni = -nn;
50 while(1)
52 de = ratio - g2 - x2;
54 foo (0, q, &ff, &g2, e, ni);
56 if((int)de == 0)
57 break;
60 s += 2 * nn * c[nn];
62 for (i = 0; i < 1; i++)
64 c[0] = nn;
65 for (; i < 10; i++)
66 c[i] = 0.0;
67 c[0] /= s;
70 return 0;
73 int
74 main ()
76 double c[1000];
78 bar (1, 5.0, c);
79 return 0;