diff options
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.6.0/linaro/gcc-4.6-linaro-r106741.patch')
-rw-r--r-- | meta-oe/recipes-devtools/gcc/gcc-4.6.0/linaro/gcc-4.6-linaro-r106741.patch | 254 |
1 files changed, 254 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.6.0/linaro/gcc-4.6-linaro-r106741.patch b/meta-oe/recipes-devtools/gcc/gcc-4.6.0/linaro/gcc-4.6-linaro-r106741.patch new file mode 100644 index 000000000..84f6f6498 --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.6.0/linaro/gcc-4.6-linaro-r106741.patch | |||
@@ -0,0 +1,254 @@ | |||
1 | 2011-04-26 Andrew Stubbs <ams@codesourcery.com> | ||
2 | |||
3 | Backport from FSF: | ||
4 | |||
5 | 2011-04-15 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
6 | |||
7 | gcc/ | ||
8 | * combine.c (subst, combine_simlify_rtx): Add new argument, use it | ||
9 | to track processing of conditionals. Update all callers. | ||
10 | (try_combine, simplify_if_then_else): Update. | ||
11 | |||
12 | 2011-04-25 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
13 | Eric Botcazou <ebotcazou@adacore.com> | ||
14 | |||
15 | gcc/ | ||
16 | * combine.c (combine_simplify_rtx): Avoid mis-simplifying conditionals | ||
17 | for STORE_FLAG_VALUE==-1 case. | ||
18 | |||
19 | === modified file 'gcc/combine.c' | ||
20 | --- old/gcc/combine.c 2011-02-15 19:46:26 +0000 | ||
21 | +++ new/gcc/combine.c 2011-04-26 17:03:58 +0000 | ||
22 | @@ -391,8 +391,8 @@ | ||
23 | static void undo_all (void); | ||
24 | static void undo_commit (void); | ||
25 | static rtx *find_split_point (rtx *, rtx, bool); | ||
26 | -static rtx subst (rtx, rtx, rtx, int, int); | ||
27 | -static rtx combine_simplify_rtx (rtx, enum machine_mode, int); | ||
28 | +static rtx subst (rtx, rtx, rtx, int, int, int); | ||
29 | +static rtx combine_simplify_rtx (rtx, enum machine_mode, int, int); | ||
30 | static rtx simplify_if_then_else (rtx); | ||
31 | static rtx simplify_set (rtx); | ||
32 | static rtx simplify_logical (rtx); | ||
33 | @@ -3086,12 +3086,12 @@ | ||
34 | if (i1) | ||
35 | { | ||
36 | subst_low_luid = DF_INSN_LUID (i1); | ||
37 | - i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0); | ||
38 | + i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0); | ||
39 | } | ||
40 | else | ||
41 | { | ||
42 | subst_low_luid = DF_INSN_LUID (i2); | ||
43 | - i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0); | ||
44 | + i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0); | ||
45 | } | ||
46 | } | ||
47 | |||
48 | @@ -3103,7 +3103,7 @@ | ||
49 | self-referential RTL when we will be substituting I1SRC for I1DEST | ||
50 | later. Likewise if I0 feeds into I2, either directly or indirectly | ||
51 | through I1, and I0DEST is in I0SRC. */ | ||
52 | - newpat = subst (PATTERN (i3), i2dest, i2src, 0, | ||
53 | + newpat = subst (PATTERN (i3), i2dest, i2src, 0, 0, | ||
54 | (i1_feeds_i2_n && i1dest_in_i1src) | ||
55 | || ((i0_feeds_i2_n || (i0_feeds_i1_n && i1_feeds_i2_n)) | ||
56 | && i0dest_in_i0src)); | ||
57 | @@ -3142,7 +3142,7 @@ | ||
58 | copy of I1SRC each time we substitute it, in order to avoid creating | ||
59 | self-referential RTL when we will be substituting I0SRC for I0DEST | ||
60 | later. */ | ||
61 | - newpat = subst (newpat, i1dest, i1src, 0, | ||
62 | + newpat = subst (newpat, i1dest, i1src, 0, 0, | ||
63 | i0_feeds_i1_n && i0dest_in_i0src); | ||
64 | substed_i1 = 1; | ||
65 | |||
66 | @@ -3172,7 +3172,7 @@ | ||
67 | |||
68 | n_occurrences = 0; | ||
69 | subst_low_luid = DF_INSN_LUID (i0); | ||
70 | - newpat = subst (newpat, i0dest, i0src, 0, 0); | ||
71 | + newpat = subst (newpat, i0dest, i0src, 0, 0, 0); | ||
72 | substed_i0 = 1; | ||
73 | } | ||
74 | |||
75 | @@ -3234,7 +3234,7 @@ | ||
76 | { | ||
77 | rtx t = i1pat; | ||
78 | if (i0_feeds_i1_n) | ||
79 | - t = subst (t, i0dest, i0src, 0, 0); | ||
80 | + t = subst (t, i0dest, i0src, 0, 0, 0); | ||
81 | |||
82 | XVECEXP (newpat, 0, --total_sets) = t; | ||
83 | } | ||
84 | @@ -3242,10 +3242,10 @@ | ||
85 | { | ||
86 | rtx t = i2pat; | ||
87 | if (i1_feeds_i2_n) | ||
88 | - t = subst (t, i1dest, i1src_copy ? i1src_copy : i1src, 0, | ||
89 | + t = subst (t, i1dest, i1src_copy ? i1src_copy : i1src, 0, 0, | ||
90 | i0_feeds_i1_n && i0dest_in_i0src); | ||
91 | if ((i0_feeds_i1_n && i1_feeds_i2_n) || i0_feeds_i2_n) | ||
92 | - t = subst (t, i0dest, i0src, 0, 0); | ||
93 | + t = subst (t, i0dest, i0src, 0, 0, 0); | ||
94 | |||
95 | XVECEXP (newpat, 0, --total_sets) = t; | ||
96 | } | ||
97 | @@ -4914,11 +4914,13 @@ | ||
98 | |||
99 | IN_DEST is nonzero if we are processing the SET_DEST of a SET. | ||
100 | |||
101 | + IN_COND is nonzero if we are on top level of the condition. | ||
102 | + | ||
103 | UNIQUE_COPY is nonzero if each substitution must be unique. We do this | ||
104 | by copying if `n_occurrences' is nonzero. */ | ||
105 | |||
106 | static rtx | ||
107 | -subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy) | ||
108 | +subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy) | ||
109 | { | ||
110 | enum rtx_code code = GET_CODE (x); | ||
111 | enum machine_mode op0_mode = VOIDmode; | ||
112 | @@ -4979,7 +4981,7 @@ | ||
113 | && GET_CODE (XVECEXP (x, 0, 0)) == SET | ||
114 | && GET_CODE (SET_SRC (XVECEXP (x, 0, 0))) == ASM_OPERANDS) | ||
115 | { | ||
116 | - new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, unique_copy); | ||
117 | + new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, 0, unique_copy); | ||
118 | |||
119 | /* If this substitution failed, this whole thing fails. */ | ||
120 | if (GET_CODE (new_rtx) == CLOBBER | ||
121 | @@ -4996,7 +4998,7 @@ | ||
122 | && GET_CODE (dest) != CC0 | ||
123 | && GET_CODE (dest) != PC) | ||
124 | { | ||
125 | - new_rtx = subst (dest, from, to, 0, unique_copy); | ||
126 | + new_rtx = subst (dest, from, to, 0, 0, unique_copy); | ||
127 | |||
128 | /* If this substitution failed, this whole thing fails. */ | ||
129 | if (GET_CODE (new_rtx) == CLOBBER | ||
130 | @@ -5042,8 +5044,8 @@ | ||
131 | } | ||
132 | else | ||
133 | { | ||
134 | - new_rtx = subst (XVECEXP (x, i, j), from, to, 0, | ||
135 | - unique_copy); | ||
136 | + new_rtx = subst (XVECEXP (x, i, j), from, to, 0, 0, | ||
137 | + unique_copy); | ||
138 | |||
139 | /* If this substitution failed, this whole thing | ||
140 | fails. */ | ||
141 | @@ -5120,7 +5122,9 @@ | ||
142 | && (code == SUBREG || code == STRICT_LOW_PART | ||
143 | || code == ZERO_EXTRACT)) | ||
144 | || code == SET) | ||
145 | - && i == 0), unique_copy); | ||
146 | + && i == 0), | ||
147 | + code == IF_THEN_ELSE && i == 0, | ||
148 | + unique_copy); | ||
149 | |||
150 | /* If we found that we will have to reject this combination, | ||
151 | indicate that by returning the CLOBBER ourselves, rather than | ||
152 | @@ -5177,7 +5181,7 @@ | ||
153 | /* If X is sufficiently simple, don't bother trying to do anything | ||
154 | with it. */ | ||
155 | if (code != CONST_INT && code != REG && code != CLOBBER) | ||
156 | - x = combine_simplify_rtx (x, op0_mode, in_dest); | ||
157 | + x = combine_simplify_rtx (x, op0_mode, in_dest, in_cond); | ||
158 | |||
159 | if (GET_CODE (x) == code) | ||
160 | break; | ||
161 | @@ -5197,10 +5201,12 @@ | ||
162 | expression. | ||
163 | |||
164 | OP0_MODE is the original mode of XEXP (x, 0). IN_DEST is nonzero | ||
165 | - if we are inside a SET_DEST. */ | ||
166 | + if we are inside a SET_DEST. IN_COND is nonzero if we are on the top level | ||
167 | + of a condition. */ | ||
168 | |||
169 | static rtx | ||
170 | -combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) | ||
171 | +combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest, | ||
172 | + int in_cond) | ||
173 | { | ||
174 | enum rtx_code code = GET_CODE (x); | ||
175 | enum machine_mode mode = GET_MODE (x); | ||
176 | @@ -5255,8 +5261,8 @@ | ||
177 | false arms to store-flag values. Be careful to use copy_rtx | ||
178 | here since true_rtx or false_rtx might share RTL with x as a | ||
179 | result of the if_then_else_cond call above. */ | ||
180 | - true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0); | ||
181 | - false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0); | ||
182 | + true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0, 0); | ||
183 | + false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0, 0); | ||
184 | |||
185 | /* If true_rtx and false_rtx are not general_operands, an if_then_else | ||
186 | is unlikely to be simpler. */ | ||
187 | @@ -5600,7 +5606,7 @@ | ||
188 | { | ||
189 | /* Try to simplify the expression further. */ | ||
190 | rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); | ||
191 | - temp = combine_simplify_rtx (tor, mode, in_dest); | ||
192 | + temp = combine_simplify_rtx (tor, mode, in_dest, 0); | ||
193 | |||
194 | /* If we could, great. If not, do not go ahead with the IOR | ||
195 | replacement, since PLUS appears in many special purpose | ||
196 | @@ -5693,7 +5699,16 @@ | ||
197 | ZERO_EXTRACT is indeed appropriate, it will be placed back by | ||
198 | the call to make_compound_operation in the SET case. */ | ||
199 | |||
200 | - if (STORE_FLAG_VALUE == 1 | ||
201 | + if (in_cond) | ||
202 | + /* Don't apply below optimizations if the caller would | ||
203 | + prefer a comparison rather than a value. | ||
204 | + E.g., for the condition in an IF_THEN_ELSE most targets need | ||
205 | + an explicit comparison. */ | ||
206 | + { | ||
207 | + ; | ||
208 | + } | ||
209 | + | ||
210 | + else if (STORE_FLAG_VALUE == 1 | ||
211 | && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT | ||
212 | && op1 == const0_rtx | ||
213 | && mode == GET_MODE (op0) | ||
214 | @@ -5739,7 +5754,10 @@ | ||
215 | |||
216 | /* If STORE_FLAG_VALUE is -1, we have cases similar to | ||
217 | those above. */ | ||
218 | - if (STORE_FLAG_VALUE == -1 | ||
219 | + if (in_cond) | ||
220 | + ; | ||
221 | + | ||
222 | + else if (STORE_FLAG_VALUE == -1 | ||
223 | && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT | ||
224 | && op1 == const0_rtx | ||
225 | && (num_sign_bit_copies (op0, mode) | ||
226 | @@ -5937,11 +5955,11 @@ | ||
227 | if (reg_mentioned_p (from, true_rtx)) | ||
228 | true_rtx = subst (known_cond (copy_rtx (true_rtx), true_code, | ||
229 | from, true_val), | ||
230 | - pc_rtx, pc_rtx, 0, 0); | ||
231 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
232 | if (reg_mentioned_p (from, false_rtx)) | ||
233 | false_rtx = subst (known_cond (copy_rtx (false_rtx), false_code, | ||
234 | from, false_val), | ||
235 | - pc_rtx, pc_rtx, 0, 0); | ||
236 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
237 | |||
238 | SUBST (XEXP (x, 1), swapped ? false_rtx : true_rtx); | ||
239 | SUBST (XEXP (x, 2), swapped ? true_rtx : false_rtx); | ||
240 | @@ -6158,11 +6176,11 @@ | ||
241 | { | ||
242 | temp = subst (simplify_gen_relational (true_code, m, VOIDmode, | ||
243 | cond_op0, cond_op1), | ||
244 | - pc_rtx, pc_rtx, 0, 0); | ||
245 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
246 | temp = simplify_gen_binary (MULT, m, temp, | ||
247 | simplify_gen_binary (MULT, m, c1, | ||
248 | const_true_rtx)); | ||
249 | - temp = subst (temp, pc_rtx, pc_rtx, 0, 0); | ||
250 | + temp = subst (temp, pc_rtx, pc_rtx, 0, 0, 0); | ||
251 | temp = simplify_gen_binary (op, m, gen_lowpart (m, z), temp); | ||
252 | |||
253 | if (extend_op != UNKNOWN) | ||
254 | |||