* [PATCH] Fix PR85934
@ 2018-05-28 16:18 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2018-05-28 16:18 UTC (permalink / raw)
To: gcc-patches
Bootstraped and tested on x86_64-unknown-linux-gnu, applied.
Richard.
From f21624d5d1b9bb6b65f499f5af34781acfa6c927 Mon Sep 17 00:00:00 2001
From: Richard Guenther <rguenther@suse.de>
Date: Mon, 28 May 2018 09:41:39 +0200
Subject: [PATCH] fix-pr85934
PR tree-optimization/85934
* tree-vect-generic.c (expand_vector_operations_1): Hoist
vector boolean check before scalar optimization.
* gcc.target/i386/pr85934.c: New testcase.
diff --git a/gcc/testsuite/gcc.target/i386/pr85934.c b/gcc/testsuite/gcc.target/i386/pr85934.c
new file mode 100644
index 00000000000..ac10cfb9d8f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr85934.c
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+/* { dg-options "-O -ftree-loop-vectorize -mavx512vbmi" } */
+
+int uf;
+
+int
+l7 (int wk, int sv)
+{
+ while (sv < 1)
+ {
+ int me;
+
+ for (me = 0; me < 64; ++me)
+ wk += !!((unsigned char) sv) && (!!uf == !!me);
+
+ ++sv;
+ }
+
+ return wk;
+}
diff --git a/gcc/tree-vect-generic.c b/gcc/tree-vect-generic.c
index 3dcbdeba959..2ade60b3398 100644
--- a/gcc/tree-vect-generic.c
+++ b/gcc/tree-vect-generic.c
@@ -1612,6 +1612,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
if (!VECTOR_TYPE_P (type)
|| !VECTOR_TYPE_P (TREE_TYPE (rhs1)))
return;
+
+ /* A scalar operation pretending to be a vector one. */
+ if (VECTOR_BOOLEAN_TYPE_P (type)
+ && !VECTOR_MODE_P (TYPE_MODE (type))
+ && TYPE_MODE (type) != BLKmode)
+ return;
/* If the vector operation is operating on all same vector elements
implement it with a scalar operation and a splat if the target
@@ -1638,12 +1644,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
return;
}
}
-
- /* A scalar operation pretending to be a vector one. */
- if (VECTOR_BOOLEAN_TYPE_P (type)
- && !VECTOR_MODE_P (TYPE_MODE (type))
- && TYPE_MODE (type) != BLKmode)
- return;
if (CONVERT_EXPR_CODE_P (code)
|| code == FLOAT_EXPR
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-28 16:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-28 16:18 [PATCH] Fix PR85934 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).