aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2020-01-09 20:31:31 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2020-01-15 13:35:51 +0000
commit86c3a7d891f9f175d09d61f5ce163c6dc5ce681f (patch)
tree48ffe61e9634d24fcde6ee1bdf2d8423d2f431af /gcc
parentaffb7b66aa6e08aa19ccec2cc24d166a37d4a556 (diff)
downloadgcc-86c3a7d891f9f175d09d61f5ce163c6dc5ce681f.zip
gcc-86c3a7d891f9f175d09d61f5ce163c6dc5ce681f.tar.gz
gcc-86c3a7d891f9f175d09d61f5ce163c6dc5ce681f.tar.bz2
Fix type mismatch in SLPed constructors
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. 2020-01-15 Richard Sandiford <richard.sandiford@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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/tree-vect-slp.c4
2 files changed, 10 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index a9dc514..aa161fd 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2020-01-15 Richard Sandiford <richard.sandiford@arm.com>
+
+ * 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.
+
2020-01-15 Martin Liska <mliska@suse.cz>
* ipa-profile.c (ipa_profile_read_edge_summary): Do not allow
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index d164937..cebaa81 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4307,6 +4307,10 @@ vectorize_slp_instance_root_stmt (slp_tree node, slp_instance instance)
{
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;
}