diff options
author | Richard Biener <rguenther@suse.de> | 2021-01-05 16:17:15 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2021-01-05 17:40:51 +0100 |
commit | 33a63257701c8d94ee375e32ff1837c989d8ded6 (patch) | |
tree | 7bcc6ecd57ee6bbee583ae126b0892fd66ade9af /gcc/tree-vect-slp.c | |
parent | 606f2af1973d5c83877d327cb5adef97c4243a73 (diff) | |
download | gcc-33a63257701c8d94ee375e32ff1837c989d8ded6.zip gcc-33a63257701c8d94ee375e32ff1837c989d8ded6.tar.gz gcc-33a63257701c8d94ee375e32ff1837c989d8ded6.tar.bz2 |
tree-optimization/98516 - fix SLP permute opt materialization
When materializing on a VEC_PERM node we have to permute the
incoming vectors, not the outgoing one.
2021-01-05 Richard Biener <rguenther@suse.de>
PR tree-optimization/98516
* tree-vect-slp.c (vect_optimize_slp): Permute the incoming
lanes when materializing on a VEC_PERM node.
(vectorizable_slp_permutation): Dump the permute properly.
* gcc.dg/vect/bb-slp-pr98516-1.c: New testcase.
* gcc.dg/vect/bb-slp-pr98516-2.c: Likewise.
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r-- | gcc/tree-vect-slp.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 49cb635..c9da845 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -3094,15 +3094,18 @@ vect_optimize_slp (vec_info *vinfo) ; else if (SLP_TREE_LANE_PERMUTATION (node).exists ()) { - /* If the node if already a permute node we just need to apply - the permutation to the permute node itself. */ + /* If the node is already a permute node we can apply + the permutation to the lane selection, effectively + materializing it on the incoming vectors. */ if (dump_enabled_p ()) dump_printf_loc (MSG_NOTE, vect_location, "simplifying permute node %p\n", node); - vect_slp_permute (perms[perm], SLP_TREE_LANE_PERMUTATION (node), - true); + for (unsigned k = 0; + k < SLP_TREE_LANE_PERMUTATION (node).length (); ++k) + SLP_TREE_LANE_PERMUTATION (node)[k].second + = perms[perm][SLP_TREE_LANE_PERMUTATION (node)[k].second]; } else { @@ -5554,7 +5557,7 @@ vectorizable_slp_permutation (vec_info *vinfo, gimple_stmt_iterator *gsi, dump_printf (MSG_NOTE, ","); dump_printf (MSG_NOTE, " vops%u[%u][%u]", vperm[i].first.first, vperm[i].first.second, - vperm[i].first.second); + vperm[i].second); } dump_printf (MSG_NOTE, "\n"); } |