public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] target/109955 - handle pattern generated COND_EXPR without vcond
@ 2023-05-25 11:00 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-05-25 11:00 UTC (permalink / raw)
  To: gcc-patches; +Cc: richard.sandiford

The following properly handles pattern matching generated COND_EXPRs
which can still have embedded compares in vectorizable_condition
which will always code generate the masked vector variant.  We
were requiring vcond with embedded comparisons instead of also
allowing (as code generated) split compare and VEC_COND_EXPR.

This fixes some of the fallout when removing vcond{,u,eq} expanders
from the x86 backend.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

	PR target/109955
	* tree-vect-stmts.cc (vectorizable_condition): For
	embedded comparisons also handle the case when the target
	only provides vec_cmp and vcond_mask.
---
 gcc/tree-vect-stmts.cc | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 127b987cd62..bd3b07a3aa1 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -10836,7 +10836,12 @@ vectorizable_condition (vec_info *vinfo,
       if (reduction_type == EXTRACT_LAST_REDUCTION)
 	/* Count one reduction-like operation per vector.  */
 	kind = vec_to_scalar;
-      else if (!expand_vec_cond_expr_p (vectype, comp_vectype, cond_code))
+      else if (!expand_vec_cond_expr_p (vectype, comp_vectype, cond_code)
+	       && (masked
+		   || (!expand_vec_cmp_expr_p (comp_vectype, vec_cmp_type,
+					       cond_code)
+		       || !expand_vec_cond_expr_p (vectype, vec_cmp_type,
+						   ERROR_MARK))))
 	return false;
 
       if (slp_node
-- 
2.35.3

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-25 11:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 11:00 [PATCH] target/109955 - handle pattern generated COND_EXPR without vcond 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).