public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2083] Use H8 nop moves as tst insns
@ 2021-07-06 15:00 Jeff Law
  0 siblings, 0 replies; only message in thread
From: Jeff Law @ 2021-07-06 15:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:73c49ff53235d92aba4ee748fcb06b06e83e0b8f

commit r12-2083-g73c49ff53235d92aba4ee748fcb06b06e83e0b8f
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Tue Jul 6 10:55:53 2021 -0400

    Use H8 nop moves as tst insns
    
    gcc
            * config/h8300/jumpcall.md (*branch): When possible, generate
            the comparison in CCZN mode.
            * config/h8300/predicates.md (simple_memory_operand): Reject all
            auto-increment addressing modes.

Diff:
---
 gcc/config/h8300/jumpcall.md   | 27 +++++++++++++++++++++++----
 gcc/config/h8300/predicates.md |  2 ++
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/gcc/config/h8300/jumpcall.md b/gcc/config/h8300/jumpcall.md
index 7b6a66a96ef..e1f04183564 100644
--- a/gcc/config/h8300/jumpcall.md
+++ b/gcc/config/h8300/jumpcall.md
@@ -23,13 +23,32 @@
   ""
   "#"
   "&& reload_completed"
-  [(set (reg:H8cc CC_REG)
-	(compare:H8cc (match_dup 1) (match_dup 2)))
+  [(set (match_dup 4)
+	(match_dup 5))
    (set (pc)
 	(if_then_else (match_op_dup 0
-		       [(reg:H8cc CC_REG) (const_int 0)])
+		       [(match_dup 4) (const_int 0)])
 		      (label_ref (match_dup 3)) (pc)))]
-  "")
+  "
+{
+  machine_mode mode;
+
+  if (REG_P (operands[1])
+      && operands[2] == const0_rtx
+      && (GET_CODE (operands[0]) == EQ
+	  || GET_CODE (operands[0]) == NE
+	  || GET_CODE (operands[0]) == LT
+	  || GET_CODE (operands[0]) == GE
+	  /* Our tstxx insns will set ZN and clear V, so we can handle
+	     a couple additional cases.  */
+	  || GET_CODE (operands[0]) == LE
+	  || GET_CODE (operands[0]) == GT))
+    mode = E_CCZNmode;
+  else
+    mode = E_CCmode;
+  operands[4] = gen_rtx_REG (mode, CC_REG);
+  operands[5] = gen_rtx_COMPARE (mode, operands[1], operands[2]);
+}")
 
 (define_insn "*branch_1"
   [(set (pc)
diff --git a/gcc/config/h8300/predicates.md b/gcc/config/h8300/predicates.md
index f4e3ed4f562..bed23e9a3e0 100644
--- a/gcc/config/h8300/predicates.md
+++ b/gcc/config/h8300/predicates.md
@@ -506,6 +506,8 @@
 {
   if (GET_MODE (op) == mode
       && (GET_CODE (XEXP (op, 0)) != PRE_DEC
+	  && GET_CODE (XEXP (op, 0)) != PRE_INC
+	  && GET_CODE (XEXP (op, 0)) != POST_DEC
 	  && GET_CODE (XEXP (op, 0)) != POST_INC))
     return 1;
   return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-07-06 15:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-06 15:00 [gcc r12-2083] Use H8 nop moves as tst insns Jeff Law

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).