diff options
Diffstat (limited to 'gcc-4.9/gcc')
-rw-r--r-- | gcc-4.9/gcc/ChangeLog | 27 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/ChangeLog | 16 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-1.c | 32 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-2.c | 35 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63530.c | 30 | ||||
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.target/i386/pr63563.c | 17 | ||||
-rw-r--r-- | gcc-4.9/gcc/tree-vect-data-refs.c | 37 | ||||
-rw-r--r-- | gcc-4.9/gcc/tree-vect-stmts.c | 7 | ||||
-rw-r--r-- | gcc-4.9/gcc/tree-vectorizer.h | 6 |
9 files changed, 196 insertions, 11 deletions
diff --git a/gcc-4.9/gcc/ChangeLog b/gcc-4.9/gcc/ChangeLog index 1d9912ada..ce45f71bc 100644 --- a/gcc-4.9/gcc/ChangeLog +++ b/gcc-4.9/gcc/ChangeLog @@ -1,3 +1,9 @@ +2014-10-27 Guozhi Wei <carrot@google.com> + + PR tree-optimization/63530 + tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Set + pointer alignment according to DR_MISALIGNMENT. + 2014-10-24 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * config/aarch64/aarch64-elf-raw.h (CA53_ERR_835769_SPEC): Define. @@ -5,6 +11,27 @@ * config/aarch64/aarch64-linux.h (CA53_ERR_835769_SPEC): Define. (LINK_SPEC): Include CA53_ERR_835769_SPEC. +2014-10-21 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63563 + * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Bail out + if either dra or drb stmts are not normal loads/stores. + +2014-09-25 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63341 + * tree-vectorizer.h (vect_create_data_ref_ptr, + vect_create_addr_base_for_vector_ref): Add another tree argument + defaulting to NULL_TREE. + * tree-vect-data-refs.c (vect_create_data_ref_ptr): Add byte_offset + argument, pass it down to vect_create_addr_base_for_vector_ref. + (vect_create_addr_base_for_vector_ref): Add byte_offset argument, + add that to base_offset too if non-NULL. + * tree-vect-stmts.c (vectorizable_load): Add byte_offset variable, + for dr_explicit_realign_optimized set it to vector byte size + - 1 instead of setting offset, pass byte_offset down to + vect_create_data_ref_ptr. + 2014-08-27 Guozhi Wei <carrot@google.com> PR target/62262 diff --git a/gcc-4.9/gcc/testsuite/ChangeLog b/gcc-4.9/gcc/testsuite/ChangeLog index 51626c35e..2200c1267 100644 --- a/gcc-4.9/gcc/testsuite/ChangeLog +++ b/gcc-4.9/gcc/testsuite/ChangeLog @@ -1,3 +1,19 @@ +2014-10-27 Guozhi Wei <carrot@google.com> + + PR tree-optimization/63530 + gcc.dg/vect/pr63530.c: New test. + +2014-10-21 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63563 + * gcc.target/i386/pr63563.c: New test. + +2014-09-25 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/63341 + * gcc.dg/vect/pr63341-1.c: New test. + * gcc.dg/vect/pr63341-2.c: New test. + 2014-09-04 Guozhi Wei <carrot@google.com> PR target/62040 diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-1.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-1.c new file mode 100644 index 000000000..4aece7bbd --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-1.c @@ -0,0 +1,32 @@ +/* PR tree-optimization/63341 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +typedef union U { unsigned short s; unsigned char c; } __attribute__((packed)) U; +struct S { char e __attribute__((aligned (64))); U s[32]; }; +struct S t = {0, {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, + {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}, + {17}, {18}, {19}, {20}, {21}, {22}, {23}, {24}, + {25}, {26}, {27}, {28}, {29}, {30}, {31}, {32}}}; +unsigned short d[32] = { 1 }; + +__attribute__((noinline, noclone)) void +foo () +{ + int i; + for (i = 0; i < 32; i++) + d[i] = t.s[i].s; + if (__builtin_memcmp (d, t.s, sizeof d)) + abort (); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-2.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-2.c new file mode 100644 index 000000000..4e7d2bb1f --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63341-2.c @@ -0,0 +1,35 @@ +/* PR tree-optimization/63341 */ +/* { dg-do run } */ + +#include "tree-vect.h" + +typedef union U { unsigned short s; unsigned char c; } __attribute__((packed)) U; +struct S { char e __attribute__((aligned (64))); U s[32]; }; +struct S t = {0, {{0x5010}, {0x5111}, {0x5212}, {0x5313}, {0x5414}, {0x5515}, {0x5616}, {0x5717}, + {0x5818}, {0x5919}, {0x5a1a}, {0x5b1b}, {0x5c1c}, {0x5d1d}, {0x5e1e}, {0x5f1f}, + {0x6020}, {0x6121}, {0x6222}, {0x6323}, {0x6424}, {0x6525}, {0x6626}, {0x6727}, + {0x6828}, {0x6929}, {0x6a2a}, {0x6b2b}, {0x6c2c}, {0x6d2d}, {0x6e2e}, {0x6f2f}}}; +unsigned short d[32] = { 1 }; + +__attribute__((noinline, noclone)) void +foo () +{ + int i; + for (i = 0; i < 32; i++) + d[i] = t.s[i].s + 4; + for (i = 0; i < 32; i++) + if (d[i] != t.s[i].s + 4) + abort (); + else + asm volatile ("" : : : "memory"); +} + +int +main () +{ + check_vect (); + foo (); + return 0; +} + +/* { dg-final { cleanup-tree-dump "vect" } } */ diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63530.c b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63530.c new file mode 100644 index 000000000..b583b9b35 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/vect/pr63530.c @@ -0,0 +1,30 @@ +/* { dg-options "-O2 -ftree-vectorize -funroll-loops --param \"max-completely-peeled-insns=400\"" } */ + +/* PR tree-optimization/63530 */ +/* On armv7 hardware, following options cause run time failure */ +/* -march=armv7-a -mfloat-abi=hard -mfpu=neon -marm -O2 -ftree-vectorize */ +/* -funroll-loops --param "max-completely-peeled-insns=400" */ + +#include <stdlib.h> + +typedef struct { + unsigned char map[256]; + int i; +} A, *AP; + +AP __attribute__ ((noinline)) +foo (int n) +{ + AP b = (AP)calloc (1, sizeof (A)); + int i; + for (i = n; i < 256; i++) + b->map[i] = i; + return b; +} + +int +main() +{ + AP p = foo(3); + return p->map[30] - p->map[20] - p->map[10]; +} diff --git a/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63563.c b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63563.c new file mode 100644 index 000000000..ce3e4658e --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.target/i386/pr63563.c @@ -0,0 +1,17 @@ +/* PR tree-optimization/63563 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -mavx2" } */ + +struct A { unsigned long a, b, c, d; } a[1024] = { { 0, 1, 2, 3 } }, b; + +void +foo (void) +{ + int i; + for (i = 0; i < 1024; i++) + { + a[i].a = a[i].b = a[i].c = b.c; + if (a[i].d) + a[i].d = b.d; + } +} diff --git a/gcc-4.9/gcc/tree-vect-data-refs.c b/gcc-4.9/gcc/tree-vect-data-refs.c index ab1197ec6..853b89a4a 100644 --- a/gcc-4.9/gcc/tree-vect-data-refs.c +++ b/gcc-4.9/gcc/tree-vect-data-refs.c @@ -2530,11 +2530,14 @@ vect_analyze_data_ref_accesses (loop_vec_info loop_vinfo, bb_vec_info bb_vinfo) over them. The we can just skip ahead to the next DR here. */ /* Check that the data-refs have same first location (except init) - and they are both either store or load (not load and store). */ + and they are both either store or load (not load and store, + not masked loads or stores). */ if (DR_IS_READ (dra) != DR_IS_READ (drb) || !operand_equal_p (DR_BASE_ADDRESS (dra), DR_BASE_ADDRESS (drb), 0) - || !dr_equal_offsets_p (dra, drb)) + || !dr_equal_offsets_p (dra, drb) + || !gimple_assign_single_p (DR_STMT (dra)) + || !gimple_assign_single_p (DR_STMT (drb))) break; /* Check that the data-refs have the same constant size and step. */ @@ -3841,6 +3844,9 @@ vect_get_new_vect_var (tree type, enum vect_var_kind var_kind, const char *name) is as follows: if LOOP=i_loop: &in (relative to i_loop) if LOOP=j_loop: &in+i*2B (relative to j_loop) + BYTE_OFFSET: Optional, defaulted to NULL. If supplied, it is added to the + initial address. Unlike OFFSET, which is number of elements to + be added, BYTE_OFFSET is measured in bytes. Output: 1. Return an SSA_NAME whose value is the address of the memory location of @@ -3854,7 +3860,8 @@ tree vect_create_addr_base_for_vector_ref (gimple stmt, gimple_seq *new_stmt_list, tree offset, - struct loop *loop) + struct loop *loop, + tree byte_offset) { stmt_vec_info stmt_info = vinfo_for_stmt (stmt); struct data_reference *dr = STMT_VINFO_DATA_REF (stmt_info); @@ -3907,6 +3914,12 @@ vect_create_addr_base_for_vector_ref (gimple stmt, base_offset = fold_build2 (PLUS_EXPR, sizetype, base_offset, offset); } + if (byte_offset) + { + byte_offset = fold_convert (sizetype, byte_offset); + base_offset = fold_build2 (PLUS_EXPR, sizetype, + base_offset, byte_offset); + } /* base + base_offset */ if (loop_vinfo) @@ -3928,8 +3941,12 @@ vect_create_addr_base_for_vector_ref (gimple stmt, && TREE_CODE (addr_base) == SSA_NAME) { duplicate_ssa_name_ptr_info (addr_base, DR_PTR_INFO (dr)); - if (offset) + unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info)); + int misalign = DR_MISALIGNMENT (dr); + if (offset || byte_offset || (misalign == -1)) mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base)); + else + set_ptr_info_alignment (SSA_NAME_PTR_INFO (addr_base), align, misalign); } if (dump_enabled_p ()) @@ -3964,6 +3981,10 @@ vect_create_addr_base_for_vector_ref (gimple stmt, 5. BSI: location where the new stmts are to be placed if there is no loop 6. ONLY_INIT: indicate if ap is to be updated in the loop, or remain pointing to the initial address. + 7. BYTE_OFFSET (optional, defaults to NULL): a byte offset to be added + to the initial address accessed by the data-ref in STMT. This is + similar to OFFSET, but OFFSET is counted in elements, while BYTE_OFFSET + in bytes. Output: 1. Declare a new ptr to vector_type, and have it point to the base of the @@ -3977,6 +3998,8 @@ vect_create_addr_base_for_vector_ref (gimple stmt, initial_address = &a[init]; if OFFSET is supplied: initial_address = &a[init + OFFSET]; + if BYTE_OFFSET is supplied: + initial_address = &a[init] + BYTE_OFFSET; Return the initial_address in INITIAL_ADDRESS. @@ -3994,7 +4017,7 @@ tree vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, tree offset, tree *initial_address, gimple_stmt_iterator *gsi, gimple *ptr_incr, - bool only_init, bool *inv_p) + bool only_init, bool *inv_p, tree byte_offset) { const char *base_name; stmt_vec_info stmt_info = vinfo_for_stmt (stmt); @@ -4137,10 +4160,10 @@ vect_create_data_ref_ptr (gimple stmt, tree aggr_type, struct loop *at_loop, /* (2) Calculate the initial address of the aggregate-pointer, and set the aggregate-pointer to point to it before the loop. */ - /* Create: (&(base[init_val+offset]) in the loop preheader. */ + /* Create: (&(base[init_val+offset]+byte_offset) in the loop preheader. */ new_temp = vect_create_addr_base_for_vector_ref (stmt, &new_stmt_list, - offset, loop); + offset, loop, byte_offset); if (new_stmt_list) { if (pe) diff --git a/gcc-4.9/gcc/tree-vect-stmts.c b/gcc-4.9/gcc/tree-vect-stmts.c index b87c14345..d208f2d6b 100644 --- a/gcc-4.9/gcc/tree-vect-stmts.c +++ b/gcc-4.9/gcc/tree-vect-stmts.c @@ -5601,6 +5601,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, int i, j, group_size, group_gap; tree msq = NULL_TREE, lsq; tree offset = NULL_TREE; + tree byte_offset = NULL_TREE; tree realignment_token = NULL_TREE; gimple phi = NULL; vec<tree> dr_chain = vNULL; @@ -6262,7 +6263,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, if (alignment_support_scheme == dr_explicit_realign_optimized) { phi = SSA_NAME_DEF_STMT (msq); - offset = size_int (TYPE_VECTOR_SUBPARTS (vectype) - 1); + byte_offset = size_binop (MINUS_EXPR, TYPE_SIZE_UNIT (vectype), + size_one_node); } } else @@ -6303,7 +6305,8 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, dataref_ptr = vect_create_data_ref_ptr (first_stmt, aggr_type, at_loop, offset, &dummy, gsi, &ptr_incr, - simd_lane_access_p, &inv_p); + simd_lane_access_p, &inv_p, + byte_offset); } else if (dataref_offset) dataref_offset = int_const_binop (PLUS_EXPR, dataref_offset, diff --git a/gcc-4.9/gcc/tree-vectorizer.h b/gcc-4.9/gcc/tree-vectorizer.h index f84bec56b..09ca48e4c 100644 --- a/gcc-4.9/gcc/tree-vectorizer.h +++ b/gcc-4.9/gcc/tree-vectorizer.h @@ -1061,7 +1061,8 @@ extern bool vect_analyze_data_refs (loop_vec_info, bb_vec_info, int *, unsigned *); extern tree vect_create_data_ref_ptr (gimple, tree, struct loop *, tree, tree *, gimple_stmt_iterator *, - gimple *, bool, bool *); + gimple *, bool, bool *, + tree = NULL_TREE); extern tree bump_vector_ptr (tree, gimple, gimple_stmt_iterator *, gimple, tree); extern tree vect_create_destination_var (tree, tree); extern bool vect_grouped_store_supported (tree, unsigned HOST_WIDE_INT); @@ -1078,7 +1079,8 @@ extern void vect_transform_grouped_load (gimple, vec<tree> , int, extern void vect_record_grouped_load_vectors (gimple, vec<tree> ); extern tree vect_get_new_vect_var (tree, enum vect_var_kind, const char *); extern tree vect_create_addr_base_for_vector_ref (gimple, gimple_seq *, - tree, struct loop *); + tree, struct loop *, + tree = NULL_TREE); /* In tree-vect-loop.c. */ /* FORNOW: Used in tree-parloops.c. */ |