public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Claudiu Zissulescu <Claudiu.Zissulescu@synopsys.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <Claudiu.Zissulescu@synopsys.com>,	<Francois.Bedard@synopsys.com>,
	<andrew.burgess@embecosm.com>,
	Claudiu Zissulescu <claziss@gmail.com>
Subject: [PATCH 3/5] [ARC] Update movhi and movdi patterns.
Date: Fri, 06 Apr 2018 09:00:00 -0000	[thread overview]
Message-ID: <1523005214-1611-4-git-send-email-claziss@synopsys.com> (raw)
In-Reply-To: <1523005214-1611-1-git-send-email-claziss@synopsys.com>

From: Claudiu Zissulescu <claziss@gmail.com>

Allow signed 6-bit short immediates into st[d] instructions.

2017-10-19  Claudiu Zissulescu  <claziss@synopsys.com>

	* config/arc/arc.c (arc_split_move): Allow signed 6-bit constants
	as source of std instructions.
	* config/arc/arc.md (movsi_insn): Update pattern predicate to
	allow 6-bit constants as source for store instructions.
	(movdi_insn): Update instruction pattern to allow 6-bit constants
	as source for store instructions.

testsuite/
2017-10-19  Claudiu Zissulescu  <claziss@synopsys.com>

	* gcc.target/arc/store-merge-1.c: New test.
	* gcc.target/arc/add_n-combine.c: Update test.
---
 gcc/config/arc/arc.c                         |  3 ++-
 gcc/config/arc/arc.md                        | 25 +++++++++++++------------
 gcc/testsuite/gcc.target/arc/add_n-combine.c |  2 +-
 gcc/testsuite/gcc.target/arc/store-merge-1.c | 17 +++++++++++++++++
 4 files changed, 33 insertions(+), 14 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/arc/store-merge-1.c

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 47d3ba4..2ccdce8 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -9669,7 +9669,8 @@ arc_split_move (rtx *operands)
 
   if (TARGET_LL64
       && ((memory_operand (operands[0], mode)
-	   && even_register_operand (operands[1], mode))
+	   && (even_register_operand (operands[1], mode)
+	       || satisfies_constraint_Cm3 (operands[1])))
 	  || (memory_operand (operands[1], mode)
 	      && even_register_operand (operands[0], mode))))
     {
diff --git a/gcc/config/arc/arc.md b/gcc/config/arc/arc.md
index ffd9d5b..0fc7aba 100644
--- a/gcc/config/arc/arc.md
+++ b/gcc/config/arc/arc.md
@@ -740,7 +740,9 @@ archs4x, archs4xd, archs4xd_slow"
        /* Don't use a LIMM that we could load with a single insn - we loose
 	  delay-slot filling opportunities.  */
        && !satisfies_constraint_I (operands[1])
-       && satisfies_constraint_Usc (operands[0]))"
+       && satisfies_constraint_Usc (operands[0]))
+   || (satisfies_constraint_Cm3 (operands[1])
+      && memory_operand (operands[0], SImode))"
   "@
    mov%? %0,%1%&	;0
    mov%? %0,%1%&	;1
