* [PATCH] tree-optimization/109502 - vector conversion between mask and non-mask
@ 2023-04-14 9:45 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-04-14 9:45 UTC (permalink / raw)
To: gcc-patches
The following fixes a check that should have rejected vectorizing
a conversion between a mask and non-mask type. Those should be
done via pattern statements.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
PR tree-optimization/109502
* tree-vect-stmts.cc (vectorizable_assignment): Fix
check for conversion between mask and non-mask types.
* gcc.dg/vect/pr109502.c: New testcase.
---
gcc/testsuite/gcc.dg/vect/pr109502.c | 21 +++++++++++++++++++++
gcc/tree-vect-stmts.cc | 3 +--
2 files changed, 22 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/vect/pr109502.c
diff --git a/gcc/testsuite/gcc.dg/vect/pr109502.c b/gcc/testsuite/gcc.dg/vect/pr109502.c
new file mode 100644
index 00000000000..970c63e931b
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr109502.c
@@ -0,0 +1,21 @@
+/* { dg-do run } */
+/* { dg-additional-options "-O" } */
+
+unsigned g;
+
+unsigned
+foo (void)
+{
+ unsigned a = !g;
+ a += !(a % 6);
+ return a;
+}
+
+int
+main ()
+{
+ unsigned x = foo ();
+ if (x != 1)
+ __builtin_abort ();
+ return 0;
+}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index efa2d0daa52..6b7dbfd4a23 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -5595,8 +5595,7 @@ vectorizable_assignment (vec_info *vinfo,
GET_MODE_SIZE (TYPE_MODE (vectype_in)))))
return false;
- if (VECTOR_BOOLEAN_TYPE_P (vectype)
- && !VECTOR_BOOLEAN_TYPE_P (vectype_in))
+ if (VECTOR_BOOLEAN_TYPE_P (vectype) != VECTOR_BOOLEAN_TYPE_P (vectype_in))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
--
2.35.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-04-14 9:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 9:45 [PATCH] tree-optimization/109502 - vector conversion between mask and non-mask 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).