[patch] h8300: Add a new alternative to addhi3.
Kazu Hirata
kazu@cs.umass.edu
Thu Dec 12 13:20:00 GMT 2002
Hi,
Attached is a patch to add a new alternative to addhi3.
If the constant appearing in (plus:HI (reg) (const_int)) is a multiple
of 256, we can do the addition without touching the lower half.
Tested on h8300 port. Committed.
Kazu Hirata
2002-12-12 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300.h (CONST_OK_FOR_J): New.
(CONST_OK_FOR_LETTER_P): Use CONST_OK_FOR_J.
* config/h8300/h8300.md (*addhi_h8300): Add a new alternative.
(*addhi_h8300hs): Likewise.
Index: h8300.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.h,v
retrieving revision 1.122
diff -c -r1.122 h8300.h
*** h8300.h 11 Dec 2002 13:01:40 -0000 1.122
--- h8300.h 12 Dec 2002 21:08:25 -0000
***************
*** 461,466 ****
--- 461,467 ----
Return 1 if VALUE is in the range specified by C. */
#define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
+ #define CONST_OK_FOR_J(VALUE) (((VALUE) & 0xff) == 0)
#define CONST_OK_FOR_L(VALUE) \
(TARGET_H8300H || TARGET_H8300S \
? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4 \
***************
*** 472,477 ****
--- 473,479 ----
#define CONST_OK_FOR_LETTER_P(VALUE, C) \
((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
+ (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
(C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
(C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
0)
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/h8300/h8300.md,v
retrieving revision 1.119
diff -c -r1.119 h8300.md
*** h8300.md 11 Dec 2002 13:27:29 -0000 1.119
--- h8300.md 12 Dec 2002 21:08:30 -0000
***************
*** 762,793 ****
""
"")
! (define_insn ""
! [(set (match_operand:HI 0 "register_operand" "=r,r,r,r,&r")
! (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0,g")
! (match_operand:HI 2 "nonmemory_operand" "L,N,n,r,r")))]
"TARGET_H8300"
"@
adds %2,%T0
subs %G2,%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,4,2,6")
! (set_attr "cc" "none_0hit,none_0hit,clobber,set_zn,set_zn")])
! (define_insn ""
! [(set (match_operand:HI 0 "register_operand" "=r,r,r,r")
! (plus:HI (match_operand:HI 1 "register_operand" "%0,0,0,0")
! (match_operand:HI 2 "nonmemory_operand" "L,N,n,r")))]
"TARGET_H8300H || TARGET_H8300S"
"@
adds %2,%S0
subs %G2,%S0
add.w %T2,%T0
add.w %T2,%T0"
! [(set_attr "length" "2,2,4,2")
! (set_attr "cc" "none_0hit,none_0hit,set_zn,set_zn")])
(define_split
[(set (match_operand:HI 0 "register_operand" "")
--- 762,795 ----
""
"")
! (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")
! (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_H8300H || TARGET_H8300S"
"@
adds %2,%S0
subs %G2,%S0
+ add.b %t2,%t0
add.w %T2,%T0
add.w %T2,%T0"
! [(set_attr "length" "2,2,2,4,2")
! (set_attr "cc" "none_0hit,none_0hit,clobber,set_zn,set_zn")])
(define_split
[(set (match_operand:HI 0 "register_operand" "")
More information about the Gcc-patches
mailing list