aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-stmts.c
diff options
context:
space:
mode:
authory00520163 <yangyang305@huawei.com>2020-07-20 19:47:05 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2020-07-20 19:47:05 +0100
commit138b1d4f58af17986e856e665ffbd561c2c8740e (patch)
tree0498640b64f28e685723a382d55b9c30ab573f3b /gcc/tree-vect-stmts.c
parent3c5e83d5b32c31b11cf1684bf5d1ab3e7174685c (diff)
downloadgcc-138b1d4f58af17986e856e665ffbd561c2c8740e.zip
gcc-138b1d4f58af17986e856e665ffbd561c2c8740e.tar.gz
gcc-138b1d4f58af17986e856e665ffbd561c2c8740e.tar.bz2
vect: Fix an ICE in vectorizable_simd_clone_call
In vectorizable_simd_clone_call, type compatibility is handled based on the number of elements and the type compatibility of elements, which is not enough. This patch add VIEW_CONVERT_EXPRs if the arguments types and return type of simd clone function are distinct with the vectype of stmt. 2020-07-20 Yang Yang <yangyang305@huawei.com> gcc/ChangeLog: * tree-vect-stmts.c (vectorizable_simd_clone_call): Add VIEW_CONVERT_EXPRs if the arguments types and return type of simd clone function are distinct with the vectype of stmt. gcc/testsuite/ChangeLog: * gcc.target/aarch64/sve/pr96195.c: New test.
Diffstat (limited to 'gcc/tree-vect-stmts.c')
-rw-r--r--gcc/tree-vect-stmts.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 31af46a..7870b97 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -4137,7 +4137,20 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
vec_oprnd0);
}
if (k == 1)
- vargs.safe_push (vec_oprnd0);
+ if (!useless_type_conversion_p (TREE_TYPE (vec_oprnd0),
+ atype))
+ {
+ vec_oprnd0
+ = build1 (VIEW_CONVERT_EXPR, atype, vec_oprnd0);
+ gassign *new_stmt
+ = gimple_build_assign (make_ssa_name (atype),
+ vec_oprnd0);
+ vect_finish_stmt_generation (vinfo, stmt_info,
+ new_stmt, gsi);
+ vargs.safe_push (gimple_assign_lhs (new_stmt));
+ }
+ else
+ vargs.safe_push (vec_oprnd0);
else
{
vec_oprnd0 = build_constructor (atype, ctor_elts);
@@ -4233,8 +4246,7 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
gcc_assert (ratype || simd_clone_subparts (rtype) == nunits);
if (ratype)
new_temp = create_tmp_var (ratype);
- else if (simd_clone_subparts (vectype)
- == simd_clone_subparts (rtype))
+ else if (useless_type_conversion_p (vectype, rtype))
new_temp = make_ssa_name (vec_dest, new_call);
else
new_temp = make_ssa_name (rtype, new_call);
@@ -4322,6 +4334,13 @@ vectorizable_simd_clone_call (vec_info *vinfo, stmt_vec_info stmt_info,
vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi);
vect_clobber_variable (vinfo, stmt_info, gsi, new_temp);
}
+ else if (!useless_type_conversion_p (vectype, rtype))
+ {
+ vec_oprnd0 = build1 (VIEW_CONVERT_EXPR, vectype, new_temp);
+ new_stmt
+ = gimple_build_assign (make_ssa_name (vec_dest), vec_oprnd0);
+ vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi);
+ }
}
if (j == 0)