summaryrefslogtreecommitdiff
path: root/gcc/omp-expand.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@linaro.org>2018-01-03 07:14:31 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-01-03 07:14:31 +0000
commit9d2f08ab97bea3c299cce96a0760904501e002dd (patch)
treee47f22b11c033a18b86e50ce91d45d804751f54e /gcc/omp-expand.c
parentc5126ce8cae4f14194414e266be91fdc4b756807 (diff)
poly_int: omp_max_vf
This patch makes omp_max_vf return a polynomial vectorization factor. We then need to be able to stash a polynomial value in OMP_CLAUSE_SAFELEN_EXPR too: /* If max_vf is non-zero, then we can use only a vectorization factor up to the max_vf we chose. So stick it into the safelen clause. */ For now the cfgloop safelen is still constant though. 2018-01-03 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * omp-general.h (omp_max_vf): Return a poly_uint64 instead of an int. * omp-general.c (omp_max_vf): Likewise. * omp-expand.c (omp_adjust_chunk_size): Update call to omp_max_vf. (expand_omp_simd): Handle polynomial safelen. * omp-low.c (omplow_simd_context): Add a default constructor. (omplow_simd_context::max_vf): Change from int to poly_uint64. (lower_rec_simd_input_clauses): Update accordingly. (lower_rec_input_clauses): Likewise. Co-Authored-By: Alan Hayward <alan.hayward@arm.com> Co-Authored-By: David Sherwood <david.sherwood@arm.com> From-SVN: r256129
Diffstat (limited to 'gcc/omp-expand.c')
-rw-r--r--gcc/omp-expand.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c
index 663711b3aa4..aa580e2051f 100644
--- a/gcc/omp-expand.c
+++ b/gcc/omp-expand.c
@@ -205,8 +205,8 @@ omp_adjust_chunk_size (tree chunk_size, bool simd_schedule)
if (!simd_schedule)
return chunk_size;
- int vf = omp_max_vf ();
- if (vf == 1)
+ poly_uint64 vf = omp_max_vf ();
+ if (known_eq (vf, 1U))
return chunk_size;
tree type = TREE_TYPE (chunk_size);
@@ -4368,11 +4368,12 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
if (safelen)
{
+ poly_uint64 val;
safelen = OMP_CLAUSE_SAFELEN_EXPR (safelen);
- if (TREE_CODE (safelen) != INTEGER_CST)
+ if (!poly_int_tree_p (safelen, &val))
safelen_int = 0;
- else if (tree_fits_uhwi_p (safelen) && tree_to_uhwi (safelen) < INT_MAX)
- safelen_int = tree_to_uhwi (safelen);
+ else
+ safelen_int = MIN (constant_lower_bound (val), INT_MAX);
if (safelen_int == 1)
safelen_int = 0;
}