diff options
author | Richard Biener <rguenther@suse.de> | 2023-05-05 08:54:28 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-05-05 14:19:04 +0200 |
commit | 37b5f031292fbdb854ee791de3883362cf2afcff (patch) | |
tree | c72d6a3fe5a9ca1fc8bf1148772f3e0d7a4599e0 | |
parent | 919642fa4b2bc4c32910336dd200d53766801c80 (diff) | |
download | gcc-37b5f031292fbdb854ee791de3883362cf2afcff.zip gcc-37b5f031292fbdb854ee791de3883362cf2afcff.tar.gz gcc-37b5f031292fbdb854ee791de3883362cf2afcff.tar.bz2 |
tree-optimization/109735 - conversion for vectorized pointer-diff
There's handling in vectorizable_operation for POINTER_DIFF_EXPR
requiring conversion of the result of the unsigned operation to
a signed type. But that's conditional on the "default" kind of
vectorization. In this PR it's shown the emulated vector path
needs it and I think the masked operation case will, too (though
we might eventually never mask an integral MINUS_EXPR). So the
following makes that handling unconditional.
PR tree-optimization/109735
* tree-vect-stmts.cc (vectorizable_operation): Perform
conversion for POINTER_DIFF_EXPR unconditionally.
-rw-r--r-- | gcc/tree-vect-stmts.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index cf5194e..61a2da4 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -6657,8 +6657,8 @@ vectorizable_operation (vec_info *vinfo, new_stmt = gimple_build_assign (NULL_TREE, VIEW_CONVERT_EXPR, build1 (VIEW_CONVERT_EXPR, vectype, result_low)); - result_low = make_ssa_name (vectype); - gimple_assign_set_lhs (new_stmt, result_low); + new_temp = make_ssa_name (vectype); + gimple_assign_set_lhs (new_stmt, new_temp); vect_finish_stmt_generation (vinfo, stmt_info, new_stmt, gsi); } else if (masked_loop_p && mask_out_inactive) @@ -6734,18 +6734,19 @@ vectorizable_operation (vec_info *vinfo, AND it with a loop mask again. */ if (mask) loop_vinfo->vec_cond_masked_set.add ({ new_temp, mask }); + } - if (vec_cvt_dest) - { - new_temp = build1 (VIEW_CONVERT_EXPR, vectype_out, new_temp); - new_stmt = gimple_build_assign (vec_cvt_dest, VIEW_CONVERT_EXPR, - new_temp); - new_temp = make_ssa_name (vec_cvt_dest, new_stmt); - gimple_assign_set_lhs (new_stmt, new_temp); - vect_finish_stmt_generation (vinfo, stmt_info, - new_stmt, gsi); - } + if (vec_cvt_dest) + { + new_temp = build1 (VIEW_CONVERT_EXPR, vectype_out, new_temp); + new_stmt = gimple_build_assign (vec_cvt_dest, VIEW_CONVERT_EXPR, + new_temp); + new_temp = make_ssa_name (vec_cvt_dest, new_stmt); + gimple_assign_set_lhs (new_stmt, new_temp); + vect_finish_stmt_generation (vinfo, stmt_info, + new_stmt, gsi); } + if (slp_node) SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt); else |