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: Remove an alternative from addhi3.


Hi,

Attached is a patch to remove an alternative from *addhi3_h8300.

The last alternative often turns into

	mov.w	#1,r2
	add.w	r7,r2

which could be done more efficiently by adding 1 later.

Testing with newlib shows that without the alternative, the quality of
generated code is still as good.

Tested on h8300 port.  Committed.

Kazu Hirata

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

	* config/h8300/h8300.md (addhi3_h8300): Remove the last
	alternative.

Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.122
diff -c -r1.122 h8300.md
*** h8300.md	12 Dec 2002 22:29:10 -0000	1.122
--- h8300.md	13 Dec 2002 13:32:53 -0000
***************
*** 763,781 ****
    "")
  
  (define_insn "*addhi3_h8300"
!   [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r,&r")
! 	(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0,g")
! 		 (match_operand:HI 2 "nonmemory_operand" "L,N,J,n,r,r")))]
    "TARGET_H8300"
    "@
     adds	%2,%T0
     subs	%G2,%T0
     add.b	%t2,%t0
     add.b	%s2,%s0\;addx	%t2,%t0
!    add.w	%T2,%T0
!    mov.w	%T1,%T0\;add.w	%T2,%T0"
!   [(set_attr "length" "2,2,2,4,2,6")
!    (set_attr "cc" "none_0hit,none_0hit,clobber,clobber,set_zn,set_zn")])
  
  (define_insn "*addhi3_h8300hs"
    [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
--- 763,780 ----
    "")
  
  (define_insn "*addhi3_h8300"
!   [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")
! 	(plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,0")
! 		 (match_operand:HI 2 "nonmemory_operand" "L,N,J,n,r")))]
    "TARGET_H8300"
    "@
     adds	%2,%T0
     subs	%G2,%T0
     add.b	%t2,%t0
     add.b	%s2,%s0\;addx	%t2,%t0
!    add.w	%T2,%T0"
!   [(set_attr "length" "2,2,2,4,2")
!    (set_attr "cc" "none_0hit,none_0hit,clobber,clobber,set_zn")])
  
  (define_insn "*addhi3_h8300hs"
    [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,r")


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