Patchwork [SH] PR 53911 - Remove SImode displacement addressing related splits

login
register
mail settings
Submitter Oleg Endo
Date July 10, 2012, 7:50 a.m.
Message ID <1341906644.2292.37.camel@yam-132-YW-E178-FTW>
Download mbox | patch
Permalink /patch/170073/
State New
Headers show

Comments

Oleg Endo - July 10, 2012, 7:50 a.m.
Hello,

The attached patch removes two splits that undo displacement address
re-basing.  I've noticed that removing the two splits seems to result in
overall slightly smaller code according to the CSiBE set (compared with
-m4-single -ml -O2 -mpretend-cmove, -1048 bytes in total), despite some
code size increases here and there. 

Tested on rev. 189361 with
make -k check RUNTESTFLAGS="--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m2a-single/-mb,-m4/-ml,-m4/-mb,-m4-single/-ml,
-m4-single/-mb,-m4a-single/-ml,-m4a-single/-mb}"

and no new failures.

Cheers,
Oleg

ChangeLog

	PR target/53911
	* config/sh/sh.md: Remove displacement addresssing related
	splits.
Kaz Kojima - July 10, 2012, 9:36 p.m.
Oleg Endo <oleg.endo@t-online.de> wrote:
> The attached patch removes two splits that undo displacement address
> re-basing.  I've noticed that removing the two splits seems to result in
> overall slightly smaller code according to the CSiBE set (compared with
> -m4-single -ml -O2 -mpretend-cmove, -1048 bytes in total), despite some
> code size increases here and there. 

This patch is OK.

Regards,
	kaz

Patch

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md	(revision 189362)
+++ gcc/config/sh/sh.md	(working copy)
@@ -6683,63 +6683,6 @@ 
     FAIL;
 })
 
-;; If a base address generated by LEGITIMIZE_ADDRESS for SImode is
-;; used only once, let combine add in the index again.
-
-(define_split
-  [(set (match_operand:SI 0 "register_operand" "")
-	(match_operand:SI 1 "" ""))
-   (clobber (match_operand 2 "register_operand" ""))]
-  "TARGET_SH1 && ! reload_in_progress && ! reload_completed
-   && ALLOW_INDEXED_ADDRESS"
-  [(use (reg:SI R0_REG))]
-{
-  rtx addr, reg, const_int;
-
-  if (!MEM_P (operands[1]))
-    FAIL;
-  addr = XEXP (operands[1], 0);
-  if (GET_CODE (addr) != PLUS)
-    FAIL;
-  reg = XEXP (addr, 0);
-  const_int = XEXP (addr, 1);
-  if (! (BASE_REGISTER_RTX_P (reg) && INDEX_REGISTER_RTX_P (operands[2])
-	 && CONST_INT_P (const_int)))
-    FAIL;
-  emit_move_insn (operands[2], const_int);
-  emit_move_insn (operands[0],
-		  change_address (operands[1], VOIDmode,
-				  gen_rtx_PLUS (SImode, reg, operands[2])));
-  DONE;
-})
-
-(define_split
-  [(set (match_operand:SI 1 "" "")
-	(match_operand:SI 0 "register_operand" ""))
-   (clobber (match_operand 2 "register_operand" ""))]
-  "TARGET_SH1 && ! reload_in_progress && ! reload_completed
-   && ALLOW_INDEXED_ADDRESS"
-  [(use (reg:SI R0_REG))]
-{
-  rtx addr, reg, const_int;
-
-  if (!MEM_P (operands[1]))
-    FAIL;
-  addr = XEXP (operands[1], 0);
-  if (GET_CODE (addr) != PLUS)
-    FAIL;
-  reg = XEXP (addr, 0);
-  const_int = XEXP (addr, 1);
-  if (! (BASE_REGISTER_RTX_P (reg) && INDEX_REGISTER_RTX_P (operands[2])
-	 && CONST_INT_P (const_int)))
-    FAIL;
-  emit_move_insn (operands[2], const_int);
-  emit_move_insn (change_address (operands[1], VOIDmode,
-				  gen_rtx_PLUS (SImode, reg, operands[2])),
-		  operands[0]);
-  DONE;
-})
-
 (define_expand "movdf"
   [(set (match_operand:DF 0 "general_movdst_operand" "")
 	(match_operand:DF 1 "general_movsrc_operand" ""))]