diff options
Diffstat (limited to 'recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99436.patch')
-rw-r--r-- | recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99436.patch | 209 |
1 files changed, 209 insertions, 0 deletions
diff --git a/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99436.patch b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99436.patch new file mode 100644 index 0000000000..deb749efcb --- /dev/null +++ b/recipes-devtools/gcc/gcc-4.5/linaro/gcc-4.5-linaro-r99436.patch | |||
@@ -0,0 +1,209 @@ | |||
1 | 2010-11-24 Maxim Kuvyrkov <maxim@codesourcery.com> | ||
2 | |||
3 | gcc/ | ||
4 | * combine.c (subst, combine_simlify_rtx): Add new argument, use it | ||
5 | to track processing of conditionals. Update all callers. | ||
6 | (try_combine, simplify_if_then_else): Update. | ||
7 | |||
8 | === modified file 'gcc/combine.c' | ||
9 | --- old/gcc/combine.c 2010-11-04 12:39:28 +0000 | ||
10 | +++ new/gcc/combine.c 2010-11-25 11:11:45 +0000 | ||
11 | @@ -392,8 +392,8 @@ | ||
12 | static void undo_all (void); | ||
13 | static void undo_commit (void); | ||
14 | static rtx *find_split_point (rtx *, rtx); | ||
15 | -static rtx subst (rtx, rtx, rtx, int, int); | ||
16 | -static rtx combine_simplify_rtx (rtx, enum machine_mode, int); | ||
17 | +static rtx subst (rtx, rtx, rtx, int, int, int); | ||
18 | +static rtx combine_simplify_rtx (rtx, enum machine_mode, int, int); | ||
19 | static rtx simplify_if_then_else (rtx); | ||
20 | static rtx simplify_set (rtx); | ||
21 | static rtx simplify_logical (rtx); | ||
22 | @@ -2944,12 +2944,12 @@ | ||
23 | if (i1) | ||
24 | { | ||
25 | subst_low_luid = DF_INSN_LUID (i1); | ||
26 | - i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0); | ||
27 | + i1src = subst (i1src, pc_rtx, pc_rtx, 0, 0, 0); | ||
28 | } | ||
29 | else | ||
30 | { | ||
31 | subst_low_luid = DF_INSN_LUID (i2); | ||
32 | - i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0); | ||
33 | + i2src = subst (i2src, pc_rtx, pc_rtx, 0, 0, 0); | ||
34 | } | ||
35 | } | ||
36 | |||
37 | @@ -2960,7 +2960,7 @@ | ||
38 | to avoid self-referential rtl. */ | ||
39 | |||
40 | subst_low_luid = DF_INSN_LUID (i2); | ||
41 | - newpat = subst (PATTERN (i3), i2dest, i2src, 0, | ||
42 | + newpat = subst (PATTERN (i3), i2dest, i2src, 0, 0, | ||
43 | ! i1_feeds_i3 && i1dest_in_i1src); | ||
44 | substed_i2 = 1; | ||
45 | |||
46 | @@ -2991,7 +2991,7 @@ | ||
47 | |||
48 | n_occurrences = 0; | ||
49 | subst_low_luid = DF_INSN_LUID (i1); | ||
50 | - newpat = subst (newpat, i1dest, i1src, 0, 0); | ||
51 | + newpat = subst (newpat, i1dest, i1src, 0, 0, 0); | ||
52 | substed_i1 = 1; | ||
53 | } | ||
54 | |||
55 | @@ -3053,7 +3053,7 @@ | ||
56 | else | ||
57 | /* See comment where i2pat is assigned. */ | ||
58 | XVECEXP (newpat, 0, --total_sets) | ||
59 | - = subst (i2pat, i1dest, i1src, 0, 0); | ||
60 | + = subst (i2pat, i1dest, i1src, 0, 0, 0); | ||
61 | } | ||
62 | } | ||
63 | |||
64 | @@ -4605,11 +4605,13 @@ | ||
65 | |||
66 | IN_DEST is nonzero if we are processing the SET_DEST of a SET. | ||
67 | |||
68 | + IN_COND is nonzero if we are on top level of the condition. | ||
69 | + | ||
70 | UNIQUE_COPY is nonzero if each substitution must be unique. We do this | ||
71 | by copying if `n_occurrences' is nonzero. */ | ||
72 | |||
73 | static rtx | ||
74 | -subst (rtx x, rtx from, rtx to, int in_dest, int unique_copy) | ||
75 | +subst (rtx x, rtx from, rtx to, int in_dest, int in_cond, int unique_copy) | ||
76 | { | ||
77 | enum rtx_code code = GET_CODE (x); | ||
78 | enum machine_mode op0_mode = VOIDmode; | ||
79 | @@ -4670,7 +4672,7 @@ | ||
80 | && GET_CODE (XVECEXP (x, 0, 0)) == SET | ||
81 | && GET_CODE (SET_SRC (XVECEXP (x, 0, 0))) == ASM_OPERANDS) | ||
82 | { | ||
83 | - new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, unique_copy); | ||
84 | + new_rtx = subst (XVECEXP (x, 0, 0), from, to, 0, 0, unique_copy); | ||
85 | |||
86 | /* If this substitution failed, this whole thing fails. */ | ||
87 | if (GET_CODE (new_rtx) == CLOBBER | ||
88 | @@ -4687,7 +4689,7 @@ | ||
89 | && GET_CODE (dest) != CC0 | ||
90 | && GET_CODE (dest) != PC) | ||
91 | { | ||
92 | - new_rtx = subst (dest, from, to, 0, unique_copy); | ||
93 | + new_rtx = subst (dest, from, to, 0, 0, unique_copy); | ||
94 | |||
95 | /* If this substitution failed, this whole thing fails. */ | ||
96 | if (GET_CODE (new_rtx) == CLOBBER | ||
97 | @@ -4733,8 +4735,8 @@ | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | - new_rtx = subst (XVECEXP (x, i, j), from, to, 0, | ||
102 | - unique_copy); | ||
103 | + new_rtx = subst (XVECEXP (x, i, j), from, to, 0, 0, | ||
104 | + unique_copy); | ||
105 | |||
106 | /* If this substitution failed, this whole thing | ||
107 | fails. */ | ||
108 | @@ -4811,7 +4813,9 @@ | ||
109 | && (code == SUBREG || code == STRICT_LOW_PART | ||
110 | || code == ZERO_EXTRACT)) | ||
111 | || code == SET) | ||
112 | - && i == 0), unique_copy); | ||
113 | + && i == 0), | ||
114 | + code == IF_THEN_ELSE && i == 0, | ||
115 | + unique_copy); | ||
116 | |||
117 | /* If we found that we will have to reject this combination, | ||
118 | indicate that by returning the CLOBBER ourselves, rather than | ||
119 | @@ -4868,7 +4872,7 @@ | ||
120 | /* If X is sufficiently simple, don't bother trying to do anything | ||
121 | with it. */ | ||
122 | if (code != CONST_INT && code != REG && code != CLOBBER) | ||
123 | - x = combine_simplify_rtx (x, op0_mode, in_dest); | ||
124 | + x = combine_simplify_rtx (x, op0_mode, in_dest, in_cond); | ||
125 | |||
126 | if (GET_CODE (x) == code) | ||
127 | break; | ||
128 | @@ -4888,10 +4892,12 @@ | ||
129 | expression. | ||
130 | |||
131 | OP0_MODE is the original mode of XEXP (x, 0). IN_DEST is nonzero | ||
132 | - if we are inside a SET_DEST. */ | ||
133 | + if we are inside a SET_DEST. IN_COND is nonzero if we are on the top level | ||
134 | + of a condition. */ | ||
135 | |||
136 | static rtx | ||
137 | -combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest) | ||
138 | +combine_simplify_rtx (rtx x, enum machine_mode op0_mode, int in_dest, | ||
139 | + int in_cond) | ||
140 | { | ||
141 | enum rtx_code code = GET_CODE (x); | ||
142 | enum machine_mode mode = GET_MODE (x); | ||
143 | @@ -4946,8 +4952,8 @@ | ||
144 | false arms to store-flag values. Be careful to use copy_rtx | ||
145 | here since true_rtx or false_rtx might share RTL with x as a | ||
146 | result of the if_then_else_cond call above. */ | ||
147 | - true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0); | ||
148 | - false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0); | ||
149 | + true_rtx = subst (copy_rtx (true_rtx), pc_rtx, pc_rtx, 0, 0, 0); | ||
150 | + false_rtx = subst (copy_rtx (false_rtx), pc_rtx, pc_rtx, 0, 0, 0); | ||
151 | |||
152 | /* If true_rtx and false_rtx are not general_operands, an if_then_else | ||
153 | is unlikely to be simpler. */ | ||
154 | @@ -5291,7 +5297,7 @@ | ||
155 | { | ||
156 | /* Try to simplify the expression further. */ | ||
157 | rtx tor = simplify_gen_binary (IOR, mode, XEXP (x, 0), XEXP (x, 1)); | ||
158 | - temp = combine_simplify_rtx (tor, mode, in_dest); | ||
159 | + temp = combine_simplify_rtx (tor, mode, in_dest, 0); | ||
160 | |||
161 | /* If we could, great. If not, do not go ahead with the IOR | ||
162 | replacement, since PLUS appears in many special purpose | ||
163 | @@ -5384,7 +5390,16 @@ | ||
164 | ZERO_EXTRACT is indeed appropriate, it will be placed back by | ||
165 | the call to make_compound_operation in the SET case. */ | ||
166 | |||
167 | - if (STORE_FLAG_VALUE == 1 | ||
168 | + if (in_cond) | ||
169 | + /* Don't apply below optimizations if the caller would | ||
170 | + prefer a comparison rather than a value. | ||
171 | + E.g., for the condition in an IF_THEN_ELSE most targets need | ||
172 | + an explicit comparison. */ | ||
173 | + { | ||
174 | + ; | ||
175 | + } | ||
176 | + | ||
177 | + else if (STORE_FLAG_VALUE == 1 | ||
178 | && new_code == NE && GET_MODE_CLASS (mode) == MODE_INT | ||
179 | && op1 == const0_rtx | ||
180 | && mode == GET_MODE (op0) | ||
181 | @@ -5628,11 +5643,11 @@ | ||
182 | if (reg_mentioned_p (from, true_rtx)) | ||
183 | true_rtx = subst (known_cond (copy_rtx (true_rtx), true_code, | ||
184 | from, true_val), | ||
185 | - pc_rtx, pc_rtx, 0, 0); | ||
186 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
187 | if (reg_mentioned_p (from, false_rtx)) | ||
188 | false_rtx = subst (known_cond (copy_rtx (false_rtx), false_code, | ||
189 | from, false_val), | ||
190 | - pc_rtx, pc_rtx, 0, 0); | ||
191 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
192 | |||
193 | SUBST (XEXP (x, 1), swapped ? false_rtx : true_rtx); | ||
194 | SUBST (XEXP (x, 2), swapped ? true_rtx : false_rtx); | ||
195 | @@ -5849,11 +5864,11 @@ | ||
196 | { | ||
197 | temp = subst (simplify_gen_relational (true_code, m, VOIDmode, | ||
198 | cond_op0, cond_op1), | ||
199 | - pc_rtx, pc_rtx, 0, 0); | ||
200 | + pc_rtx, pc_rtx, 0, 0, 0); | ||
201 | temp = simplify_gen_binary (MULT, m, temp, | ||
202 | simplify_gen_binary (MULT, m, c1, | ||
203 | const_true_rtx)); | ||
204 | - temp = subst (temp, pc_rtx, pc_rtx, 0, 0); | ||
205 | + temp = subst (temp, pc_rtx, pc_rtx, 0, 0, 0); | ||
206 | temp = simplify_gen_binary (op, m, gen_lowpart (m, z), temp); | ||
207 | |||
208 | if (extend_op != UNKNOWN) | ||
209 | |||