1 /* Testing save/restore of floating point caller-save registers, on ia64
2    this resulted in bad code.  Not all targets will use caller-save regs.  */
3 
4 /* { dg-do run } */
5 /* { dg-options "-O2" } */
6 /* { dg-options "-O2 -minline-float-divide-max-throughput" { target ia64-*-* } } */
7 
8 /* Testing save/restore of floating point caller-save registers on ia64.  */
9 
10 extern void abort (void);
11 
foo(double a,double b,double c)12 double foo(double a, double b, double c)
13 {
14 	return (a+b+c);
15 }
16 
17 int
main()18 main ()
19 {
20 	double  f1, f2, f3, f4, f5, f6, f7, f8, f9,f10;
21 	double f11,f12,f13,f14,f15,f16,f17,f18,f19,f20;
22 	double f21,f22,f23,f24,f25,f26,f27,f28,f29,f30;
23 	double x;
24 	int i,j,k;
25 
26 	f1  = 0.1; f2  = 0.2; f3  = 0.3; f4  = 0.4; f5  = 0.5;
27 	f6  = 0.6; f7  = 0.7; f8  = 0.8; f9  = 0.9; f10 = 1.0;
28 	f11 = 1.1; f12 = 1.2; f13 = 1.3; f14 = 1.4; f15 = 1.5;
29 	f16 = 1.6; f17 = 1.7; f18 = 1.8; f19 = 1.9; f20 = 2.0;
30 	f21 = 2.1; f22 = 2.2; f23 = 2.3; f24 = 2.4; f25 = 2.5;
31 	f26 = 2.6; f27 = 2.7; f28 = 2.8; f29 = 2.9; f30 = 3.0;
32 
33 	i = (int) foo(1.0,1.0,1.0);
34 	while (i > 0) {
35 		f1  = f2  / f3  * f30;
36 		f2  = f3  / f4  * f30;
37 		f3  = f4  / f5  * f30;
38 		f4  = f5  / f6  * f30;
39 		f5  = f6  / f7  * f30;
40 		f6  = f7  / f8  * f30;
41 		f7  = f8  / f9  * f30;
42 		f8  = f9  / f10 * f30;
43 		f9  = f10 / f11 * f30;
44 		f10 = f11 / f12 * f30;
45 		f11 = f12 / f13 * f30;
46 		f12 = f13 / f14 * f25;
47 		f13 = f14 / f15 * f30;
48 		f14 = f15 / f16 * f30;
49 		f15 = f16 / f17 * f30;
50 		f16 = f17 / f18 * f30;
51 		f17 = f18 / f19 * f30;
52 		f18 = f19 / f20 * f30;
53 		f19 = f20 / f21 * f30;
54 		f20 = f21 / f22 * f20;
55 		f21 = f22 / f23 * f30;
56 		f22 = f23 / f24 * f30;
57 		f23 = f24 / f25 * f30;
58 		f24 = f25 / f26 * f30;
59 		f25 = f26 / f27 * f30;
60 		f26 = f27 / f28 * f30;
61 		f27 = f28 / f29 * f30;
62 		f28 = f29 / f30 * f30;
63 		f29 = f30 / f1  * f30;
64 		f30 = f1  / f2  * f30;
65 		x = foo(f1,f2,f3);
66 		i = i - 1;
67 	}
68 	x = (f1+f2+f3+f4+f5+f6+f7+f8+f9+f10) *
69             (f11+f12+f13+f14+f15+f16+f17+f18+f19+f20) *
70             (f21+f22+f23+f24+f25+f26+f27+f28+f29+f30);
71 
72 	/* Exact value is not needed, on IA64 it is massively off. */
73         if (x < 19503.0 || x > 19504.0) abort();
74 	return 0;
75 }
76