re PR target/84524 (-O3 causes behavior change)
authorJakub Jelinek <jakub@redhat.com>
Mon, 5 Mar 2018 16:01:03 +0000 (17:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 5 Mar 2018 16:01:03 +0000 (17:01 +0100)
PR target/84524
* config/i386/sse.md (*<code><mode>3): Replace <mask_prefix3> with
orig,vex.
(*<plusminus_insn><mode>3): Likewise.  Remove <mask_operand3> uses.

* gcc.c-torture/execute/pr84524.c: New test.
* gcc.target/i386/avx512bw-pr84524.c: New test.

From-SVN: r258252

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/pr84524.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c [new file with mode: 0644]

index 723e718baa1b176c373420083a421c22cffd769f..ef9a8c95f712420c9e2802d02ca60114f666d205 100644 (file)
@@ -1,3 +1,10 @@
+2018-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84524
+       * config/i386/sse.md (*<code><mode>3): Replace <mask_prefix3> with
+       orig,vex.
+       (*<plusminus_insn><mode>3): Likewise.  Remove <mask_operand3> uses.
+
 2018-03-05  Peter Bergner  <bergner@vnet.ibm.com>
 
        PR target/84264
index 26c4f5227f64d9b54860486d88c353ae31de6fd0..12a594f78bfae14da6d313a4c369b06cf9553cd1 100644 (file)
   "TARGET_SSE2 && ix86_binary_operator_ok (<CODE>, <MODE>mode, operands)"
   "@
    p<plusminus_mnemonic><ssemodesuffix>\t{%2, %0|%0, %2}
-   vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0<mask_operand3>|%0<mask_operand3>, %1, %2}"
+   vp<plusminus_mnemonic><ssemodesuffix>\t{%2, %1, %0|%0, %1, %2}"
   [(set_attr "isa" "noavx,avx")
    (set_attr "type" "sseiadd")
    (set_attr "prefix_data16" "1,*")
-   (set_attr "prefix" "<mask_prefix3>")
+   (set_attr "prefix" "orig,vex")
    (set_attr "mode" "<sseinsnmode>")])
 
 (define_insn "*<plusminus_insn><mode>3_mask"
            (eq_attr "mode" "TI"))
        (const_string "1")
        (const_string "*")))
-   (set_attr "prefix" "<mask_prefix3>,evex")
+   (set_attr "prefix" "orig,vex,evex")
    (set (attr "mode")
        (cond [(and (match_test "<MODE_SIZE> == 16")
                    (match_test "TARGET_SSE_PACKED_SINGLE_INSN_OPTIMAL"))
index 70bce764b06f816cdec5e2f0d79df7f07885ca9c..6195e215a9e2e33268cf2c8f5ff250683ec23ffc 100644 (file)
@@ -1,3 +1,9 @@
+2018-03-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84524
+       * gcc.c-torture/execute/pr84524.c: New test.
+       * gcc.target/i386/avx512bw-pr84524.c: New test.
+
 2018-03-05  Peter Bergner  <bergner@vnet.ibm.com>
 
        PR target/84264
diff --git a/gcc/testsuite/gcc.c-torture/execute/pr84524.c b/gcc/testsuite/gcc.c-torture/execute/pr84524.c
new file mode 100644 (file)
index 0000000..8ca0715
--- /dev/null
@@ -0,0 +1,41 @@
+/* PR target/84524 */
+
+__attribute__((noipa)) void
+foo (unsigned short *x)
+{
+  unsigned short i, v;
+  unsigned char j;
+  for (i = 0; i < 256; i++)
+    {
+      v = i << 8;
+      for (j = 0; j < 8; j++)
+       if (v & 0x8000)
+         v = (v << 1) ^ 0x1021;
+       else
+         v = v << 1;
+      x[i] = v;
+    }
+}
+
+int
+main ()
+{
+  unsigned short a[256];
+
+  foo (a);
+  for (int i = 0; i < 256; i++)
+    {
+      unsigned short v = i << 8;
+      for (int j = 0; j < 8; j++)
+       {
+         asm volatile ("" : "+r" (v));
+         if (v & 0x8000)
+           v = (v << 1) ^ 0x1021;
+         else
+           v = v << 1;
+       }
+      if (a[i] != v)
+       __builtin_abort ();
+    }
+  return 0;
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c b/gcc/testsuite/gcc.target/i386/avx512bw-pr84524.c
new file mode 100644 (file)
index 0000000..536e81e
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR target/84524 */
+/* { dg-do run { target avx512bw } } */
+/* { dg-options "-O3 -mavx512bw" } */
+
+#include "avx512bw-check.h"
+
+#define main() do_main()
+#include "../../gcc.c-torture/execute/pr84524.c"
+
+static void
+avx512bw_test (void)
+{
+  do_main ();
+}