public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/marxin/heads/PR93274-make-resolver-static-v2)] i386: Fix up *avx_vperm_broadcast_v4df [PR93430]
@ 2020-01-27 10:16 Martin Liska
  0 siblings, 0 replies; only message in thread
From: Martin Liska @ 2020-01-27 10:16 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:322db86f4b4df1261308e8a02e69018d9cea98e9

commit 322db86f4b4df1261308e8a02e69018d9cea98e9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sun Jan 26 12:10:48 2020 +0100

    i386: Fix up *avx_vperm_broadcast_v4df [PR93430]
    
    Apparently my recent patch which moved the *avx_vperm_broadcast* and
    *vpermil* patterns before vpermpd broke the following testcase, the
    define_insn_and_split matched always but the splitter condition only split
    it if not -mavx2 for V4DFmode, basically relying on the vpermpd pattern to
    come first.
    
    The following patch fixes it by moving that part of SPLIT-CONDITION into
    CONDITION, so that when it is not met, we just don't match the pattern
    and thus match the later vpermpd pattern in that case.
    Except, for { 0, 0, 0, 0 } permutation, there is actually no reason to do
    that, vbroadcastsd from memory seems to be slightly cheaper than vpermpd $0.
    
    2020-01-26  Jakub Jelinek  <jakub@redhat.com>
    
    	PR target/93430
    	* config/i386/sse.md (*avx_vperm_broadcast_<mode>): Disallow for
    	TARGET_AVX2 and V4DFmode not in the split condition, but in the
    	pattern condition, though allow { 0, 0, 0, 0 } broadcast always.
    
    	* gcc.dg/pr93430.c: New test.
    	* gcc.target/i386/avx2-pr93430.c: New test.

Diff:
---
 gcc/ChangeLog                                |  7 ++++++
 gcc/config/i386/sse.md                       |  5 +++--
 gcc/testsuite/ChangeLog                      |  4 ++++
 gcc/testsuite/gcc.dg/pr93430.c               | 33 ++++++++++++++++++++++++++++
 gcc/testsuite/gcc.target/i386/avx2-pr93430.c |  5 +++++
 5 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e35efd6..db62a7a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2020-01-26  Jakub Jelinek  <jakub@redhat.com>
+
+	PR target/93430
+	* config/i386/sse.md (*avx_vperm_broadcast_<mode>): Disallow for
+	TARGET_AVX2 and V4DFmode not in the split condition, but in the
+	pattern condition, though allow { 0, 0, 0, 0 } broadcast always.
+
 2020-01-25  Feng Xue  <fxue@os.amperecomputing.com>
 
 	PR ipa/93166
diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md
index f2f4a4e..04a8c5e 100644
--- a/gcc/config/i386/sse.md
+++ b/gcc/config/i386/sse.md
@@ -19912,9 +19912,10 @@
 	  (match_operand:VF_256 1 "nonimmediate_operand" "m,o,?v")
 	  (match_parallel 2 "avx_vbroadcast_operand"
 	    [(match_operand 3 "const_int_operand" "C,n,n")])))]
-  "TARGET_AVX"
+  "TARGET_AVX
+   && (<MODE>mode != V4DFmode || !TARGET_AVX2 || operands[3] == const0_rtx)"
   "#"
-  "&& reload_completed && (<MODE>mode != V4DFmode || !TARGET_AVX2)"
+  "&& reload_completed"
   [(set (match_dup 0) (vec_duplicate:VF_256 (match_dup 1)))]
 {
   rtx op0 = operands[0], op1 = operands[1];
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 99da3cc..860d56d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
 2020-01-26  Jakub Jelinek  <jakub@redhat.com>
 
+	PR target/93430
+	* gcc.dg/pr93430.c: New test.
+	* gcc.target/i386/avx2-pr93430.c: New test.
+
 	PR ipa/93166
 	* g++.dg/pr93166.C: Move to ...
 	* g++.dg/pr93166_0.C: ... here.  Turn it into a proper lto test.
diff --git a/gcc/testsuite/gcc.dg/pr93430.c b/gcc/testsuite/gcc.dg/pr93430.c
new file mode 100644
index 0000000..92c0b9f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr93430.c
@@ -0,0 +1,33 @@
+/* PR target/93430 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mavx -mno-avx2" { target avx } } */
+
+typedef double V __attribute__((vector_size (4 * sizeof (double))));
+typedef long long VI __attribute__((vector_size (4 * sizeof (long long))));
+
+#if __SIZEOF_DOUBLE__ == __SIZEOF_LONG_LONG__
+void
+foo (V *x, V *y)
+{
+  y[0] = __builtin_shuffle (x[0], x[0], (VI) { 0, 0, 0, 0 });
+}
+
+void
+bar (V *x, V *y)
+{
+  y[0] = __builtin_shuffle (x[0], x[0], (VI) { 1, 1, 1, 1 });
+}
+
+void
+baz (V *x, V *y)
+{
+  y[0] = __builtin_shuffle (x[0], x[0], (VI) { 2, 2, 2, 2 });
+}
+
+void
+qux (V *x, V *y)
+{
+  y[0] = __builtin_shuffle (x[0], x[0], (VI) { 3, 3, 3, 3 });
+}
+#endif
diff --git a/gcc/testsuite/gcc.target/i386/avx2-pr93430.c b/gcc/testsuite/gcc.target/i386/avx2-pr93430.c
new file mode 100644
index 0000000..d7c1a51
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/avx2-pr93430.c
@@ -0,0 +1,5 @@
+/* PR target/93430 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx2" } */
+
+#include "../../gcc.dg/pr93430.c"


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

only message in thread, other threads:[~2020-01-27 10:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-27 10:16 [gcc(refs/users/marxin/heads/PR93274-make-resolver-static-v2)] i386: Fix up *avx_vperm_broadcast_v4df [PR93430] Martin Liska

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).