1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-loop-distribution" } */
3
4 struct rtx_def
5 {
6 int a;
7 };
8
9 typedef struct rtx_def *rtx;
10
11 struct rd {
12 int alternative_enabled_p[100];
13 rtx operand[100];
14 int n_operands;
15 };
16
17 rtx this_insn;
18 int n_reloads;
19 int n_replacements;
20 int n_earlyclobbers;
21 int replace_reloads;
22 int hard_regs_live_known;
23 short* static_reload_reg_p;
24 struct rd recog_data;
25
26 int
find_reloads(rtx insn,int replace,int ind_levels,int live_known,short * reload_reg_p)27 find_reloads (rtx insn, int replace, int ind_levels, int live_known,
28 short *reload_reg_p)
29 {
30 int i, j;
31 int noperands = replace;
32
33 int no_input_reloads = 0;
34 int n_alternatives = replace;
35 char this_alternative_match_win[30];
36 char this_alternative_win[30];
37 char this_alternative_earlyclobber[30];
38 int this_alternative_matches[30];
39 int goal_alternative[30];
40 int this_alternative_number;
41
42 char goal_alternative_match_win[30];
43 char goal_alternative_win[30];
44 int best;
45
46 int operand_mode[30];
47 int retval = 0;
48
49 for (this_alternative_number = 0;
50 this_alternative_number < n_alternatives;
51 this_alternative_number++)
52 {
53
54 int losers = 0;
55 int bad = 0;
56
57 if (!recog_data.alternative_enabled_p[this_alternative_number])
58 {
59 int i;
60
61 for (i = 0; i < recog_data.n_operands; i++)
62 ;
63
64 continue;
65 }
66
67 for (i = 0; i < noperands; i++)
68 if (this_alternative_earlyclobber[i]
69 && (this_alternative_win[i] || this_alternative_match_win[i]))
70 {
71 if (j != noperands)
72 {
73 losers++;
74
75 for (j = 0; j < noperands; j++)
76 if (this_alternative_matches[j] == i
77 && this_alternative_match_win[j])
78 {
79 this_alternative_win[j] = 0;
80 this_alternative_match_win[j] = 0;
81 losers++;
82 }
83 }
84 }
85
86 if (losers == 0)
87 {
88 for (i = 0; i < noperands; i++)
89 {
90 goal_alternative_win[i] = 0;
91 goal_alternative_match_win[i] = 0;
92 }
93
94 goto finish;
95 }
96
97 if (! bad && best > losers)
98 {
99 for (i = 0; i < noperands; i++)
100 {
101 goal_alternative[i] = 0;
102 goal_alternative_win[i] = 0;
103 }
104 }
105 }
106
107
108 finish:
109
110 for (i = 0; i < noperands; i++)
111 if (! goal_alternative_win[i])
112 {
113 rtx op = recog_data.operand[i];
114 int mode = operand_mode[i];
115
116 if (((ix86_preferred_reload_class ((op), (goal_alternative[i])) == 2)
117 || no_input_reloads)
118 && mode != 0)
119 {}
120 }
121
122 return retval;
123 }
124
125