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] Correct insn length in h8300 port.


Hi,

Attached is a patch to correct insn length in patterns involving the
'U' constraint, which is used for operands of bit operations (bset,
bclr, etc).

Without this patch, sometimes an 8-bit branch instruction (instead of
a 16-bit one) is generated due to underestimated insn length.  The
patch implements the maximum length of 8 bytes, which is the case On
H8/S.

Tested on h8300 port.  OK to apply to both branches?

Kazu Hirata

2001-10-29  Kazu Hirata  <kazu@hxi.com>

	* config/h8300/h8300.md (anonymous patterns with the 'U'
	constraint): Correct insn length.

Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.41
diff -c -r1.41 h8300.md
*** h8300.md	2001/10/26 17:09:33	1.41
--- h8300.md	2001/10/30 01:08:50
***************
*** 557,587 ****
  ;; ----------------------------------------------------------------------
  
  (define_insn ""
!   [(set (cc0) (zero_extract:QI (match_operand:QI 0 "bit_memory_operand" "rU")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n")))]
    ""
    "btst	%Z1,%R0"
!   [(set_attr "length" "2")
!    (set_attr "cc" "set_zn")])
  
  (define_insn ""
!   [(set (cc0) (zero_extract:HI (match_operand:QI 0 "bit_memory_operand" "rU")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n")))]
    ""
    "btst	%Z1,%Y0"
!   [(set_attr "length" "2")
!    (set_attr "cc" "set_zn")])
  
  (define_insn ""
!   [(set (cc0) (zero_extract:SI (match_operand:QI 0 "bit_memory_operand" "rU")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n")))]
    ""
    "btst	%Z1,%Y0"
!   [(set_attr "length" "2")
!    (set_attr "cc" "set_zn")])
  
  (define_insn ""
    [(set (cc0) (zero_extract:QI (match_operand:HI 0 "register_operand" "r")
--- 557,587 ----
  ;; ----------------------------------------------------------------------
  
  (define_insn ""
!   [(set (cc0) (zero_extract:QI (match_operand:QI 0 "bit_memory_operand" "r,U")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n,n")))]
    ""
    "btst	%Z1,%R0"
!   [(set_attr "length" "2,8")
!    (set_attr "cc" "set_zn,set_zn")])
  
  (define_insn ""
!   [(set (cc0) (zero_extract:HI (match_operand:QI 0 "bit_memory_operand" "r,U")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n,n")))]
    ""
    "btst	%Z1,%Y0"
!   [(set_attr "length" "2,8")
!    (set_attr "cc" "set_zn,set_zn")])
  
  (define_insn ""
!   [(set (cc0) (zero_extract:SI (match_operand:QI 0 "bit_memory_operand" "r,U")
  			       (const_int 1)
! 			       (match_operand:QI 1 "const_int_operand" "n,n")))]
    ""
    "btst	%Z1,%Y0"
!   [(set_attr "length" "2,8")
!    (set_attr "cc" "set_zn,set_zn")])
  
  (define_insn ""
    [(set (cc0) (zero_extract:QI (match_operand:HI 0 "register_operand" "r")
***************
*** 1030,1036 ****
    "@
     and	%X2,%X0
     bclr	%W2,%R0"
!   [(set_attr "length" "2,4")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  
--- 1030,1036 ----
    "@
     and	%X2,%X0
     bclr	%W2,%R0"
!   [(set_attr "length" "2,8")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  
***************
*** 1125,1131 ****
    "@
     or	%X2,%X0
     bset	%V2,%R0"
!   [(set_attr "length" "2,4")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  
--- 1125,1131 ----
    "@
     or	%X2,%X0
     bset	%V2,%R0"
!   [(set_attr "length" "2,8")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  
***************
*** 1202,1208 ****
    "@
     xor	%X2,%X0
     bnot	%V2,%R0"
!   [(set_attr "length" "2,4")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  
--- 1202,1208 ----
    "@
     xor	%X2,%X0
     bnot	%V2,%R0"
!   [(set_attr "length" "2,8")
     (set_attr "adjust_length" "no")
     (set_attr "cc" "set_znv,none_0hit")])
  


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