diff options
author | Rong Xu <xur@google.com> | 2014-10-31 12:00:28 -0700 |
---|---|---|
committer | Rong Xu <xur@google.com> | 2014-10-31 12:00:28 -0700 |
commit | 29098ff058814235fb39d00b7496b7f8345ed3eb (patch) | |
tree | f0aaf66f503399133223096679a60c1217a45391 /gcc-4.9/gcc/tree-vect-data-refs.c | |
parent | e86367917b8400cc955d8bba75dcc329cb0e75d0 (diff) | |
download | toolchain_gcc-29098ff058814235fb39d00b7496b7f8345ed3eb.tar.gz toolchain_gcc-29098ff058814235fb39d00b7496b7f8345ed3eb.tar.bz2 toolchain_gcc-29098ff058814235fb39d00b7496b7f8345ed3eb.zip |
[4.9] Backport patches fixed vectorization issues.
Backport 3 patches from upstream gcc that fixed some vectorization
issues: r215585 fixed PR63341
r216508 fixed PR63563
r216770 fixed PR63530
Change-Id: I650bf25ef0843b1ff01911b567fb26e069fd4550
Diffstat (limited to 'gcc-4.9/gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc-4.9/gcc/tree-vect-data-refs.c | 37 |
1 files changed, 30 insertions, 7 deletions
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) |