* config/h8300/h8300.md (a peephole2): New.
authorKazu Hirata <kazu@cs.umass.edu>
Sat, 1 Mar 2003 19:37:35 +0000 (19:37 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Sat, 1 Mar 2003 19:37:35 +0000 (19:37 +0000)
From-SVN: r63616

gcc/ChangeLog
gcc/config/h8300/h8300.md

index 3d536680147bae97260b0a46ca531f1bc51c0103..fdd350db14226c61696c5a5c0bf54113fe2dd703 100644 (file)
@@ -1,3 +1,7 @@
+2003-03-01  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.md (a peephole2): New.
+
 2003-03-01  Richard Earnshaw  <rearnsha@arm.com>
 
        * predict.c (estimate_bb_frequencies): Correctly set
index 084d5abbee16ea5ee63f8cd61b74116a7d198c24..f97e934bd6c399768fa30321df460724d7a9b6a5 100644 (file)
 ;; dead     1                       eq/ne   dec.l
 ;; dead     2                       eq/ne   dec.l
 ;;
+;; dead -131072                     eq/ne   inc.w and test
+;; dead  -65536                     eq/ne   inc.w and test
+;; dead   65536                     eq/ne   inc.w and test
+;; dead  131072                     eq/ne   inc.w and test
+;;
 ;; dead 0x000000?? except 1 and 2   eq/ne   xor.b and test
 ;; dead 0x0000??00                  eq/ne   xor.b and test
 ;; dead 0x0000ffff                  eq/ne   not.w and test
                      (pc)))]
   "operands[4] = GEN_INT (- INTVAL (operands[1]));")
 
+(define_peephole2
+  [(set (cc0)
+       (compare (match_operand:SI 0 "register_operand" "")
+                (match_operand:SI 1 "const_int_operand" "")))
+   (set (pc)
+       (if_then_else (match_operator 3 "eqne_operator"
+                       [(cc0) (const_int 0)])
+                     (label_ref (match_operand 2 "" ""))
+                     (pc)))]
+  "(TARGET_H8300H || TARGET_H8300S)
+   && peep2_reg_dead_p (1, operands[0])
+   && (INTVAL (operands[1]) == -131072
+       || INTVAL (operands[1]) == -65536
+       || INTVAL (operands[1]) == 65536
+       || INTVAL (operands[1]) == 131072)"
+  [(set (match_dup 0)
+       (plus:SI (match_dup 0)
+                (match_dup 4)))
+   (set (cc0)
+       (match_dup 0))
+   (set (pc)
+       (if_then_else (match_op_dup 3 [(cc0) (const_int 0)])
+                     (label_ref (match_dup 2))
+                     (pc)))]
+  "operands[4] = GEN_INT (- INTVAL (operands[1]));")
+
 ;; For certain (in)equaltity comparisions against a constant, we can
 ;; XOR the register with the constant, and test the register against
 ;; 0.