* [PATCH] tree-optimization/109735 - conversion for vectorized pointer-diff
@ 2023-05-05 12:18 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-05-05 12:18 UTC (permalink / raw)
To: gcc-patches
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.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/109735
* tree-vect-stmts.cc (vectorizable_operation): Perform
conversion for POINTER_DIFF_EXPR unconditionally.
---
gcc/tree-vect-stmts.cc | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index cf5194ea444..61a2da4ecee 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
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-05 12:18 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-05 12:18 [PATCH] tree-optimization/109735 - conversion for vectorized pointer-diff Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).