public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jeff Law <law@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-1297] Further improve redundant test/compare removal on the H8
Date: Tue,  8 Jun 2021 14:14:14 +0000 (GMT)	[thread overview]
Message-ID: <20210608141414.CF36D3839C4D@sourceware.org> (raw)

https://gcc.gnu.org/g:941aa24ca9553b422dba6e267448ddd952bc52d1

commit r12-1297-g941aa24ca9553b422dba6e267448ddd952bc52d1
Author: Jeff Law <jeffreyalaw@gmail.com>
Date:   Tue Jun 8 10:10:23 2021 -0400

    Further improve redundant test/compare removal on the H8
    
    gcc/
            * config/h8300/logical.md (andqi3_1): Move BCLR case into define_insn_and_split.
            Create length attribute on define_insn_and_split.  Only split for cases which we
            know will use AND.
            (andqi3_1<cczn>): Renamed from andqi3_1_clobber_flags.  Only handle AND here and
            fix length computation.
            (b<code><mode>msx): Combine QImode and HImode H8/SX patterns using iterator.

Diff:
---
 gcc/config/h8300/logical.md | 41 ++++++++++++++++-------------------------
 1 file changed, 16 insertions(+), 25 deletions(-)

diff --git a/gcc/config/h8300/logical.md b/gcc/config/h8300/logical.md
index 34cf74e24ee..fae3c7cd0c5 100644
--- a/gcc/config/h8300/logical.md
+++ b/gcc/config/h8300/logical.md
@@ -62,22 +62,21 @@
 		(match_operand:QI 2 "h8300_src_operand" "Y0,rn")))]
   "register_operand (operands[0], QImode)
    || single_zero_operand (operands[2], QImode)"
-  "#"
-  "&& reload_completed"
+  "bclr %W2,%R0"
+  "&& reload_completed && !single_zero_operand (operands[2], QImode)"
   [(parallel [(set (match_dup 0) (and:QI (match_dup 1) (match_dup 2)))
-	      (clobber (reg:CC CC_REG))])])
+	      (clobber (reg:CC CC_REG))])]
+  ""
+  [(set_attr "length" "8,2")])
 
-(define_insn "andqi3_1_clobber_flags"
-  [(set (match_operand:QI 0 "bit_operand" "=U,r")
-	(and:QI (match_operand:QI 1 "bit_operand" "%0,0")
-		(match_operand:QI 2 "h8300_src_operand" "Y0,rn")))
+(define_insn "*andqi3_1<cczn>"
+  [(set (match_operand:QI 0 "register_operand" "=r")
+	(and:QI (match_operand:QI 1 "register_operand" "%0")
+		(match_operand:QI 2 "h8300_src_operand" "rn")))
    (clobber (reg:CC CC_REG))]
-  "register_operand (operands[0], QImode)
-   || single_zero_operand (operands[2], QImode)"
-  "@
-   bclr %W2,%R0
-   and  %X2,%X0"
-  [(set_attr "length" "2,8")])
+  ""
+  "and  %X2,%X0"
+  [(set_attr "length" "2")])
 
 (define_insn_and_split "*andor<mode>3"
   [(set (match_operand:QHSI 0 "register_operand" "=r")
@@ -166,22 +165,14 @@
 ;; OR/XOR INSTRUCTIONS
 ;; ----------------------------------------------------------------------
 
-(define_insn "b<code>qi_msx"
-  [(set (match_operand:QI 0 "bit_register_indirect_operand" "=WU")
-	(ors:QI (match_operand:QI 1 "bit_register_indirect_operand" "%0")
-		(match_operand:QI 2 "single_one_operand" "Y2")))]
+(define_insn "b<code><mode>_msx"
+  [(set (match_operand:QHI 0 "bit_register_indirect_operand" "=WU")
+	(ors:QHI (match_operand:QHI 1 "bit_register_indirect_operand" "%0")
+		 (match_operand:QHI 2 "single_one_operand" "Y2")))]
   "TARGET_H8300SX && rtx_equal_p (operands[0], operands[1])"
   { return <CODE> == IOR ? "bset\\t%V2,%0" : "bnot\\t%V2,%0"; }
   [(set_attr "length" "8")])
 
-(define_insn "b<code>hi_msx"
-  [(set (match_operand:HI 0 "bit_register_indirect_operand" "=m")
-	(ors:HI (match_operand:HI 1 "bit_register_indirect_operand" "%0")
-		(match_operand:HI 2 "single_one_operand" "Y2")))]
-  "TARGET_H8300SX"
-  { return <CODE> == IOR ? "bset\\t%V2,%0" : "bnot\\t%V2,%0"; }
-  [(set_attr "length" "8")])
-
 (define_insn_and_split "<code>qi3_1"
   [(set (match_operand:QI 0 "bit_operand" "=U,rQ")
 	(ors:QI (match_operand:QI 1 "bit_operand" "%0,0")


                 reply	other threads:[~2021-06-08 14:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210608141414.CF36D3839C4D@sourceware.org \
    --to=law@gcc.gnu.org \
    --cc=gcc-cvs@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).