aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-29 13:04:56 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2019-11-29 13:04:56 +0000
commit3edaed39583aeb49cfda7093ed4c0f9fed3fbea0 (patch)
treee2a753ac0800cdc6722db8b3154fe7f9779f1e3f
parent337b04a4464eb2638c51e3608aa68511357a8189 (diff)
downloadgcc-3edaed39583aeb49cfda7093ed4c0f9fed3fbea0.zip
gcc-3edaed39583aeb49cfda7093ed4c0f9fed3fbea0.tar.gz
gcc-3edaed39583aeb49cfda7093ed4c0f9fed3fbea0.tar.bz2
Don't pass booleans as mask types to simd clones (PR 92710)
In this PR we assigned a vector mask type to the result of a comparison and then tried to pass that mask type to a simd clone, which expected a normal (non-mask) type instead. This patch simply punts on call arguments that have a mask type. A better fix would be to pattern-match the comparison to a COND_EXPR, like we would if the comparison was stored to memory, but doing that isn't gcc 9 or 10 material. Note that this doesn't affect x86_64-linux-gnu because the ABI promotes bool arguments to ints. 2019-11-29 Richard Sandiford <richard.sandiford@arm.com> gcc/ PR tree-optimization/92710 * tree-vect-stmts.c (vectorizable_simd_clone_call): Reject vector mask arguments. gcc/testsuite/ PR tree-optimization/92710 * gcc.dg/vect/pr92710.c: New test. From-SVN: r278839
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/vect/pr92710.c12
-rw-r--r--gcc/tree-vect-stmts.c11
4 files changed, 33 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9e0340c..c2d2792 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/92710
+ * tree-vect-stmts.c (vectorizable_simd_clone_call): Reject
+ vector mask arguments.
+
2019-11-29 Jan Hubicka <hubicka@ucw.cz>
* profile-count.c (profile_count::to_cgraph_frequency,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 81cd8e3..aa3a347 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
+
+ PR tree-optimization/92710
+ * gcc.dg/vect/pr92710.c: New test.
+
2019-11-29 Tobias Burnus <tobias@codesourcery.com>
PR ipa/84963
diff --git a/gcc/testsuite/gcc.dg/vect/pr92710.c b/gcc/testsuite/gcc.dg/vect/pr92710.c
new file mode 100644
index 0000000..2986d4c
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/pr92710.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-fopenmp-simd" } */
+
+#pragma omp declare simd
+_Bool foo (_Bool) __attribute__((const));
+
+void
+f (_Bool *restrict x, char *restrict y, char *restrict z)
+{
+ for (int i = 0; i < 128; ++i)
+ x[i] = foo (y[i] == z[i]);
+}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 426ae2c..d5f8031 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -3925,7 +3925,16 @@ vectorizable_simd_clone_call (stmt_vec_info stmt_info,
|| thisarginfo.dt == vect_external_def)
gcc_assert (thisarginfo.vectype == NULL_TREE);
else
- gcc_assert (thisarginfo.vectype != NULL_TREE);
+ {
+ gcc_assert (thisarginfo.vectype != NULL_TREE);
+ if (VECTOR_BOOLEAN_TYPE_P (thisarginfo.vectype))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "vector mask arguments are not supported\n");
+ return false;
+ }
+ }
/* For linear arguments, the analyze phase should have saved
the base and step in STMT_VINFO_SIMD_CLONE_INFO. */