On Fri, Jan 10, 2020 at 4:04 PM Richard Sandiford <richard.sandif...@arm.com> wrote: > > Having the "same" vector types with different modes means that we can > end up vectorising a constructor with a different mode from the lhs. > This patch adds a VIEW_CONVERT_EXPR in that case. > > This showed up on existing tests when testing with fixed-length > -msve-vector-bits=128. > > Tested on aarch64-linux-gnu and x86_64-linux-gnu. OK to install?
OK. Richard. > Richard > > > 2020-01-10 Richard Sandiford <richard.sandif...@arm.com> > > gcc/ > * tree-vect-slp.c (vectorize_slp_instance_root_stmt): Use a > VIEW_CONVERT_EXPR if the vectorized constructor has a diffeent > type from the lhs. > > Index: gcc/tree-vect-slp.c > =================================================================== > --- gcc/tree-vect-slp.c 2020-01-06 17:59:49.126752227 +0000 > +++ gcc/tree-vect-slp.c 2020-01-10 15:01:13.780190287 +0000 > @@ -4306,6 +4306,10 @@ vectorize_slp_instance_root_stmt (slp_tr > { > tree vect_lhs = gimple_get_lhs (child_stmt_info->stmt); > tree root_lhs = gimple_get_lhs (instance->root_stmt->stmt); > + if (!useless_type_conversion_p (TREE_TYPE (root_lhs), > + TREE_TYPE (vect_lhs))) > + vect_lhs = build1 (VIEW_CONVERT_EXPR, TREE_TYPE (root_lhs), > + vect_lhs); > rstmt = gimple_build_assign (root_lhs, vect_lhs); > break; > }