[gcc(refs/vendors/ARM/heads/arm-perf-staging)] Combine the two H8 mode shortening peepholes into a single peephole

Tamar Christina tnfchris@gcc.gnu.org
Fri Jul 17 13:02:20 GMT 2020


https://gcc.gnu.org/g:985873e5087843a7c3d38266d21456259ac55542

commit 985873e5087843a7c3d38266d21456259ac55542
Author: Jeff Law <law@redhat.com>
Date:   Wed Feb 12 14:52:24 2020 -0700

    Combine the two H8 mode shortening peepholes into a single peephole
    
            * config/h8300/h8300.md (comparison shortening peepholes): Use
            a mode iterator to merge the HImode and SImode peepholes.

Diff:
---
 gcc/ChangeLog             |  5 +++++
 gcc/config/h8300/h8300.md | 41 ++++++++---------------------------------
 2 files changed, 13 insertions(+), 33 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b566ca4b591..fe42cee9e22 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2020-02-12  Jeff Law  <law@redhat.com>
+
+	* config/h8300/h8300.md (comparison shortening peepholes): Use
+	a mode iterator to merge the HImode and SImode peepholes.
+
 2020-02-12  Jakub Jelinek  <jakub@redhat.com>
 
 	PR middle-end/93663
diff --git a/gcc/config/h8300/h8300.md b/gcc/config/h8300/h8300.md
index dcc9c3682d6..f12eb46306f 100644
--- a/gcc/config/h8300/h8300.md
+++ b/gcc/config/h8300/h8300.md
@@ -5366,38 +5366,13 @@
   {
     operands[5] = GEN_INT (- INTVAL (operands[1]));
   })
-;; Narrow the mode of testing if possible.
 
-(define_peephole2
-  [(set (match_operand:HI 0 "register_operand" "")
-	(and:HI (match_dup 0)
-		(match_operand:HI 1 "const_int_qi_operand" "")))
-   (set (cc0) (compare (match_dup 0)
-		       (const_int 0)))
-   (set (pc)
-	(if_then_else (match_operator 3 "eqne_operator"
-		       [(cc0) (const_int 0)])
-		      (label_ref (match_operand 2 "" ""))
-		      (pc)))]
-  "peep2_reg_dead_p (2, operands[0])"
-  [(set (match_dup 4)
-	(and:QI (match_dup 4)
-		(match_dup 5)))
-   (set (cc0) (compare (match_dup 4)
-		       (const_int 0)))
-   (set (pc)
-	(if_then_else (match_op_dup 3 [(cc0) (const_int 0)])
-		      (label_ref (match_dup 2))
-		      (pc)))]
-  {
-    operands[4] = gen_rtx_REG (QImode, REGNO (operands[0]));
-    operands[5] = gen_int_mode (INTVAL (operands[1]), QImode);
-  })
+;; Narrow the mode of testing if possible.
 
 (define_peephole2
-  [(set (match_operand:SI 0 "register_operand" "")
-	(and:SI (match_dup 0)
-		(match_operand:SI 1 "const_int_qi_operand" "")))
+  [(set (match_operand:HSI 0 "register_operand" "")
+	(and:HSI (match_dup 0)
+		 (match_operand:HSI 1 "const_int_qi_operand" "")))
    (set (cc0) (compare (match_dup 0)
 		       (const_int 0)))
    (set (pc)
@@ -5406,11 +5381,10 @@
 		      (label_ref (match_operand 2 "" ""))
 		      (pc)))]
   "((const_int_qi_operand (operands[1], QImode)
-     || const_int_hi_operand (operands[1], HImode))
+     || (GET_MODE (operands[0]) == SImode
+	 && const_int_hi_operand (operands[1], HImode)))
     && peep2_reg_dead_p (2, operands[0]))"
-  [(set (match_dup 4)
-	(and:QI (match_dup 4)
-		(match_dup 5)))
+  [(set (match_dup 4) (match_dup 6))
    (set (cc0) (compare (match_dup 4)
 		       (const_int 0)))
    (set (pc)
@@ -5423,6 +5397,7 @@
     mode = const_int_qi_operand (operands[1], QImode) ? QImode : HImode;
     operands[4] = gen_rtx_REG (mode, REGNO (operands[0]));
     operands[5] = gen_int_mode (INTVAL (operands[1]), mode);
+    operands[6] = gen_rtx_AND (mode, operands[4], operands[5]);
   })
 
 ;; These triggers right at the end of allocation of locals in the


More information about the Gcc-cvs mailing list