h8300-protos.h: Add a prototype for byte_accesses_mergeable_p.

* config/h8300/h8300-protos.h: Add a prototype for
	byte_accesses_mergeable_p.
	* config/h8300/h8300.c (byte_accesses_mergeable_p): New.
	* config/h8300/h8300.md (*iorhi3_two_qi_mem): Likewise.
	(a splitter): Likewise.
	(*iorsi3_ashift_16_ashift_24): Likewise.
	(*iorsi3_ashift_16_ashift_24_mem): Likewise.

From-SVN: r64518
This commit is contained in:
Kazu Hirata 2003-03-18 01:25:57 +00:00 committed by Kazu Hirata
parent d4e9427174
commit 9b98dc7477
4 changed files with 119 additions and 0 deletions

View File

@ -1,3 +1,13 @@
2003-03-17 Kazu Hirata <kazu@cs.umass.edu>
* config/h8300/h8300-protos.h: Add a prototype for
byte_accesses_mergeable_p.
* config/h8300/h8300.c (byte_accesses_mergeable_p): New.
* config/h8300/h8300.md (*iorhi3_two_qi_mem): Likewise.
(a splitter): Likewise.
(*iorsi3_ashift_16_ashift_24): Likewise.
(*iorsi3_ashift_16_ashift_24_mem): Likewise.
2003-03-17 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* dwarf2asm.h: Delete obsolete comment.

View File

@ -73,6 +73,7 @@ extern int iorxor_operator PARAMS ((rtx, enum machine_mode));
extern int h8300_eightbit_constant_address_p PARAMS ((rtx));
extern int h8300_tiny_constant_address_p PARAMS ((rtx));
extern int byte_accesses_mergeable_p PARAMS ((rtx, rtx));
/* Used in builtins.c */
extern rtx h8300_return_addr_rtx PARAMS ((int, rtx));

View File

@ -4385,3 +4385,49 @@ h8300_tiny_constant_address_p (x)
|| ((TARGET_H8300S && !TARGET_NORMAL_MODE)
&& (IN_RANGE (addr, s1, s2) || IN_RANGE (addr, s3, s4))));
}
int
byte_accesses_mergeable_p (addr1, addr2)
rtx addr1, addr2;
{
HOST_WIDE_INT offset1, offset2;
rtx reg1, reg2;
if (REG_P (addr1))
{
reg1 = addr1;
offset1 = 0;
}
else if (GET_CODE (addr1) == PLUS
&& REG_P (XEXP (addr1, 0))
&& GET_CODE (XEXP (addr1, 1)) == CONST_INT)
{
reg1 = XEXP (addr1, 0);
offset1 = INTVAL (XEXP (addr1, 1));
}
else
return 0;
if (REG_P (addr2))
{
reg2 = addr2;
offset2 = 0;
}
else if (GET_CODE (addr2) == PLUS
&& REG_P (XEXP (addr2, 0))
&& GET_CODE (XEXP (addr2, 1)) == CONST_INT)
{
reg2 = XEXP (addr2, 0);
offset2 = INTVAL (XEXP (addr2, 1));
}
else
return 0;
if (((reg1 == stack_pointer_rtx && reg2 == stack_pointer_rtx)
|| (reg1 == frame_pointer_rtx && reg2 == frame_pointer_rtx))
&& offset1 % 2 == 0
&& offset1 + 1 == offset2)
return 1;
return 0;
}

View File

@ -2887,6 +2887,28 @@
[(set_attr "cc" "clobber")
(set_attr "length" "2")])
(define_insn "*iorhi3_two_qi_mem"
[(set (match_operand:HI 0 "register_operand" "=&r")
(ior:HI (zero_extend:HI (match_operand:QI 1 "memory_operand" "m"))
(ashift:HI (subreg:HI (match_operand:QI 2 "memory_operand" "m") 0)
(const_int 8))))]
""
"mov.b\\t%X2,%t0\;mov.b\\t%X1,%s0"
[(set_attr "cc" "clobber")
(set_attr "length" "16")])
(define_split
[(set (match_operand:HI 0 "register_operand" "")
(ior:HI (zero_extend:HI (match_operand:QI 1 "memory_operand" ""))
(ashift:HI (subreg:HI (match_operand:QI 2 "memory_operand" "") 0)
(const_int 8))))]
"(TARGET_H8300H || TARGET_H8300S)
&& reload_completed
&& byte_accesses_mergeable_p (XEXP (operands[2], 0), XEXP (operands[1], 0))"
[(set (match_dup 0)
(match_dup 3))]
"operands[3] = gen_rtx_MEM (HImode, XEXP (operands[2], 0));")
;; ior:SI
(define_insn "*iorsi3_two_hi"
@ -3042,6 +3064,46 @@
[(set_attr "length" "6")
(set_attr "cc" "clobber")])
(define_insn_and_split "*iorsi3_ashift_16_ashift_24"
[(set (match_operand:SI 0 "register_operand" "=r")
(ior:SI (ashift:SI (match_operand:SI 1 "register_operand" "0")
(const_int 16))
(ashift:SI (match_operand:SI 2 "register_operand" "r")
(const_int 24))))]
"(TARGET_H8300H || TARGET_H8300S)"
"#"
"&& reload_completed"
[(set (match_dup 3)
(ior:HI (ashift:HI (match_dup 4)
(const_int 8))
(match_dup 3)))
(parallel [(set (match_dup 0)
(ashift:SI (match_dup 0)
(const_int 16)))
(clobber (scratch:QI))])]
"operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));
operands[4] = gen_rtx_REG (HImode, REGNO (operands[2]));")
(define_insn_and_split "*iorsi3_ashift_16_ashift_24_mem"
[(set (match_operand:SI 0 "register_operand" "=&r")
(ior:SI (and:SI (ashift:SI (subreg:SI (match_operand:QI 1 "memory_operand" "m") 0)
(const_int 16))
(const_int 16711680))
(ashift:SI (subreg:SI (match_operand:QI 2 "memory_operand" "m") 0)
(const_int 24))))]
"(TARGET_H8300H || TARGET_H8300S)"
"#"
"&& reload_completed"
[(set (match_dup 3)
(ior:HI (zero_extend:HI (match_dup 1))
(ashift:HI (subreg:HI (match_dup 2) 0)
(const_int 8))))
(parallel [(set (match_dup 0)
(ashift:SI (match_dup 0)
(const_int 16)))
(clobber (scratch:QI))])]
"operands[3] = gen_rtx_REG (HImode, REGNO (operands[0]));")
;; Used to add the exponent of a float.
(define_insn "*addsi3_shift"