Fix rounding pattern similar to PR73350.
authorJulia Koval <julia.koval@intel.com>
Tue, 20 Jun 2017 18:20:51 +0000 (20:20 +0200)
committerKirill Yukhin <kyukhin@gcc.gnu.org>
Tue, 20 Jun 2017 18:20:51 +0000 (18:20 +0000)
gcc/
* config/i386/i386.c: Fix rounding expand for new pattern.
* config/i386/subst.md: Fix pattern (parallel -> unspec).
gcc/testsuite/
* gcc.target/i386/pr73350-2.c: New test.

From-SVN: r249423

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/subst.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr73350-2.c [new file with mode: 0644]

index b28620aa794a9f81c62e073a3b4d122ff1e77dad..b43876685268d7c197726062eec34f9b33105bf8 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-20  Julia Koval  <julia.koval@intel.com>
+
+       * config/i386/i386.c: Fix rounding expand for new pattern.
+       * config/i386/subst.md: Fix pattern (parallel -> unspec).
+
 2017-06-20  James Greenhalgh  <james.greenhalgh@arm.com>
 
        * config/aarch64/aarch64-option-extensions.def (rcpc): New.
index d5c2d46bf5eeeccbe63f73546101e4d9613e5ca5..9f7290ad2398b18cc288c5bb24b69cca3faa955b 100644 (file)
@@ -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);
index 57fb0d471a4a23f479b2a4ede9db0cd99baa7671..4685db302b9ec9a4736e20cfebf305767f90dc9c 100644 (file)
   [(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")
index e22ebf5cb1681d617571991e22c778ad6c0aac54..b277662f8b6a7ac82e47f400fdd257feb069fcf5 100644 (file)
@@ -1,3 +1,7 @@
+2017-06-20  Julia Koval  <julia.koval@intel.com>
+
+       * gcc.target/i386/pr73350-2.c: New test.
+
 2017-06-20  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
        * c-c++-common/fold-masked-cmp-1.c: Allow for i?86-*-* target.
diff --git a/gcc/testsuite/gcc.target/i386/pr73350-2.c b/gcc/testsuite/gcc.target/i386/pr73350-2.c
new file mode 100644 (file)
index 0000000..c1faab4
--- /dev/null
@@ -0,0 +1,35 @@
+/* { dg-do run { target *-*-linux* *-*-gnu* } } */
+/* { dg-options "-O2 -mavx512er" } */
+/* { dg-require-effective-target avx512er } */
+
+#include "avx512er-check.h"
+
+#include <x86intrin.h>
+#include <unistd.h>
+#include <signal.h>
+
+static int counter;
+
+void handler (int i)
+{
+  exit (0);
+}
+
+static void
+avx512er_test (void)
+{
+  struct sigaction s;
+  sigemptyset (&s.sa_mask);
+  s.sa_handler = handler;
+  s.sa_flags = 0;
+  sigaction (SIGFPE, &s, NULL);
+
+  __m512 a = _mm512_set1_ps (-1.f);
+
+  _mm_setcsr ( _MM_MASK_MASK & ~_MM_MASK_INVALID );
+  __m512 r1 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_NO_EXC);
+  __m512 r2 = _mm512_rsqrt28_round_ps (a, _MM_FROUND_CUR_DIRECTION);
+  
+  if (r1[0] + r2[0])
+    abort ();
+}