@@ -1237,10 +1239,12 @@ archs4x, archs4xd, archs4xd_slow"
   ")
 
 (define_insn_and_split "*movdi_insn"
-  [(set (match_operand:DI 0 "move_dest_operand"      "=w, w,r,m")
-	(match_operand:DI 1 "move_double_src_operand" "c,Hi,m,c"))]
+  [(set (match_operand:DI 0 "move_dest_operand"      "=w, w,r,   m")
+	(match_operand:DI 1 "move_double_src_operand" "c,Hi,m,cCm3"))]
   "register_operand (operands[0], DImode)
-   || register_operand (operands[1], DImode)"
+   || register_operand (operands[1], DImode)
+   || (satisfies_constraint_Cm3 (operands[1])
+      && memory_operand (operands[0], DImode))"
   "*
 {
   switch (which_alternative)
@@ -1250,19 +1254,16 @@ archs4x, archs4xd, archs4xd_slow"
 
     case 2:
     if (TARGET_LL64
-	&& ((even_register_operand (operands[0], DImode)
-	     && memory_operand (operands[1], DImode))
-	    || (memory_operand (operands[0], DImode)
-	        && even_register_operand (operands[1], DImode))))
+        && memory_operand (operands[1], DImode)
+	&& even_register_operand (operands[0], DImode))
       return \"ldd%U1%V1 %0,%1%&\";
     return \"#\";
 
     case 3:
     if (TARGET_LL64
-	&& ((even_register_operand (operands[0], DImode)
-	     && memory_operand (operands[1], DImode))
-	    || (memory_operand (operands[0], DImode)
-	        && even_register_operand (operands[1], DImode))))
+	&& memory_operand (operands[0], DImode)
+	&& (even_register_operand (operands[1], DImode)
+	    || satisfies_constraint_Cm3 (operands[1])))
      return \"std%U0%V0 %1,%0\";
     return \"#\";
     }
diff --git a/gcc/testsuite/gcc.target/arc/add_n-combine.c b/gcc/testsuite/gcc.target/arc/add_n-combine.c
index db6454f..cd32ed3 100644
--- a/gcc/testsuite/gcc.target/arc/add_n-combine.c
+++ b/gcc/testsuite/gcc.target/arc/add_n-combine.c
@@ -45,4 +45,4 @@ void f() {
   a(at3.bn[bu]);
 }
 
-/* { dg-final { scan-rtl-dump-times "\\*add_n" 3 "combine" } } */
+/* { dg-final { scan-rtl-dump-times "\\*add_n" 2 "combine" } } */
diff --git a/gcc/testsuite/gcc.target/arc/store-merge-1.c b/gcc/testsuite/gcc.target/arc/store-merge-1.c
new file mode 100644
index 0000000..4bb8dcb
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arc/store-merge-1.c
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+/* This tests checks if we use st w6,[reg] format.  */
+
+typedef struct {
+  unsigned long __val[2];
+} sigset_t;
+
+int sigemptyset2 (sigset_t *set)
+{
+  set->__val[0] = 0;
+  set->__val[1] = 0;
+  return 0;
+}
+
+/* { dg-final { scan-assembler-times "st 0,\\\[r" 2 } } */
-- 
1.9.1

  reply	other threads:[~2018-04-06  9:00 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-06  9:00 [PATCH 0/5] [ARC] General fixes Claudiu Zissulescu
2018-04-06  9:00 ` Claudiu Zissulescu [this message]
2018-04-27 21:39   ` [PATCH 3/5] [ARC] Update movhi and movdi patterns Andrew Burgess
2018-04-30 13:17     ` Claudiu Zissulescu
2018-04-06  9:00 ` [PATCH 5/5] [ARC] Clear the instruction cache using syscalls Claudiu Zissulescu
2018-04-27 21:44   ` Andrew Burgess
2018-04-30 13:34     ` Claudiu Zissulescu
2018-04-06  9:00 ` [PATCH 2/5] [ARC] Fix FLS, SETI patterns Claudiu Zissulescu
2018-04-18 17:57   ` Andrew Burgess
2018-04-23 10:34     ` Claudiu Zissulescu
2018-04-06  9:00 ` [PATCH 4/5] [ARC] Cleanup sdata handling Claudiu Zissulescu
2018-04-27 21:40   ` Andrew Burgess
2018-04-30 13:18     ` Claudiu Zissulescu
2018-04-06  9:00 ` [PATCH 1/5] [ARC] Update sleep builtin Claudiu Zissulescu
2018-04-18 17:51   ` Andrew Burgess
2018-04-23  9:57     ` Claudiu Zissulescu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1523005214-1611-4-git-send-email-claziss@synopsys.com \
    --to=claudiu.zissulescu@synopsys.com \
    --cc=Francois.Bedard@synopsys.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=claziss@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).