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: Improve a peephole2.


Hi,

Attached is a patch to improve a peephole2.

With this patch, a sequence like

	mov.w	#-256,r0
	add.w	r6,r0

is transformed into

	mov.w	r6,r0
	add.b	#255,r0h

The former takes 6 bytes, whereas the latter takes 4 bytes.

Tested on h8300 port.  Committed.

Kazu Hirata

2002-12-12  Kazu Hirata  <kazu@cs.umass.edu>

	* config/h8300/h8300.md (a peephole2): Accept a constant
	that's accepted by CONST_OK_FOR_J.

Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.120
diff -u -r1.120 h8300.md
--- h8300.md	12 Dec 2002 21:19:57 -0000	1.120
+++ h8300.md	12 Dec 2002 21:22:18 -0000
@@ -2710,7 +2710,8 @@
 		 (match_operand:HI 2 "register_operand" "")))]
   "REG_P (operands[0]) && REG_P (operands[2])
    && REGNO (operands[0]) != REGNO (operands[2])
-   && (CONST_OK_FOR_L (INTVAL (operands[1]))
+   && (CONST_OK_FOR_J (INTVAL (operands[1]))
+       || CONST_OK_FOR_L (INTVAL (operands[1]))
        || CONST_OK_FOR_N (INTVAL (operands[1])))"
   [(set (match_dup 0)
 	(match_dup 2))


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