8b55146c4f53a4de28b3c9abf26e9c51079da52d
[gcc.git] / gcc / testsuite / gcc.target / i386 / pr63661.c
1 /* PR target/63661 */
2 /* { dg-do run } */
3 /* { dg-require-effective-target fpic } */
4 /* { dg-options "-mtune=nehalem -fPIC -O2" } */
5
6 static void __attribute__((noinline,noclone,hot))
7 foo (double a, double q, double *ff, double *gx, int e, int ni)
8 {
9 union
10 {
11 double n;
12 unsigned long long o;
13 } punner;
14
15 punner.n = q;
16 __builtin_printf("B: 0x%016llx ---- %g\n", punner.o, q);
17
18 if(q != 5)
19 __builtin_abort();
20 }
21
22 static int __attribute__((noinline,noclone,hot))
23 bar (int order, double q, double c[])
24 {
25 int ni, nn, i, e;
26 double g2, x2, de, s, ratio, ff;
27
28 nn = 0;
29 e = order & 1;
30 s = 0;
31 ratio = 0;
32 x2 = 0;
33 g2 = 0;
34
35 if(q == 0.0)
36 return 0;
37
38 if (order < 5)
39 {
40 ratio = 1.0 / q;
41 nn = order;
42 }
43
44 ni = -nn;
45
46 while(1)
47 {
48 de = ratio - g2 - x2;
49
50 foo (0, q, &ff, &g2, e, ni);
51
52 if((int)de == 0)
53 break;
54 }
55
56 s += 2 * nn * c[nn];
57
58 for (i = 0; i < 1; i++)
59 {
60 c[0] = nn;
61 for (; i < 10; i++)
62 c[i] = 0.0;
63 c[0] /= s;
64 }
65
66 return 0;
67 }
68
69 int
70 main ()
71 {
72 double c[1000];
73
74 __builtin_printf("A: 0x%016llx\n", (unsigned long long)c);
75 bar (1, 5.0, c);
76 return 0;
77 }