Blame SOURCES/gcc7-pr84524.patch

ed1ed2
2018-02-23  Jakub Jelinek  <jakub@redhat.com>
ed1ed2
ed1ed2
	PR target/84524
ed1ed2
	* config/i386/sse.md (*<mode>3): Replace <mask_prefix3> with
ed1ed2
	orig,vex.
ed1ed2
	(*<plusminus_insn><mode>3): Likewise.  Remove <mask_operand3> uses.
ed1ed2
ed1ed2
	* gcc.c-torture/execute/pr84524.c: New test.
ed1ed2
	* gcc.target/i386/avx512bw-pr84524.c: New test.
ed1ed2
ed1ed2
--- gcc/config/i386/sse.md.jj	2018-02-13 09:31:24.769607162 +0100
ed1ed2
+++ gcc/config/i386/sse.md	2018-02-23 11:51:00.271477979 +0100
ed1ed2
@@ -9938,11 +9938,11 @@ (define_insn "*<plusminus_insn><mode>3"
ed1ed2
    && ix86_binary_operator_ok (, <MODE>mode, operands)"
ed1ed2
   "@
ed1ed2
    p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
ed1ed2
-   vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
ed1ed2
+   vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
ed1ed2
   [(set_attr "isa" "noavx,avx")
ed1ed2
    (set_attr "type" "sseiadd")
ed1ed2
    (set_attr "prefix_data16" "1,*")
ed1ed2
-   (set_attr "prefix" "<mask_prefix3>")
ed1ed2
+   (set_attr "prefix" "orig,vex")
ed1ed2
    (set_attr "mode" "<sseinsnmode>")])
ed1ed2
 
ed1ed2
 (define_insn "*<plusminus_insn><mode>3_mask"
ed1ed2
@@ -11822,7 +11822,7 @@ (define_insn "*<mode>3"
ed1ed2
 	    (eq_attr "mode" "TI"))
ed1ed2
        (const_string "1")
ed1ed2
        (const_string "*")))
ed1ed2
-   (set_attr "prefix" "<mask_prefix3>")
ed1ed2
+   (set_attr "prefix" "orig,vex")
ed1ed2
    (set (attr "mode")
ed1ed2
 	(cond [(and (match_test "<MODE_SIZE> == 16")
ed1ed2
 		    (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
ed1ed2
--- gcc/testsuite/gcc.c-torture/execute/pr84524.c.jj	2018-02-23 11:54:51.913492631 +0100
ed1ed2
+++ gcc/testsuite/gcc.c-torture/execute/pr84524.c	2018-02-23 11:59:55.467511836 +0100
ed1ed2
@@ -0,0 +1,41 @@
ed1ed2
+/* PR target/84524 */
ed1ed2
+
ed1ed2
+__attribute__((noipa)) void
ed1ed2
+foo (unsigned short *x)
ed1ed2
+{
ed1ed2
+  unsigned short i, v;
ed1ed2
+  unsigned char j;
ed1ed2
+  for (i = 0; i < 256; i++)
ed1ed2
+    {
ed1ed2
+      v = i << 8;
ed1ed2
+      for (j = 0; j < 8; j++)
ed1ed2
+	if (v & 0x8000)
ed1ed2
+	  v = (v << 1) ^ 0x1021;
ed1ed2
+	else
ed1ed2
+	  v = v << 1;
ed1ed2
+      x[i] = v;
ed1ed2
+    }
ed1ed2
+}
ed1ed2
+
ed1ed2
+int
ed1ed2
+main ()
ed1ed2
+{
ed1ed2
+  unsigned short a[256];
ed1ed2
+
ed1ed2
+  foo (a);
ed1ed2
+  for (int i = 0; i < 256; i++)
ed1ed2
+    {
ed1ed2
+      unsigned short v = i << 8;
ed1ed2
+      for (int j = 0; j < 8; j++)
ed1ed2
+	{
ed1ed2
+	  asm volatile ("" : "+r" (v));
ed1ed2
+	  if (v & 0x8000)
ed1ed2
+	    v = (v << 1) ^ 0x1021;
ed1ed2
+	  else
ed1ed2
+	    v = v << 1;
ed1ed2
+	}
ed1ed2
+      if (a[i] != v)
ed1ed2
+	__builtin_abort ();
ed1ed2
+    }
ed1ed2
+  return 0;
ed1ed2
+}
ed1ed2
--- gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c.jj	2018-02-23 11:58:16.919505601 +0100
ed1ed2
+++ gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c	2018-02-23 11:58:57.377508169 +0100
ed1ed2
@@ -0,0 +1,14 @@
ed1ed2
+/* PR target/84524 */
ed1ed2
+/* { dg-do run { target avx512bw } } */
ed1ed2
+/* { dg-options "-O3 -mavx512bw" } */
ed1ed2
+
ed1ed2
+#include "avx512bw-check.h"
ed1ed2
+
ed1ed2
+#define main() do_main()
ed1ed2
+#include "../../gcc.c-torture/execute/pr84524.c"
ed1ed2
+
ed1ed2
+static void
ed1ed2
+avx512bw_test (void)
ed1ed2
+{
ed1ed2
+  do_main ();
ed1ed2
+}