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 int ix86_preferred_reload_class (rtx, int);
26
27 int
find_reloads(rtx insn,int replace,int ind_levels,int live_known,short * reload_reg_p)28 find_reloads (rtx insn, int replace, int ind_levels, int live_known,
29 short *reload_reg_p)
30 {
31 int i, j;
32 int noperands = replace;
33
34 int no_input_reloads = 0;
35 int n_alternatives = replace;
36 char this_alternative_match_win[30];
37 char this_alternative_win[30];
38 char this_alternative_earlyclobber[30];
39 int this_alternative_matches[30];
40 int goal_alternative[30];
41 int this_alternative_number;
42
43 char goal_alternative_match_win[30];
44 char goal_alternative_win[30];
45 int best;
46
47 int operand_mode[30];
48 int retval = 0;
49
50 for (this_alternative_number = 0;
51 this_alternative_number < n_alternatives;
52 this_alternative_number++)
53 {
54
55 int losers = 0;
56 int bad = 0;
57
58 if (!recog_data.alternative_enabled_p[this_alternative_number])
59 {
60 int i;
61
62 for (i = 0; i < recog_data.n_operands; i++)
63 ;
64
65 continue;
66 }
67
68 for (i = 0; i < noperands; i++)
69 if (this_alternative_earlyclobber[i]
70 && (this_alternative_win[i] || this_alternative_match_win[i]))
71 {
72 if (j != noperands)
73 {
74 losers++;
75
76 for (j = 0; j < noperands; j++)
77 if (this_alternative_matches[j] == i
78 && this_alternative_match_win[j])
79 {
80 this_alternative_win[j] = 0;
81 this_alternative_match_win[j] = 0;
82 losers++;
83 }
84 }
85 }
86
87 if (losers == 0)
88 {
89 for (i = 0; i < noperands; i++)
90 {
91 goal_alternative_win[i] = 0;
92 goal_alternative_match_win[i] = 0;
93 }
94
95 goto finish;
96 }
97
98 if (! bad && best > losers)
99 {
100 for (i = 0; i < noperands; i++)
101 {
102 goal_alternative[i] = 0;
103 goal_alternative_win[i] = 0;
104 }
105 }
106 }
107
108
109 finish:
110
111 for (i = 0; i < noperands; i++)
112 if (! goal_alternative_win[i])
113 {
114 rtx op = recog_data.operand[i];
115 int mode = operand_mode[i];
116
117 if (((ix86_preferred_reload_class ((op), (goal_alternative[i])) == 2)
118 || no_input_reloads)
119 && mode != 0)
120 {}
121 }
122
123 return retval;
124 }
125
126