* [PATCH] tree-optimization/105132 - add missing checking in vectorizable_operation
@ 2022-04-04 9:34 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-04-04 9:34 UTC (permalink / raw)
To: gcc-patches
The following adds missing verification that the input vectors
have the same number of elements for vectorizable_operation.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
2022-04-04 Richard Biener <rguenther@suse.de>
PR tree-optimization/105132
* tree-vect-stmts.cc (vectorizable_operation): Check that
the input vectors have the same number of elements.
* gcc.dg/torture/pr105132.c: New testcase.
---
gcc/testsuite/gcc.dg/torture/pr105132.c | 12 ++++++++++++
gcc/tree-vect-stmts.cc | 6 ++++++
2 files changed, 18 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/torture/pr105132.c
diff --git a/gcc/testsuite/gcc.dg/torture/pr105132.c b/gcc/testsuite/gcc.dg/torture/pr105132.c
new file mode 100644
index 00000000000..f8f0b16ec56
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr105132.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-march=skylake-avx512" { target x86_64-*-* i?86-*-* } } */
+
+short a;
+extern int b[];
+int c;
+void d(long f[][5][5][17], int g[][5][5][17]) {
+ for (short e = 0; e < 17; e++) {
+ a = g[19][2][3][e];
+ b[e] = c & (f[3][2][3][e] && g[19][2][3][e]);
+ }
+}
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index f7449a79d1c..f6fc7e1fcdd 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -6133,6 +6133,9 @@ vectorizable_operation (vec_info *vinfo,
"use not simple.\n");
return false;
}
+ if (vectype2
+ && maybe_ne (nunits_out, TYPE_VECTOR_SUBPARTS (vectype2)))
+ return false;
}
if (op_type == ternary_op)
{
@@ -6144,6 +6147,9 @@ vectorizable_operation (vec_info *vinfo,
"use not simple.\n");
return false;
}
+ if (vectype3
+ && maybe_ne (nunits_out, TYPE_VECTOR_SUBPARTS (vectype3)))
+ return false;
}
/* Multiple types in SLP are handled by creating the appropriate number of
--
2.34.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-04-04 9:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 9:34 [PATCH] tree-optimization/105132 - add missing checking in vectorizable_operation 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).