]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/84786 ([miscompilation] vunpcklpd accessing xmm16-22 targeting...
authorJakub Jelinek <jakub@redhat.com>
Fri, 22 Jun 2018 20:36:31 +0000 (22:36 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 22 Jun 2018 20:36:31 +0000 (22:36 +0200)
Backported from mainline
2018-03-13  Jakub Jelinek  <jakub@redhat.com>

PR target/84786
* config/i386/sse.md (sse2_loadhpd): Use Yv constraint rather than v
on the last operand.

* gcc.target/i386/avx512f-pr84786-1.c: New test.
* gcc.target/i386/avx512f-pr84786-2.c: New test.

From-SVN: r261919

gcc/ChangeLog
gcc/config/i386/sse.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c [new file with mode: 0644]

index 5b4c831735859380cc0465d11a9a225243bc8273..105317b17b6ed9e0b899d4084c2858a8594cc046 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84786
+       * config/i386/sse.md (sse2_loadhpd): Use Yv constraint rather than v
+       on the last operand.
+
        2018-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/84772
index 0ed1ac053c592653023616e0a3950352eb2d7b09..c2be8e394c8c928235e18062ea3233c5e2dc2b89 100644 (file)
 ;; see comment above inline_secondary_memory_needed function in i386.c
 (define_insn "sse2_loadhpd"
   [(set (match_operand:V2DF 0 "nonimmediate_operand"
-         "=x,v,x,v,o,o ,o")
+         "=x,v,x,v ,o,o ,o")
        (vec_concat:V2DF
          (vec_select:DF
            (match_operand:V2DF 1 "nonimmediate_operand"
-         " 0,v,0,v,0,0 ,0")
+         " 0,v,0,v ,0,0 ,0")
            (parallel [(const_int 0)]))
          (match_operand:DF 2 "nonimmediate_operand"
-         " m,m,x,v,x,*f,r")))]
+         " m,m,x,Yv,x,*f,r")))]
   "TARGET_SSE2 && !(MEM_P (operands[1]) && MEM_P (operands[2]))"
   "@
    movhpd\t{%2, %0|%0, %2}
index 9d78f627a155f1b9e525dddd571e071bcb7c9d05..5dbc86894dc39df0d71b238d76360a4bc0857d3f 100644 (file)
@@ -1,6 +1,12 @@
 2018-06-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-13  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84786
+       * gcc.target/i386/avx512f-pr84786-1.c: New test.
+       * gcc.target/i386/avx512f-pr84786-2.c: New test.
+
        2018-03-09  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/84772
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-1.c
new file mode 100644 (file)
index 0000000..d57b53b
--- /dev/null
@@ -0,0 +1,25 @@
+/* PR target/84786 */
+/* { dg-do run { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -mno-avx512vl -O2" } */
+/* { dg-require-effective-target avx512f } */
+
+#include "avx512f-check.h"
+
+typedef double V __attribute__((vector_size (16)));
+
+__attribute__((noinline, noclone)) V
+foo (V x, double y)
+{
+  register double z __asm ("xmm18");
+  asm volatile ("" : "=v" (z) : "0" (y));
+  x[1] = z;
+  return x;
+}
+
+static void
+avx512f_test (void)
+{
+  V a = foo ((V) { 1.0, 2.0 }, 3.0);
+  if (a[0] != 1.0 || a[1] != 3.0)
+    abort ();
+}
diff --git a/gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c b/gcc/testsuite/gcc.target/i386/avx512f-pr84786-2.c
new file mode 100644 (file)
index 0000000..5ac28aa
--- /dev/null
@@ -0,0 +1,16 @@
+/* PR target/84786 */
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-mavx512f -mno-avx512vl -O2" } */
+
+typedef double V __attribute__((vector_size (16)));
+
+__attribute__((noinline, noclone)) V
+foo (V x, double y)
+{
+  register double z __asm ("xmm18");
+  asm volatile ("" : "=v" (z) : "0" (y));
+  x[1] = z;
+  return x;
+}
+
+/* { dg-final { scan-assembler-not "vunpcklpd\[\^\n\r]*xmm(1\[6-9]|\[23]\[0-9])" } } */