]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* config/h8300/h8300.md: Add comments about peephole2's.
authorKazu Hirata <kazu@cs.umass.edu>
Thu, 4 Mar 2004 18:05:06 +0000 (18:05 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Thu, 4 Mar 2004 18:05:06 +0000 (18:05 +0000)
From-SVN: r78921

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

index ea801b9c7d8b00de2fe3d1ea146c03e804ff813e..13ce22dab689717754fa07446f0d0c8536d7e60b 100644 (file)
@@ -1,3 +1,7 @@
+2004-03-04  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * config/h8300/h8300.md: Add comments about peephole2's.
+
 2004-03-04  Steven Bosscher  <stevenb@suse.de>
 
        * i386.h (TARGET_CPU_DEFAULT_nocona): Fix value.
index 6bd51431cb2d8f4987f97f348081d547fede3a0c..b653cc9e1d7cdcf0e6d88b99ff8b0df17129e7a6 100644 (file)
 ;;
 ;; ---- 65535                       geu/ltu mov.w
 
-;; For a small constant, it is cheaper to actually do the subtraction
-;; and then test the register.
+;; Transform
+;;
+;;     cmp.l   #1,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     dec.l   #1,er0
+;;     beq     .L1
 
 (define_peephole2
   [(set (cc0)
                      (pc)))]
   "operands[4] = GEN_INT (- INTVAL (operands[1]));")
 
+;; Transform
+;;
+;;     cmp.l   #65536,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     dec.l   #1,e0
+;;     beq     .L1
+
 (define_peephole2
   [(set (cc0)
        (compare (match_operand:SI 0 "register_operand" "")
                      (pc)))]
   "operands[4] = GEN_INT (- INTVAL (operands[1]));")
 
-;; For certain (in)equality comparisons against a constant, we can
-;; XOR the register with the constant, and test the register against
-;; 0.
+;; Transform
+;;
+;;     cmp.l   #100,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     xor.b   #100,er0
+;;     mov.l   er0,er0
+;;     beq     .L1
 
 (define_peephole2
   [(set (cc0)
                      (pc)))]
   "")
 
+;; Transform
+;;
+;;     cmp.l   #-100,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     xor.b   #99,er0
+;;     not.l   er0
+;;     beq     .L1
+
 (define_peephole2
   [(set (cc0)
        (compare (match_operand:SI 0 "register_operand" "")
                      (pc)))]
   "operands[4] = GEN_INT (INTVAL (operands[1]) ^ -1);")
 
+;; Transform
+;;
+;;     cmp.l   #-2147483648,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     rotl.l  er0
+;;     dec.l   #1,er0
+;;     beq     .L1
+
 (define_peephole2
   [(set (cc0)
        (compare (match_operand:SI 0 "register_operand" "")
                                const0_rtx);
 })
 
-;; For constants like -1, -2, 1, 2, it is still cheaper to make a copy
-;; of the register being tested, do the subtraction on the copy, and
-;; then test the copy.  We avoid this transformation if we see more
-;; than one copy of the same compare insn.
+;; Transform
+;;
+;;     cmp.l   #1,er0
+;;     beq     .L1
+;;
+;; into
+;;
+;;     mov.l   er0,er1
+;;     dec.l   #1,er1
+;;     beq     .L1
+
+;; We avoid this transformation if we see more than one copy of the
+;; same compare insn.
 
 (define_peephole2
   [(match_scratch:SI 4 "r")