summaryrefslogtreecommitdiffstats
path: root/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2012-06-28 12:19:53 -0700
committerKoen Kooi <koen@dominion.thruhere.net>2012-07-09 18:40:21 +0200
commit6b278fbb02d818b54b5a9fa2716fc49e896b72a8 (patch)
tree833783fb738ff7abf3d0e3029c9a468e73b06e28 /toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch
parent680af24d1ff95533db610176e6b01fcc9dcf6699 (diff)
downloadmeta-openembedded-6b278fbb02d818b54b5a9fa2716fc49e896b72a8.tar.gz
gcc-4.6: Migrate recipes from OE-Core
Remove linaro patches. If one needs to use linaro modified gcc they should use meta-linaro Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch')
-rw-r--r--toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch453
1 files changed, 0 insertions, 453 deletions
diff --git a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch b/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch
deleted file mode 100644
index 1ad48e512e..0000000000
--- a/toolchain-layer/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106833.patch
+++ /dev/null
@@ -1,453 +0,0 @@
12011-10-27 Ira Rosen <ira.rosen@linaro.org>
2
3 Backport from mainline:
4
5 2011-10-16 Ira Rosen <ira.rosen@linaro.org>
6
7 gcc/
8 * tree-vect-stmts.c (vectorizable_load): For SLP without permutation
9 treat the first load of the node as the first element in its
10 interleaving chain.
11 * tree-vect-slp.c (vect_get_and_check_slp_defs): Swap the operands if
12 necessary and possible.
13 (vect_build_slp_tree): Add new argument. Allow load groups of any size
14 in basic blocks. Keep all the loads for further permutation check.
15 Use the new argument to determine if there is a permutation. Update
16 the recursive calls.
17 (vect_supported_load_permutation_p): Allow subchains of interleaving
18 chains in basic block vectorization.
19 (vect_analyze_slp_instance): Update the call to vect_build_slp_tree.
20 Check load permutation based on the new parameter.
21 (vect_schedule_slp_instance): Don't start from the first element in
22 interleaving chain unless the loads are permuted.
23
24 gcc/testsuite/
25 * gcc.dg/vect/bb-slp-29.c: New test.
26
27=== added file 'gcc/testsuite/gcc.dg/vect/bb-slp-29.c'
28--- old/gcc/testsuite/gcc.dg/vect/bb-slp-29.c 1970-01-01 00:00:00 +0000
29+++ new/gcc/testsuite/gcc.dg/vect/bb-slp-29.c 2011-10-23 11:29:25 +0000
30@@ -0,0 +1,59 @@
31+/* { dg-require-effective-target vect_int } */
32+
33+#include <stdarg.h>
34+#include "tree-vect.h"
35+
36+#define A 3
37+#define B 4
38+#define N 256
39+
40+short src[N], dst[N];
41+
42+void foo (short * __restrict__ dst, short * __restrict__ src, int h, int stride, int dummy)
43+{
44+ int i;
45+ h /= 16;
46+ for (i = 0; i < h; i++)
47+ {
48+ dst[0] = A*src[0] + B*src[1];
49+ dst[1] = A*src[1] + B*src[2];
50+ dst[2] = A*src[2] + B*src[3];
51+ dst[3] = A*src[3] + B*src[4];
52+ dst[4] = A*src[4] + B*src[5];
53+ dst[5] = A*src[5] + B*src[6];
54+ dst[6] = A*src[6] + B*src[7];
55+ dst[7] = A*src[7] + B*src[8];
56+ dst += stride;
57+ src += stride;
58+ if (dummy == 32)
59+ abort ();
60+ }
61+}
62+
63+
64+int main (void)
65+{
66+ int i;
67+
68+ check_vect ();
69+
70+ for (i = 0; i < N; i++)
71+ {
72+ dst[i] = 0;
73+ src[i] = i;
74+ }
75+
76+ foo (dst, src, N, 8, 0);
77+
78+ for (i = 0; i < N/2; i++)
79+ {
80+ if (dst[i] != A * src[i] + B * src[i+1])
81+ abort ();
82+ }
83+
84+ return 0;
85+}
86+
87+/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target { vect_int_mult && vect_element_align } } } } */
88+/* { dg-final { cleanup-tree-dump "slp" } } */
89+
90
91=== modified file 'gcc/tree-vect-slp.c'
92--- old/gcc/tree-vect-slp.c 2011-10-06 11:08:08 +0000
93+++ new/gcc/tree-vect-slp.c 2011-10-23 11:29:25 +0000
94@@ -115,13 +115,15 @@
95 {
96 tree oprnd;
97 unsigned int i, number_of_oprnds;
98- tree def;
99+ tree def[2];
100 gimple def_stmt;
101 enum vect_def_type dt[2] = {vect_unknown_def_type, vect_unknown_def_type};
102 stmt_vec_info stmt_info =
103 vinfo_for_stmt (VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0));
104 enum gimple_rhs_class rhs_class;
105 struct loop *loop = NULL;
106+ enum tree_code rhs_code;
107+ bool different_types = false;
108
109 if (loop_vinfo)
110 loop = LOOP_VINFO_LOOP (loop_vinfo);
111@@ -133,7 +135,7 @@
112 {
113 oprnd = gimple_op (stmt, i + 1);
114
115- if (!vect_is_simple_use (oprnd, loop_vinfo, bb_vinfo, &def_stmt, &def,
116+ if (!vect_is_simple_use (oprnd, loop_vinfo, bb_vinfo, &def_stmt, &def[i],
117 &dt[i])
118 || (!def_stmt && dt[i] != vect_constant_def))
119 {
120@@ -188,11 +190,11 @@
121 switch (gimple_code (def_stmt))
122 {
123 case GIMPLE_PHI:
124- def = gimple_phi_result (def_stmt);
125+ def[i] = gimple_phi_result (def_stmt);
126 break;
127
128 case GIMPLE_ASSIGN:
129- def = gimple_assign_lhs (def_stmt);
130+ def[i] = gimple_assign_lhs (def_stmt);
131 break;
132
133 default:
134@@ -206,8 +208,8 @@
135 {
136 /* op0 of the first stmt of the group - store its info. */
137 *first_stmt_dt0 = dt[i];
138- if (def)
139- *first_stmt_def0_type = TREE_TYPE (def);
140+ if (def[i])
141+ *first_stmt_def0_type = TREE_TYPE (def[i]);
142 else
143 *first_stmt_const_oprnd = oprnd;
144
145@@ -227,8 +229,8 @@
146 {
147 /* op1 of the first stmt of the group - store its info. */
148 *first_stmt_dt1 = dt[i];
149- if (def)
150- *first_stmt_def1_type = TREE_TYPE (def);
151+ if (def[i])
152+ *first_stmt_def1_type = TREE_TYPE (def[i]);
153 else
154 {
155 /* We assume that the stmt contains only one constant
156@@ -249,22 +251,53 @@
157 the def-stmt/s of the first stmt. */
158 if ((i == 0
159 && (*first_stmt_dt0 != dt[i]
160- || (*first_stmt_def0_type && def
161+ || (*first_stmt_def0_type && def[0]
162 && !types_compatible_p (*first_stmt_def0_type,
163- TREE_TYPE (def)))))
164+ TREE_TYPE (def[0])))))
165 || (i == 1
166 && (*first_stmt_dt1 != dt[i]
167- || (*first_stmt_def1_type && def
168+ || (*first_stmt_def1_type && def[1]
169 && !types_compatible_p (*first_stmt_def1_type,
170- TREE_TYPE (def)))))
171- || (!def
172+ TREE_TYPE (def[1])))))
173+ || (!def[i]
174 && !types_compatible_p (TREE_TYPE (*first_stmt_const_oprnd),
175- TREE_TYPE (oprnd))))
176+ TREE_TYPE (oprnd)))
177+ || different_types)
178 {
179- if (vect_print_dump_info (REPORT_SLP))
180- fprintf (vect_dump, "Build SLP failed: different types ");
181+ if (i != number_of_oprnds - 1)
182+ different_types = true;
183+ else
184+ {
185+ if (is_gimple_assign (stmt)
186+ && (rhs_code = gimple_assign_rhs_code (stmt))
187+ && TREE_CODE_CLASS (rhs_code) == tcc_binary
188+ && commutative_tree_code (rhs_code)
189+ && *first_stmt_dt0 == dt[1]
190+ && *first_stmt_dt1 == dt[0]
191+ && def[0] && def[1]
192+ && !(*first_stmt_def0_type
193+ && !types_compatible_p (*first_stmt_def0_type,
194+ TREE_TYPE (def[1])))
195+ && !(*first_stmt_def1_type
196+ && !types_compatible_p (*first_stmt_def1_type,
197+ TREE_TYPE (def[0]))))
198+ {
199+ if (vect_print_dump_info (REPORT_SLP))
200+ {
201+ fprintf (vect_dump, "Swapping operands of ");
202+ print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
203+ }
204+ swap_tree_operands (stmt, gimple_assign_rhs1_ptr (stmt),
205+ gimple_assign_rhs2_ptr (stmt));
206+ }
207+ else
208+ {
209+ if (vect_print_dump_info (REPORT_SLP))
210+ fprintf (vect_dump, "Build SLP failed: different types ");
211
212- return false;
213+ return false;
214+ }
215+ }
216 }
217 }
218 }
219@@ -278,10 +311,10 @@
220
221 case vect_internal_def:
222 case vect_reduction_def:
223- if (i == 0)
224+ if ((i == 0 && !different_types) || (i == 1 && different_types))
225 VEC_safe_push (gimple, heap, *def_stmts0, def_stmt);
226 else
227- VEC_safe_push (gimple, heap, *def_stmts1, def_stmt);
228+ VEC_safe_push (gimple, heap, *def_stmts1, def_stmt);
229 break;
230
231 default:
232@@ -289,7 +322,7 @@
233 if (vect_print_dump_info (REPORT_SLP))
234 {
235 fprintf (vect_dump, "Build SLP failed: illegal type of def ");
236- print_generic_expr (vect_dump, def, TDF_SLIM);
237+ print_generic_expr (vect_dump, def[i], TDF_SLIM);
238 }
239
240 return false;
241@@ -312,7 +345,7 @@
242 int ncopies_for_cost, unsigned int *max_nunits,
243 VEC (int, heap) **load_permutation,
244 VEC (slp_tree, heap) **loads,
245- unsigned int vectorization_factor)
246+ unsigned int vectorization_factor, bool *loads_permuted)
247 {
248 VEC (gimple, heap) *def_stmts0 = VEC_alloc (gimple, heap, group_size);
249 VEC (gimple, heap) *def_stmts1 = VEC_alloc (gimple, heap, group_size);
250@@ -523,7 +556,9 @@
251
252 /* Check that the size of interleaved loads group is not
253 greater than the SLP group size. */
254- if (DR_GROUP_SIZE (vinfo_for_stmt (stmt)) > ncopies * group_size)
255+ if (loop_vinfo
256+ && DR_GROUP_SIZE (vinfo_for_stmt (stmt))
257+ > ncopies * group_size)
258 {
259 if (vect_print_dump_info (REPORT_SLP))
260 {
261@@ -644,19 +679,22 @@
262 /* Strided loads were reached - stop the recursion. */
263 if (stop_recursion)
264 {
265+ VEC_safe_push (slp_tree, heap, *loads, *node);
266 if (permutation)
267 {
268- VEC_safe_push (slp_tree, heap, *loads, *node);
269+
270+ *loads_permuted = true;
271 *inside_cost
272 += targetm.vectorize.builtin_vectorization_cost (vec_perm, NULL, 0)
273 * group_size;
274 }
275 else
276- {
277- /* We don't check here complex numbers chains, so we keep them in
278- LOADS for further check in vect_supported_load_permutation_p. */
279+ {
280+ /* We don't check here complex numbers chains, so we set
281+ LOADS_PERMUTED for further check in
282+ vect_supported_load_permutation_p. */
283 if (rhs_code == REALPART_EXPR || rhs_code == IMAGPART_EXPR)
284- VEC_safe_push (slp_tree, heap, *loads, *node);
285+ *loads_permuted = true;
286 }
287
288 return true;
289@@ -675,7 +713,7 @@
290 if (!vect_build_slp_tree (loop_vinfo, bb_vinfo, &left_node, group_size,
291 inside_cost, outside_cost, ncopies_for_cost,
292 max_nunits, load_permutation, loads,
293- vectorization_factor))
294+ vectorization_factor, loads_permuted))
295 return false;
296
297 SLP_TREE_LEFT (*node) = left_node;
298@@ -693,7 +731,7 @@
299 if (!vect_build_slp_tree (loop_vinfo, bb_vinfo, &right_node, group_size,
300 inside_cost, outside_cost, ncopies_for_cost,
301 max_nunits, load_permutation, loads,
302- vectorization_factor))
303+ vectorization_factor, loads_permuted))
304 return false;
305
306 SLP_TREE_RIGHT (*node) = right_node;
307@@ -879,8 +917,10 @@
308 bool supported, bad_permutation = false;
309 sbitmap load_index;
310 slp_tree node, other_complex_node;
311- gimple stmt, first = NULL, other_node_first;
312+ gimple stmt, first = NULL, other_node_first, load, next_load, first_load;
313 unsigned complex_numbers = 0;
314+ struct data_reference *dr;
315+ bb_vec_info bb_vinfo;
316
317 /* FORNOW: permutations are only supported in SLP. */
318 if (!slp_instn)
319@@ -1040,6 +1080,76 @@
320 }
321 }
322
323+ /* In basic block vectorization we allow any subchain of an interleaving
324+ chain.
325+ FORNOW: not supported in loop SLP because of realignment compications. */
326+ bb_vinfo = STMT_VINFO_BB_VINFO (vinfo_for_stmt (stmt));
327+ bad_permutation = false;
328+ /* Check that for every node in the instance teh loads form a subchain. */
329+ if (bb_vinfo)
330+ {
331+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node)
332+ {
333+ next_load = NULL;
334+ first_load = NULL;
335+ FOR_EACH_VEC_ELT (gimple, SLP_TREE_SCALAR_STMTS (node), j, load)
336+ {
337+ if (!first_load)
338+ first_load = DR_GROUP_FIRST_DR (vinfo_for_stmt (load));
339+ else if (first_load
340+ != DR_GROUP_FIRST_DR (vinfo_for_stmt (load)))
341+ {
342+ bad_permutation = true;
343+ break;
344+ }
345+
346+ if (j != 0 && next_load != load)
347+ {
348+ bad_permutation = true;
349+ break;
350+ }
351+
352+ next_load = DR_GROUP_NEXT_DR (vinfo_for_stmt (load));
353+ }
354+
355+ if (bad_permutation)
356+ break;
357+ }
358+
359+ /* Check that the alignment of the first load in every subchain, i.e.,
360+ the first statement in every load node, is supported. */
361+ if (!bad_permutation)
362+ {
363+ FOR_EACH_VEC_ELT (slp_tree, SLP_INSTANCE_LOADS (slp_instn), i, node)
364+ {
365+ first_load = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (node), 0);
366+ if (first_load
367+ != DR_GROUP_FIRST_DR (vinfo_for_stmt (first_load)))
368+ {
369+ dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (first_load));
370+ if (vect_supportable_dr_alignment (dr, false)
371+ == dr_unaligned_unsupported)
372+ {
373+ if (vect_print_dump_info (REPORT_SLP))
374+ {
375+ fprintf (vect_dump, "unsupported unaligned load ");
376+ print_gimple_stmt (vect_dump, first_load, 0,
377+ TDF_SLIM);
378+ }
379+ bad_permutation = true;
380+ break;
381+ }
382+ }
383+ }
384+
385+ if (!bad_permutation)
386+ {
387+ VEC_free (int, heap, SLP_INSTANCE_LOAD_PERMUTATION (slp_instn));
388+ return true;
389+ }
390+ }
391+ }
392+
393 /* FORNOW: the only supported permutation is 0..01..1.. of length equal to
394 GROUP_SIZE and where each sequence of same drs is of GROUP_SIZE length as
395 well (unless it's reduction). */
396@@ -1149,6 +1259,7 @@
397 VEC (int, heap) *load_permutation;
398 VEC (slp_tree, heap) *loads;
399 struct data_reference *dr = STMT_VINFO_DATA_REF (vinfo_for_stmt (stmt));
400+ bool loads_permuted = false;
401
402 if (dr)
403 {
404@@ -1238,7 +1349,7 @@
405 if (vect_build_slp_tree (loop_vinfo, bb_vinfo, &node, group_size,
406 &inside_cost, &outside_cost, ncopies_for_cost,
407 &max_nunits, &load_permutation, &loads,
408- vectorization_factor))
409+ vectorization_factor, &loads_permuted))
410 {
411 /* Calculate the unrolling factor based on the smallest type. */
412 if (max_nunits > nunits)
413@@ -1263,7 +1374,8 @@
414 SLP_INSTANCE_LOADS (new_instance) = loads;
415 SLP_INSTANCE_FIRST_LOAD_STMT (new_instance) = NULL;
416 SLP_INSTANCE_LOAD_PERMUTATION (new_instance) = load_permutation;
417- if (VEC_length (slp_tree, loads))
418+
419+ if (loads_permuted)
420 {
421 if (!vect_supported_load_permutation_p (new_instance, group_size,
422 load_permutation))
423@@ -2542,10 +2654,11 @@
424 /* Loads should be inserted before the first load. */
425 if (SLP_INSTANCE_FIRST_LOAD_STMT (instance)
426 && STMT_VINFO_STRIDED_ACCESS (stmt_info)
427- && !REFERENCE_CLASS_P (gimple_get_lhs (stmt)))
428+ && !REFERENCE_CLASS_P (gimple_get_lhs (stmt))
429+ && SLP_INSTANCE_LOAD_PERMUTATION (instance))
430 si = gsi_for_stmt (SLP_INSTANCE_FIRST_LOAD_STMT (instance));
431 else if (is_pattern_stmt_p (stmt_info))
432- si = gsi_for_stmt (STMT_VINFO_RELATED_STMT (stmt_info));
433+ si = gsi_for_stmt (STMT_VINFO_RELATED_STMT (stmt_info));
434 else
435 si = gsi_for_stmt (stmt);
436
437
438=== modified file 'gcc/tree-vect-stmts.c'
439--- old/gcc/tree-vect-stmts.c 2011-10-16 12:16:07 +0000
440+++ new/gcc/tree-vect-stmts.c 2011-10-23 11:29:25 +0000
441@@ -4285,6 +4285,11 @@
442 if (strided_load)
443 {
444 first_stmt = DR_GROUP_FIRST_DR (stmt_info);
445+ if (slp
446+ && !SLP_INSTANCE_LOAD_PERMUTATION (slp_node_instance)
447+ && first_stmt != VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0))
448+ first_stmt = VEC_index (gimple, SLP_TREE_SCALAR_STMTS (slp_node), 0);
449+
450 /* Check if the chain of loads is already vectorized. */
451 if (STMT_VINFO_VEC_STMT (vinfo_for_stmt (first_stmt)))
452 {
453