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]

[patch] Make h8300 port build again in mainline


Hi,

Attached is a patch to make the h8300 port build again in the
mainline.

PUSH_ROUNDING in the h8300 port tells us to push a multiple of 2 bytes
on H8/300 and a multiple of 4 bytes on H8/300H and H8/S.  Originally,
movqi_push and movhi_push patterns had the predecrement constraint
'<', preventing the pre_modify stuff from being recognized.

The patch removes movqi_push and movhi_push because their names are
never used.  (emit_single_push_insn in expr.c builds a push operand
from ground up.)  Instead, the patch adds three new patterns that
explicitly accept the pre_modify stuff.  Two of them are in QImode,
the other in HImode.  Note that we do not need another pattern for a
HImode push on H8/300 because the regular movhi pattern takes care of
that case.  For the same reason, we do not need any special pattern
for a SImode push.

One more note.  I changed the attribute from set_znv to clobber
because, in case of a QImode push on H8/300, we are pushing two bytes
even though we are asked to push only one byte.  I did not see any
difference in the resulting code by this change, but I'd rather be
safe.

Thanks,

Kazu Hirata

2001-07-11  Kazu Hirata  <kazu@hxi.com>

	* config/h8300/h8300.md (movqi_push): Remove and replace with two
	unnamed patterns using pre_modify.
	(movhi_push): Remove and replace with an unnamed patterns using
	pre_modify.

Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.30
diff -c -r1.30 h8300.md
*** h8300.md	2001/06/13 17:41:19	1.30
--- h8300.md	2001/07/12 01:04:32
***************
*** 106,124 ****
  
  ;; movqi
  
! (define_insn "movqi_push"
!   [(set (match_operand:QI 0 "push_operand" "=<")
! 	(match_operand:QI 1 "register_operand" "r"))]
!   ""
!   "*
! {
!   if (TARGET_H8300)
!     return \"push.w	%T1\";
!   else
!     return \"push.l	%S1\";
! }"
!   [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))
!    (set_attr "cc" "set_znv")])
  
  (define_insn ""
    [(set (match_operand:QI 0 "general_operand_dst" "=r,r,<,r,r,m")
--- 106,128 ----
  
  ;; movqi
  
! (define_insn ""
!   [(set (mem:QI (pre_modify:HI (reg:HI 7)
!                                (plus:HI (reg:HI 7) (const_int -2))))
! 	(match_operand:QI 0 "register_operand" "r"))]
!   "TARGET_H8300"
!   "push.w	%T0"
!   [(set_attr "length" "2")
!    (set_attr "cc" "clobber")])
! 
! (define_insn ""
!   [(set (mem:QI (pre_modify:SI (reg:SI 7)
!                                (plus:SI (reg:SI 7) (const_int -4))))
! 	(match_operand:QI 0 "register_operand" "r"))]
!   "TARGET_H8300H || TARGET_H8300S"
!   "push.l	%S0"
!   [(set_attr "length" "4")
!    (set_attr "cc" "clobber")])
  
  (define_insn ""
    [(set (match_operand:QI 0 "general_operand_dst" "=r,r,<,r,r,m")
***************
*** 168,188 ****
  
  ;; movhi
  
! ;; ??? We use push.l on the h8300h to push a 16bit value?!?  We have
! ;; 16bit push insns!
! (define_insn "movhi_push"
!   [(set (match_operand:HI 0 "push_operand" "=<")
! 	(match_operand:HI 1 "register_operand" "r"))]
!   ""
!   "*
! {
!   if (TARGET_H8300)
!     return \"push.w	%T1\";
!   else
!     return \"push.l	%S1\";
! }"
!   [(set (attr "length") (if_then_else (eq_attr "cpu" "h8300") (const_int 2) (const_int 4)))
!    (set_attr "cc" "set_znv")])
  
  (define_insn ""
    [(set (match_operand:HI 0 "general_operand_dst" "=r,r,<,r,r,m")
--- 172,185 ----
  
  ;; movhi
  
! (define_insn ""
!   [(set (mem:HI (pre_modify:SI (reg:SI 7)
!                                (plus:SI (reg:SI 7) (const_int -4))))
! 	(match_operand:HI 0 "register_operand" "r"))]
!   "TARGET_H8300H || TARGET_H8300S"
!   "push.l	%S0"
!   [(set_attr "length" "4")
!    (set_attr "cc" "clobber")])
  
  (define_insn ""
    [(set (match_operand:HI 0 "general_operand_dst" "=r,r,<,r,r,m")


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