aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-data-refs.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2019-06-17 23:20:00 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2019-06-17 23:20:00 +0200
commit0356aab806921fe5d766d3fc74cf49dffc271d18 (patch)
tree4dbb450a132e4d4c5cadbc107b5997460457aecc /gcc/tree-vect-data-refs.c
parenta064fd4c7385442dd4f9f3a1b538aef2fdac5209 (diff)
downloadgcc-0356aab806921fe5d766d3fc74cf49dffc271d18.zip
gcc-0356aab806921fe5d766d3fc74cf49dffc271d18.tar.gz
gcc-0356aab806921fe5d766d3fc74cf49dffc271d18.tar.bz2
omp-low.c (struct omp_context): Add scan_inclusive field.
* omp-low.c (struct omp_context): Add scan_inclusive field. (scan_omp_1_stmt) <case GIMPLE_OMP_SCAN>: Set ctx->scan_inclusive if inclusive scan. (struct omplow_simd_context): Add lastlane member. (lower_rec_simd_input_clauses): Add rvar argument, handle inscan reductions. Build 2 or 3 argument .GOMP_SIMD_LANE calls rather than 1 or 2 argument. (lower_rec_input_clauses): Handle inscan reductions in simd contexts. (lower_lastprivate_clauses): Set TREE_THIS_NOTRAP on the ARRAY_REF. (lower_omp_scan): New function. (lower_omp_1) <case GIMPLE_OMP_SCAN>: Use lower_omp_scan. * tree-ssa-dce.c (eliminate_unnecessary_stmts): For IFN_GOMP_SIMD_LANE check 3rd argument if present rather than 2nd. * tree-vectorizer.h (struct _loop_vec_info): Add scan_map member. (struct _stmt_vec_info): Change simd_lane_access_p from bool into 2-bit bitfield. * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Initialize scan_map. For IFN_GOMP_SIMD_LANE check 3rd argument if present rather than 2nd. (_loop_vec_info::~_loop_vec_info): Delete scan_map. * tree-vect-data-refs.c (vect_analyze_data_ref_accesses): Allow two different STMT_VINFO_SIMD_LANE_ACCESS_P refs if they have the same init. (vect_find_stmt_data_reference): Encode in ->aux the 2nd IFN_GOMP_SIMD_LANE argument. (vect_analyze_data_refs): Set STMT_VINFO_SIMD_LANE_ACCESS_P from the encoded ->aux value. * tree-vect-stmts.c: Include attribs.h. (vectorizable_call): Adjust comment about IFN_GOMP_SIMD_LANE. (scan_operand_equal_p, check_scan_store, vectorizable_scan_store): New functions. (vectorizable_load): For STMT_VINFO_SIMD_LANE_ACCESS_P tests use != 0. (vectorizable_store): Handle STMT_VINFO_SIMD_LANE_ACCESS_P > 1. cp/ * semantics.c (finish_omp_clauses): For OMP_CLAUSE_REDUCTION_INSCAN set need_copy_assignment. testsuite/ * gcc.dg/vect/vect-simd-8.c: New test. * gcc.dg/vect/vect-simd-9.c: New test. * g++.dg/vect/simd-2.cc: New test. * g++.dg/gomp/scan-1.C: New test. From-SVN: r272399
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r--gcc/tree-vect-data-refs.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 55d87f8..f2f0d23 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -3003,6 +3003,13 @@ vect_analyze_data_ref_accesses (vec_info *vinfo)
|| TREE_CODE (DR_INIT (drb)) != INTEGER_CST)
break;
+ /* Different .GOMP_SIMD_LANE calls still give the same lane,
+ just hold extra information. */
+ if (STMT_VINFO_SIMD_LANE_ACCESS_P (stmtinfo_a)
+ && STMT_VINFO_SIMD_LANE_ACCESS_P (stmtinfo_b)
+ && data_ref_compare_tree (DR_INIT (dra), DR_INIT (drb)) == 0)
+ break;
+
/* Sorting has ensured that DR_INIT (dra) <= DR_INIT (drb). */
HOST_WIDE_INT init_a = TREE_INT_CST_LOW (DR_INIT (dra));
HOST_WIDE_INT init_b = TREE_INT_CST_LOW (DR_INIT (drb));
@@ -4101,7 +4108,8 @@ vect_find_stmt_data_reference (loop_p loop, gimple *stmt,
DR_STEP_ALIGNMENT (newdr)
= highest_pow2_factor (step);
/* Mark as simd-lane access. */
- newdr->aux = (void *)-1;
+ tree arg2 = gimple_call_arg (def, 1);
+ newdr->aux = (void *) (-1 - tree_to_uhwi (arg2));
free_data_ref (dr);
datarefs->safe_push (newdr);
return opt_result::success ();
@@ -4210,14 +4218,17 @@ vect_analyze_data_refs (vec_info *vinfo, poly_uint64 *min_vf)
}
/* See if this was detected as SIMD lane access. */
- if (dr->aux == (void *)-1)
+ if (dr->aux == (void *)-1
+ || dr->aux == (void *)-2
+ || dr->aux == (void *)-3)
{
if (nested_in_vect_loop_p (loop, stmt_info))
return opt_result::failure_at (stmt_info->stmt,
"not vectorized:"
" data ref analysis failed: %G",
stmt_info->stmt);
- STMT_VINFO_SIMD_LANE_ACCESS_P (stmt_info) = true;
+ STMT_VINFO_SIMD_LANE_ACCESS_P (stmt_info)
+ = -(uintptr_t) dr->aux;
}
tree base = get_base_address (DR_REF (dr));