public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][x86][PR73350][PR80862]
@ 2017-05-26  9:30 Koval, Julia
  2017-05-30  7:13 ` [PATCH][x86][PR73350][PR80862] Uros Bizjak
  2017-05-31  8:48 ` [PATCH][x86][PR73350][PR80862] Kirill Yukhin
  0 siblings, 2 replies; 6+ messages in thread
From: Koval, Julia @ 2017-05-26  9:30 UTC (permalink / raw)
  To: GCC Patches; +Cc: Uros Bizjak, Peryt, Sebastian

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Hi,
This patch fixes these PR's. Ok for trunk?

gcc/
	* config/i386/subst.md (round): Fix round pattern.
	* config/i386/i386.c (ix86_erase_embedded_rounding):
	Fix erasing rounding for the fixed pattern.

Thanks,
Julia

[-- Attachment #2: 0001-patch_1.patch --]
[-- Type: application/octet-stream, Size: 3350 bytes --]

From 41c2f87eaae29f2d3fcea3e8253308cad058dcee Mon Sep 17 00:00:00 2001
From: "julia.koval" <jkoval@gkliclel110.igk.intel.com>
Date: Fri, 26 May 2017 00:07:59 +0300
Subject: [PATCH] patch_1

---
 gcc/config/i386/i386.c   | 64 ++++++++++++++++++++++++++++--------------------
 gcc/config/i386/subst.md | 10 ++++----
 2 files changed, 42 insertions(+), 32 deletions(-)

diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 6413aa3..707351f 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -36483,38 +36483,48 @@ ix86_erase_embedded_rounding (rtx pat)
   if (GET_CODE (pat) == INSN)
     pat = PATTERN (pat);
 
-  gcc_assert (GET_CODE (pat) == PARALLEL);
+  if (GET_CODE (pat) == PARALLEL)
+  {
+    if (XVECLEN (pat, 0) == 2)
+      {
+	rtx p0 = XVECEXP (pat, 0, 0);
+	rtx p1 = XVECEXP (pat, 0, 1);
+	gcc_assert (GET_CODE (p0) == SET
+		    && GET_CODE (p1) == UNSPEC
+		    && XINT (p1, 1) == UNSPEC_EMBEDDED_ROUNDING);
+	return p0;
+      }
+    else
+      {
+	rtx *res = XALLOCAVEC (rtx, XVECLEN (pat, 0));
+	int i = 0;
+	int j = 0;
 
-  if (XVECLEN (pat, 0) == 2)
-    {
-      rtx p0 = XVECEXP (pat, 0, 0);
-      rtx p1 = XVECEXP (pat, 0, 1);
+	for (; i < XVECLEN (pat, 0); ++i)
+	  {
+	    rtx elem = XVECEXP (pat, 0, i);
+	    if (GET_CODE (elem) != UNSPEC
+		|| XINT (elem, 1) != UNSPEC_EMBEDDED_ROUNDING)
+	      res[j++] = elem;
+	  }
 
-      gcc_assert (GET_CODE (p0) == SET
-		  && GET_CODE (p1) == UNSPEC
-		  && XINT (p1, 1) == UNSPEC_EMBEDDED_ROUNDING);
+	/*  No more than 1 occurence was removed.  */
+	gcc_assert (j >= XVECLEN (pat, 0) - 1);
 
-      return p0;
+	return gen_rtx_PARALLEL (GET_MODE (pat), gen_rtvec_v (j, res));
     }
+  }
   else
-    {
-      rtx *res = XALLOCAVEC (rtx, XVECLEN (pat, 0));
-      int i = 0;
-      int j = 0;
-
-      for (; i < XVECLEN (pat, 0); ++i)
-	{
-	  rtx elem = XVECEXP (pat, 0, i);
-	  if (GET_CODE (elem) != UNSPEC
-	      || XINT (elem, 1) != UNSPEC_EMBEDDED_ROUNDING)
-	    res [j++] = elem;
-	}
-
-      /*  No more than 1 occurence was removed.  */
-      gcc_assert (j >= XVECLEN (pat, 0) - 1);
-
-      return gen_rtx_PARALLEL (GET_MODE (pat), gen_rtvec_v (j, res));
-    }
+  {
+    gcc_assert (GET_CODE (pat) == SET);
+    rtx src = SET_SRC (pat);
+    gcc_assert (XVECLEN (src, 0) == 2);
+    rtx p0 = XVECEXP (src, 0, 0);
+    gcc_assert (GET_CODE (src) == UNSPEC
+		&& XINT (src, 1) == UNSPEC_EMBEDDED_ROUNDING);
+    rtx res = gen_rtx_SET (SET_DEST (pat), p0);
+    return res;
+  }
 }
 
 /* Subroutine of ix86_expand_round_builtin to take care of comi insns
diff --git a/gcc/config/i386/subst.md b/gcc/config/i386/subst.md
index 0bc22fd..2e632b9 100644
--- a/gcc/config/i386/subst.md
+++ b/gcc/config/i386/subst.md
@@ -137,12 +137,12 @@
 
 (define_subst "round"
   [(set (match_operand:SUBST_A 0)
-        (match_operand:SUBST_A 1))]
+	(match_operand:SUBST_A 1))]
   "TARGET_AVX512F"
-  [(parallel[
-     (set (match_dup 0)
-          (match_dup 1))
-     (unspec [(match_operand:SI 2 "const_4_or_8_to_11_operand")] UNSPEC_EMBEDDED_ROUNDING)])])
+  [(set (match_dup 0)
+	(unspec:SUBST_A [(match_dup 1)
+	(match_operand:SI 2 "const_4_or_8_to_11_operand")]
+	 UNSPEC_EMBEDDED_ROUNDING))])
 
 (define_subst_attr "round_saeonly_name" "round_saeonly" "" "_round")
 (define_subst_attr "round_saeonly_mask_operand2" "mask" "%r2" "%r4")
-- 
2.5.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-06-08 11:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-26  9:30 [PATCH][x86][PR73350][PR80862] Koval, Julia
2017-05-30  7:13 ` [PATCH][x86][PR73350][PR80862] Uros Bizjak
2017-05-31  8:48 ` [PATCH][x86][PR73350][PR80862] Kirill Yukhin
2017-05-31 10:34   ` [PATCH][x86][PR73350][PR80862] Kirill Yukhin
2017-06-05 10:13     ` [PATCH][x86][PR73350][PR80862] Koval, Julia
2017-06-08 11:26       ` [PATCH][x86][PR73350][PR80862] Kirill Yukhin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).