From 8239fd51d39ec9aac5d68d0e49c1aa074410307a Mon Sep 17 00:00:00 2001
From: julia <jkoval@gkticlel801.igk.intel.com>
Date: Mon, 12 Jun 2017 13:23:29 +0300
Subject: [PATCH] fix

---
 gcc/config/i386/i386.c                    |  4 ++--
 gcc/config/i386/subst.md                  |  9 +++++----
 gcc/testsuite/gcc.target/i386/pr73350-2.c | 18 ++++++++++++++++++
 3 files changed, 25 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/i386/pr73350-2.c

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index d5c2d46..9f7290a 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -36597,8 +36597,8 @@ ix86_expand_sse_comi_round (const struct builtin_description *d,
     }
   else
     {
-      gcc_assert (GET_CODE (XVECEXP (pat, 0, 0)) == SET);
-      set_dst = SET_DEST (XVECEXP (pat, 0, 0));
+      gcc_assert (GET_CODE (pat) == SET);
+      set_dst = SET_DEST (pat);
     }
 
   emit_insn (pat);
diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md
index 57fb0d4..4685db3 100644
--- a/gcc/config/i386/subst.md
+++ b/gcc/config/i386/subst.md
@@ -177,10 +177,11 @@
   [(set (match_operand:SUBST_A 0)
         (match_operand:SUBST_A 1))]
   "TARGET_AVX512F"
-  [(parallel[
-     (set (match_dup 0)
-          (match_dup 1))
-     (unspec [(match_operand:SI 2 "const48_operand")] UNSPEC_EMBEDDED_ROUNDING)])])
+  [(set (match_dup 0)
+	(unspec:SUBST_A [(match_dup 1)
+	  (match_operand:SI 2 "const48_operand")]
+	  UNSPEC_EMBEDDED_ROUNDING))
+])
 
 (define_subst_attr "round_expand_name" "round_expand" "" "_round")
 (define_subst_attr "round_expand_nimm_predicate" "round_expand" "nonimmediate_operand" "register_operand")
diff --git a/gcc/testsuite/gcc.target/i386/pr73350-2.c b/gcc/testsuite/gcc.target/i386/pr73350-2.c
new file mode 100644
index 0000000..cd5d599
--- /dev/null
+++ b/gcc/testsuite/gcc.target/i386/pr73350-2.c
@@ -0,0 +1,18 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -mavx512f -mavx512er" } */
+/* { dg-final { scan-assembler-times "vrsqrt28ps\[ \\t\]+\[^\{\n\]*\{sae\}\[^\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+/* { dg-final { scan-assembler-times "vrsqrt28ps\[ \\t\]+\[^\{\n\]*%zmm\[0-9\]+\[^\n\]*%zmm\[0-9\]+(?:\n|\[ \\t\]+#)" 1 } } */
+
+#include <x86intrin.h>
+
+void
+avx512f_test (void)
+{
+  __m512 a = _mm512_set1_ps((float) -1);
+  __m512 b = _mm512_set1_ps((float) -1);
+  _mm_setcsr (_MM_MASK_MASK & (_MM_MASK_OVERFLOW|_MM_MASK_INVALID|_MM_MASK_DIV_ZERO));
+  __m512 result1 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_NO_EXC);
+  __m512 result2 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_CUR_DIRECTION);
+  if (result1[0] == result2[0])
+    abort ();
+}
-- 
2.5.5

