diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2018-02-08 15:17:20 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-02-08 15:17:20 +0000 |
commit | b5ec4de777870e2d4ff2a5de604eafd1bf0e50df (patch) | |
tree | 7d1c4f72e10b0597eae8549d8a317239cd7adf16 | |
parent | fff2290073cc2d57dcade125227b74cd27c48066 (diff) | |
download | gcc-b5ec4de777870e2d4ff2a5de604eafd1bf0e50df.zip gcc-b5ec4de777870e2d4ff2a5de604eafd1bf0e50df.tar.gz gcc-b5ec4de777870e2d4ff2a5de604eafd1bf0e50df.tar.bz2 |
Another fix for single-element permutes (PR 84265)
PR83753 was about a case in which we ended up trying to "vectorise"
a group of loads ore stores using single-element vectors. The problem
was that we were classifying the load or store as VMAT_CONTIGUOUS_PERMUTE
rather than VMAT_CONTIGUOUS, even though it doesn't make sense to permute
a single-element vector.
In that PR it was enough to change get_group_load_store_type,
because vectorisation ended up being unprofitable and so we didn't
take things further. But when vectorisation is profitable, the same
fix is needed in vectorizable_load and vectorizable_store.
2018-02-08 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/84265
* tree-vect-stmts.c (vectorizable_store): Don't treat
VMAT_CONTIGUOUS accesses as grouped.
(vectorizable_load): Likewise.
gcc/testsuite/
PR tree-optimization/84265
* gcc.dg/vect/pr84265.c: New test.
From-SVN: r257492
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/vect/pr84265.c | 23 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.c | 6 |
4 files changed, 39 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e8b232..d9c45c9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2018-02-08 Richard Sandiford <richard.sandiford@linaro.org> + PR tree-optimization/84265 + * tree-vect-stmts.c (vectorizable_store): Don't treat + VMAT_CONTIGUOUS accesses as grouped. + (vectorizable_load): Likewise. + +2018-02-08 Richard Sandiford <richard.sandiford@linaro.org> + PR tree-optimization/81635 * wide-int.h (wi::round_down_for_mask, wi::round_up_for_mask): Declare. * wide-int.cc (wi::round_down_for_mask, wi::round_up_for_mask) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 52cf0b5..e989c94 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2018-02-08 Richard Sandiford <richard.sandiford@linaro.org> + PR tree-optimization/84265 + * gcc.dg/vect/pr84265.c: New test. + +2018-02-08 Richard Sandiford <richard.sandiford@linaro.org> + PR tree-optimization/81635 * gcc.dg/vect/bb-slp-pr81635-3.c: New test. * gcc.dg/vect/bb-slp-pr81635-4.c: Likewise. diff --git a/gcc/testsuite/gcc.dg/vect/pr84265.c b/gcc/testsuite/gcc.dg/vect/pr84265.c new file mode 100644 index 0000000..59984ae --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr84265.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ + +struct a +{ + unsigned long b; + unsigned long c; + int d; + int *e; + char f; +}; + +struct +{ + int g; + struct a h[]; +} i; + +int j, k; +void l () +{ + for (; k; k++) + j += (int) (i.h[k].c - i.h[k].b); +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index c5085ca..6066a52 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -6214,7 +6214,8 @@ vectorizable_store (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt, } grouped_store = (STMT_VINFO_GROUPED_ACCESS (stmt_info) - && memory_access_type != VMAT_GATHER_SCATTER); + && memory_access_type != VMAT_GATHER_SCATTER + && (slp || memory_access_type != VMAT_CONTIGUOUS)); if (grouped_store) { first_stmt = GROUP_FIRST_ELEMENT (stmt_info); @@ -7708,7 +7709,8 @@ vectorizable_load (gimple *stmt, gimple_stmt_iterator *gsi, gimple **vec_stmt, return true; } - if (memory_access_type == VMAT_GATHER_SCATTER) + if (memory_access_type == VMAT_GATHER_SCATTER + || (!slp && memory_access_type == VMAT_CONTIGUOUS)) grouped_load = false; if (grouped_load) |