This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] h8300.md: Tweak operand numbers of some peephole2's.


Hi,

Attached is a patch to tweak operand numbers.  This makes splitting
these peepholes easier.

For example, when I split the first peephole addressed in this patch
into two versions, one of them will use the condition part of
if_then_else as is, but then I can't use operands[5] without using
operands[4].

Built h8300-elf.  Committed.

Kazu Hirata

2004-02-29  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/h8300.md: Tweak operand numbers of some
	peephole2's.

Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.276
diff -u -r1.276 h8300.md
--- h8300.md	29 Feb 2004 18:44:18 -0000	1.276
+++ h8300.md	29 Feb 2004 18:52:43 -0000
@@ -4198,27 +4198,27 @@
 	|| (TARGET_H8300S && INTVAL (operands[1]) == 3))"
   [(parallel [(set (match_dup 0)
 		   (ashiftrt:HI (match_dup 0)
-				(match_dup 5)))
+				(match_dup 4)))
 	      (clobber (scratch:QI))])
    (set (cc0)
 	(match_dup 0))
    (set (pc)
-	(if_then_else (match_dup 4)
+	(if_then_else (match_dup 5)
 		      (label_ref (match_dup 3))
 		      (pc)))]
   "switch (GET_CODE (operands[2]))
      {
      case GTU:
-       operands[4] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
        break;
      case LEU:
-       operands[4] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
        break;
      default:
-       operands[4] = operands[2];
+       operands[5] = operands[2];
        break;
      }
-   operands[5] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
+   operands[4] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
 
 ;; Transform
 ;;
@@ -4478,27 +4478,27 @@
 	(match_dup 0))
    (parallel [(set (match_dup 4)
 		   (ashiftrt:SI (match_dup 4)
-				(match_dup 6)))
+				(match_dup 5)))
 	      (clobber (scratch:QI))])
    (set (cc0)
 	(match_dup 4))
    (set (pc)
-	(if_then_else (match_dup 5)
+	(if_then_else (match_dup 6)
 		      (label_ref (match_dup 3))
 		      (pc)))]
   "switch (GET_CODE (operands[2]))
      {
      case GTU:
-       operands[5] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
+       operands[6] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
        break;
      case LEU:
-       operands[5] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
+       operands[6] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
        break;
      default:
-       operands[5] = operands[2];
+       operands[6] = operands[2];
        break;
      }
-   operands[6] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
+   operands[5] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
 
 ;; Transform
 ;;
@@ -4525,27 +4525,27 @@
 	|| (TARGET_H8300S && INTVAL (operands[1]) == 3))"
   [(parallel [(set (match_dup 0)
 		   (ashiftrt:SI (match_dup 0)
-				(match_dup 5)))
+				(match_dup 4)))
 	      (clobber (scratch:QI))])
    (set (cc0)
 	(match_dup 0))
    (set (pc)
-	(if_then_else (match_dup 4)
+	(if_then_else (match_dup 5)
 		      (label_ref (match_dup 3))
 		      (pc)))]
   "switch (GET_CODE (operands[2]))
      {
      case GTU:
-       operands[4] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
        break;
      case LEU:
-       operands[4] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
        break;
      default:
-       operands[4] = operands[2];
+       operands[5] = operands[2];
        break;
      }
-   operands[5] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
+   operands[4] = GEN_INT (exact_log2 (INTVAL (operands[1]) + 1));")
 
 ;; Transform
 ;;
@@ -4578,26 +4578,26 @@
        || INTVAL (operands[1]) == 255)"
   [(set (match_dup 0)
 	(and:SI (match_dup 0)
-		(match_dup 5)))
+		(match_dup 4)))
    (set (cc0)
 	(match_dup 0))
    (set (pc)
-	(if_then_else (match_dup 4)
+	(if_then_else (match_dup 5)
 		      (label_ref (match_dup 3))
 		      (pc)))]
   "switch (GET_CODE (operands[2]))
      {
      case GTU:
-       operands[4] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_NE (VOIDmode, cc0_rtx, const0_rtx);
        break;
      case LEU:
-       operands[4] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
+       operands[5] = gen_rtx_EQ (VOIDmode, cc0_rtx, const0_rtx);
        break;
      default:
-       operands[4] = operands[2];
+       operands[5] = operands[2];
        break;
      }
-   operands[5] = GEN_INT (~INTVAL (operands[1]));")
+   operands[4] = GEN_INT (~INTVAL (operands[1]));")
 
 ;; Transform
 ;;


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]