diff options
Diffstat (limited to 'meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106821.patch')
| -rw-r--r-- | meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106821.patch | 240 |
1 files changed, 240 insertions, 0 deletions
diff --git a/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106821.patch b/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106821.patch new file mode 100644 index 0000000000..f25a37858d --- /dev/null +++ b/meta-oe/recipes-devtools/gcc/gcc-4.6/linaro/gcc-4.6-linaro-r106821.patch | |||
| @@ -0,0 +1,240 @@ | |||
| 1 | 2011-10-06 Ira Rosen <ira.rosen@linaro.org> | ||
| 2 | |||
| 3 | gcc/testsuite/ | ||
| 4 | * gcc.dg/vect/bb-slp-26.c: Simplify to make the basic block | ||
| 5 | vectorizable. | ||
| 6 | |||
| 7 | Backport from mainline: | ||
| 8 | |||
| 9 | 2011-09-25 Ira Rosen <ira.rosen@linaro.org> | ||
| 10 | |||
| 11 | gcc/ | ||
| 12 | * tree-vect-slp.c (vect_slp_analyze_bb_1): Split out core part | ||
| 13 | of vect_analyze_bb here. | ||
| 14 | (vect_analyze_bb): Loop over vector sizes calling vect_analyze_bb_1. | ||
| 15 | |||
| 16 | gcc/testsuite/ | ||
| 17 | * lib/target-supports.exp (check_effective_target_vect64): New. | ||
| 18 | * gcc.dg/vect/bb-slp-11.c: Expect the error message twice in case | ||
| 19 | of multiple vector sizes. | ||
| 20 | * gcc.dg/vect/bb-slp-26.c: New. | ||
| 21 | |||
| 22 | === modified file 'gcc/testsuite/gcc.dg/vect/bb-slp-11.c' | ||
| 23 | --- old/gcc/testsuite/gcc.dg/vect/bb-slp-11.c 2010-11-22 12:16:52 +0000 | ||
| 24 | +++ new/gcc/testsuite/gcc.dg/vect/bb-slp-11.c 2011-10-02 10:40:34 +0000 | ||
| 25 | @@ -49,6 +49,7 @@ | ||
| 26 | } | ||
| 27 | |||
| 28 | /* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 0 "slp" } } */ | ||
| 29 | -/* { dg-final { scan-tree-dump-times "SLP with multiple types" 1 "slp" } } */ | ||
| 30 | +/* { dg-final { scan-tree-dump-times "SLP with multiple types" 1 "slp" { xfail vect_multiple_sizes } } } */ | ||
| 31 | +/* { dg-final { scan-tree-dump-times "SLP with multiple types" 2 "slp" { target vect_multiple_sizes } } } */ | ||
| 32 | /* { dg-final { cleanup-tree-dump "slp" } } */ | ||
| 33 | |||
| 34 | |||
| 35 | === added file 'gcc/testsuite/gcc.dg/vect/bb-slp-26.c' | ||
| 36 | --- old/gcc/testsuite/gcc.dg/vect/bb-slp-26.c 1970-01-01 00:00:00 +0000 | ||
| 37 | +++ new/gcc/testsuite/gcc.dg/vect/bb-slp-26.c 2011-10-02 10:40:34 +0000 | ||
| 38 | @@ -0,0 +1,60 @@ | ||
| 39 | +/* { dg-require-effective-target vect_int } */ | ||
| 40 | + | ||
| 41 | +#include <stdarg.h> | ||
| 42 | +#include "tree-vect.h" | ||
| 43 | + | ||
| 44 | +#define A 3 | ||
| 45 | +#define B 4 | ||
| 46 | +#define N 256 | ||
| 47 | + | ||
| 48 | +char src[N], dst[N]; | ||
| 49 | + | ||
| 50 | +void foo (char * __restrict__ dst, char * __restrict__ src, int h, | ||
| 51 | + int stride, int dummy) | ||
| 52 | +{ | ||
| 53 | + int i; | ||
| 54 | + h /= 16; | ||
| 55 | + for (i = 0; i < h; i++) | ||
| 56 | + { | ||
| 57 | + dst[0] += A*src[0]; | ||
| 58 | + dst[1] += A*src[1]; | ||
| 59 | + dst[2] += A*src[2]; | ||
| 60 | + dst[3] += A*src[3]; | ||
| 61 | + dst[4] += A*src[4]; | ||
| 62 | + dst[5] += A*src[5]; | ||
| 63 | + dst[6] += A*src[6]; | ||
| 64 | + dst[7] += A*src[7]; | ||
| 65 | + dst += 8; | ||
| 66 | + src += 8; | ||
| 67 | + if (dummy == 32) | ||
| 68 | + abort (); | ||
| 69 | + } | ||
| 70 | +} | ||
| 71 | + | ||
| 72 | + | ||
| 73 | +int main (void) | ||
| 74 | +{ | ||
| 75 | + int i; | ||
| 76 | + | ||
| 77 | + check_vect (); | ||
| 78 | + | ||
| 79 | + for (i = 0; i < N; i++) | ||
| 80 | + { | ||
| 81 | + dst[i] = 0; | ||
| 82 | + src[i] = i/8; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + foo (dst, src, N, 8, 0); | ||
| 86 | + | ||
| 87 | + for (i = 0; i < N/2; i++) | ||
| 88 | + { | ||
| 89 | + if (dst[i] != A * src[i]) | ||
| 90 | + abort (); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + return 0; | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +/* { dg-final { scan-tree-dump-times "basic block vectorized using SLP" 1 "slp" { target vect64 } } } */ | ||
| 97 | +/* { dg-final { cleanup-tree-dump "slp" } } */ | ||
| 98 | + | ||
| 99 | |||
| 100 | === modified file 'gcc/testsuite/lib/target-supports.exp' | ||
| 101 | --- old/gcc/testsuite/lib/target-supports.exp 2011-09-20 07:54:28 +0000 | ||
| 102 | +++ new/gcc/testsuite/lib/target-supports.exp 2011-10-02 10:40:34 +0000 | ||
| 103 | @@ -3283,6 +3283,24 @@ | ||
| 104 | return $et_vect_multiple_sizes_saved | ||
| 105 | } | ||
| 106 | |||
| 107 | +# Return 1 if the target supports vectors of 64 bits. | ||
| 108 | + | ||
| 109 | +proc check_effective_target_vect64 { } { | ||
| 110 | + global et_vect64 | ||
| 111 | + | ||
| 112 | + if [info exists et_vect64_saved] { | ||
| 113 | + verbose "check_effective_target_vect64: using cached result" 2 | ||
| 114 | + } else { | ||
| 115 | + set et_vect64_saved 0 | ||
| 116 | + if { ([istarget arm*-*-*] && [check_effective_target_arm_neon_ok]) } { | ||
| 117 | + set et_vect64_saved 1 | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + verbose "check_effective_target_vect64: returning $et_vect64_saved" 2 | ||
| 122 | + return $et_vect64_saved | ||
| 123 | +} | ||
| 124 | + | ||
| 125 | # Return 1 if the target supports section-anchors | ||
| 126 | |||
| 127 | proc check_effective_target_section_anchors { } { | ||
| 128 | |||
| 129 | === modified file 'gcc/tree-vect-slp.c' | ||
| 130 | --- old/gcc/tree-vect-slp.c 2011-07-06 12:04:10 +0000 | ||
| 131 | +++ new/gcc/tree-vect-slp.c 2011-10-02 10:40:34 +0000 | ||
| 132 | @@ -1664,42 +1664,18 @@ | ||
| 133 | |||
| 134 | /* Check if the basic block can be vectorized. */ | ||
| 135 | |||
| 136 | -bb_vec_info | ||
| 137 | -vect_slp_analyze_bb (basic_block bb) | ||
| 138 | +static bb_vec_info | ||
| 139 | +vect_slp_analyze_bb_1 (basic_block bb) | ||
| 140 | { | ||
| 141 | bb_vec_info bb_vinfo; | ||
| 142 | VEC (ddr_p, heap) *ddrs; | ||
| 143 | VEC (slp_instance, heap) *slp_instances; | ||
| 144 | slp_instance instance; | ||
| 145 | - int i, insns = 0; | ||
| 146 | - gimple_stmt_iterator gsi; | ||
| 147 | + int i; | ||
| 148 | int min_vf = 2; | ||
| 149 | int max_vf = MAX_VECTORIZATION_FACTOR; | ||
| 150 | bool data_dependence_in_bb = false; | ||
| 151 | |||
| 152 | - current_vector_size = 0; | ||
| 153 | - | ||
| 154 | - if (vect_print_dump_info (REPORT_DETAILS)) | ||
| 155 | - fprintf (vect_dump, "===vect_slp_analyze_bb===\n"); | ||
| 156 | - | ||
| 157 | - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | ||
| 158 | - { | ||
| 159 | - gimple stmt = gsi_stmt (gsi); | ||
| 160 | - if (!is_gimple_debug (stmt) | ||
| 161 | - && !gimple_nop_p (stmt) | ||
| 162 | - && gimple_code (stmt) != GIMPLE_LABEL) | ||
| 163 | - insns++; | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - if (insns > PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)) | ||
| 167 | - { | ||
| 168 | - if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) | ||
| 169 | - fprintf (vect_dump, "not vectorized: too many instructions in basic " | ||
| 170 | - "block.\n"); | ||
| 171 | - | ||
| 172 | - return NULL; | ||
| 173 | - } | ||
| 174 | - | ||
| 175 | bb_vinfo = new_bb_vec_info (bb); | ||
| 176 | if (!bb_vinfo) | ||
| 177 | return NULL; | ||
| 178 | @@ -1819,6 +1795,61 @@ | ||
| 179 | } | ||
| 180 | |||
| 181 | |||
| 182 | +bb_vec_info | ||
| 183 | +vect_slp_analyze_bb (basic_block bb) | ||
| 184 | +{ | ||
| 185 | + bb_vec_info bb_vinfo; | ||
| 186 | + int insns = 0; | ||
| 187 | + gimple_stmt_iterator gsi; | ||
| 188 | + unsigned int vector_sizes; | ||
| 189 | + | ||
| 190 | + if (vect_print_dump_info (REPORT_DETAILS)) | ||
| 191 | + fprintf (vect_dump, "===vect_slp_analyze_bb===\n"); | ||
| 192 | + | ||
| 193 | + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) | ||
| 194 | + { | ||
| 195 | + gimple stmt = gsi_stmt (gsi); | ||
| 196 | + if (!is_gimple_debug (stmt) | ||
| 197 | + && !gimple_nop_p (stmt) | ||
| 198 | + && gimple_code (stmt) != GIMPLE_LABEL) | ||
| 199 | + insns++; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + if (insns > PARAM_VALUE (PARAM_SLP_MAX_INSNS_IN_BB)) | ||
| 203 | + { | ||
| 204 | + if (vect_print_dump_info (REPORT_UNVECTORIZED_LOCATIONS)) | ||
| 205 | + fprintf (vect_dump, "not vectorized: too many instructions in basic " | ||
| 206 | + "block.\n"); | ||
| 207 | + | ||
| 208 | + return NULL; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + /* Autodetect first vector size we try. */ | ||
| 212 | + current_vector_size = 0; | ||
| 213 | + vector_sizes = targetm.vectorize.autovectorize_vector_sizes (); | ||
| 214 | + | ||
| 215 | + while (1) | ||
| 216 | + { | ||
| 217 | + bb_vinfo = vect_slp_analyze_bb_1 (bb); | ||
| 218 | + if (bb_vinfo) | ||
| 219 | + return bb_vinfo; | ||
| 220 | + | ||
| 221 | + destroy_bb_vec_info (bb_vinfo); | ||
| 222 | + | ||
| 223 | + vector_sizes &= ~current_vector_size; | ||
| 224 | + if (vector_sizes == 0 | ||
| 225 | + || current_vector_size == 0) | ||
| 226 | + return NULL; | ||
| 227 | + | ||
| 228 | + /* Try the next biggest vector size. */ | ||
| 229 | + current_vector_size = 1 << floor_log2 (vector_sizes); | ||
| 230 | + if (vect_print_dump_info (REPORT_DETAILS)) | ||
| 231 | + fprintf (vect_dump, "***** Re-trying analysis with " | ||
| 232 | + "vector size %d\n", current_vector_size); | ||
| 233 | + } | ||
| 234 | +} | ||
| 235 | + | ||
| 236 | + | ||
| 237 | /* SLP costs are calculated according to SLP instance unrolling factor (i.e., | ||
| 238 | the number of created vector stmts depends on the unrolling factor). | ||
| 239 | However, the actual number of vector stmts for every SLP node depends on | ||
| 240 | |||
