From fed2a43c018366566c3b5b73269f863444b06163 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 15 May 2019 23:42:46 +0200 Subject: omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set max_vf to 1. * omp-low.c (lower_rec_input_clauses): For if (0) or simdlen (1) set max_vf to 1. * omp-expand.c (expand_omp_simd): For if (0) or simdlen (1) clear safelen_int and set loop->dont_vectorize. * c-c++-common/gomp/simd8.c: New test. From-SVN: r271270 --- gcc/omp-expand.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gcc/omp-expand.c') diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 89a3a323267..74159734fc8 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -4664,10 +4664,15 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) tree *counts = NULL; int i; int safelen_int = INT_MAX; + bool dont_vectorize = false; tree safelen = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), OMP_CLAUSE_SAFELEN); tree simduid = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), OMP_CLAUSE__SIMDUID_); + tree ifc = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), + OMP_CLAUSE_IF); + tree simdlen = omp_find_clause (gimple_omp_for_clauses (fd->for_stmt), + OMP_CLAUSE_SIMDLEN); tree n1, n2; if (safelen) @@ -4681,6 +4686,12 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) if (safelen_int == 1) safelen_int = 0; } + if ((ifc && integer_zerop (OMP_CLAUSE_IF_EXPR (ifc))) + || (simdlen && integer_onep (OMP_CLAUSE_SIMDLEN_EXPR (simdlen)))) + { + safelen_int = 0; + dont_vectorize = true; + } type = TREE_TYPE (fd->loop.v); entry_bb = region->entry; cont_bb = region->cont; @@ -4965,6 +4976,8 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) loop->force_vectorize = true; cfun->has_force_vectorize_loops = true; } + else if (dont_vectorize) + loop->dont_vectorize = true; } else if (simduid) cfun->has_simduid_loops = true; -- cgit v1.2.3