PR testsuite/52641
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr38385.c
bloba49c93e26108abfed2a21f7fb53be6eb16da81bb
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-loop-distribution" } */
4 struct rtx_def
6 int a;
7 };
9 typedef struct rtx_def *rtx;
11 struct rd {
12 int alternative_enabled_p[100];
13 rtx operand[100];
14 int n_operands;
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;
26 int
27 find_reloads (rtx insn, int replace, int ind_levels, int live_known,
28 short *reload_reg_p)
30 int i, j;
31 int noperands = replace;
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;
42 char goal_alternative_match_win[30];
43 char goal_alternative_win[30];
44 int best;
46 int operand_mode[30];
47 int retval = 0;
49 for (this_alternative_number = 0;
50 this_alternative_number < n_alternatives;
51 this_alternative_number++)
54 int losers = 0;
55 int bad = 0;
57 if (!recog_data.alternative_enabled_p[this_alternative_number])
59 int i;
61 for (i = 0; i < recog_data.n_operands; i++)
64 continue;
67 for (i = 0; i < noperands; i++)
68 if (this_alternative_earlyclobber[i]
69 && (this_alternative_win[i] || this_alternative_match_win[i]))
71 if (j != noperands)
73 losers++;
75 for (j = 0; j < noperands; j++)
76 if (this_alternative_matches[j] == i
77 && this_alternative_match_win[j])
79 this_alternative_win[j] = 0;
80 this_alternative_match_win[j] = 0;
81 losers++;
86 if (losers == 0)
88 for (i = 0; i < noperands; i++)
90 goal_alternative_win[i] = 0;
91 goal_alternative_match_win[i] = 0;
94 goto finish;
97 if (! bad && best > losers)
99 for (i = 0; i < noperands; i++)
101 goal_alternative[i] = 0;
102 goal_alternative_win[i] = 0;
108 finish:
110 for (i = 0; i < noperands; i++)
111 if (! goal_alternative_win[i])
113 rtx op = recog_data.operand[i];
114 int mode = operand_mode[i];
116 if (((ix86_preferred_reload_class ((op), (goal_alternative[i])) == 2)
117 || no_input_reloads)
118 && mode != 0)
122 return retval;