aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Carrez <Stephane.Carrez@worldnet.fr>2001-05-05 08:59:32 +0200
committerStephane Carrez <ciceron@gcc.gnu.org>2001-05-05 08:59:32 +0200
commitce8882e65fe50cef8ead72670b17ecbedc7b25ef (patch)
tree41cbbaa6d83d836b54d01b8b95a04543040effdd
parenta1fdc802bb9b01746af19487ef0ff6a60c90d844 (diff)
downloadgcc-ce8882e65fe50cef8ead72670b17ecbedc7b25ef.zip
gcc-ce8882e65fe50cef8ead72670b17ecbedc7b25ef.tar.gz
gcc-ce8882e65fe50cef8ead72670b17ecbedc7b25ef.tar.bz2
m68hc11.c (m68hc11_gen_movhi): Optimize moves between X and Y by using sequences of xgdx and xgdy.
* config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Optimize moves between X and Y by using sequences of xgdx and xgdy. From-SVN: r41861
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/config/m68hc11/m68hc11.c32
2 files changed, 33 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 15f07ba..2692493 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2001-05-05 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+ * config/m68hc11/m68hc11.c (m68hc11_gen_movhi): Optimize moves
+ between X and Y by using sequences of xgdx and xgdy.
+
+2001-05-05 Stephane Carrez <Stephane.Carrez@worldnet.fr>
+
* config/m68hc11/m68hc11.md ("*logicalsi3_silshr16"): Use '?' instead
of '!' for the 'D' alternative ('!' is too strong).
("*logicalsi3_silshl16"): Likewise.
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index 8aa5095..f9de2dc 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -3135,8 +3135,20 @@ m68hc11_gen_movhi (insn, operands)
}
else if (Y_REG_P (operands[1]))
{
- output_asm_insn ("sty\t%t1", operands);
- output_asm_insn ("ldx\t%t1", operands);
+ /* When both D and Y are dead, use the sequence xgdy, xgdx
+ to move Y into X. The D and Y registers are modified. */
+ if (optimize && find_regno_note (insn, REG_DEAD, HARD_Y_REGNUM)
+ && dead_register_here (insn, d_reg))
+ {
+ output_asm_insn ("xgdy", operands);
+ output_asm_insn ("xgdx", operands);
+ CC_STATUS_INIT;
+ }
+ else
+ {
+ output_asm_insn ("sty\t%t1", operands);
+ output_asm_insn ("ldx\t%t1", operands);
+ }
}
else if (SP_REG_P (operands[1]))
{
@@ -3165,8 +3177,20 @@ m68hc11_gen_movhi (insn, operands)
}
else if (X_REG_P (operands[1]))
{
- output_asm_insn ("stx\t%t1", operands);
- output_asm_insn ("ldy\t%t1", operands);
+ /* When both D and X are dead, use the sequence xgdx, xgdy
+ to move X into Y. The D and X registers are modified. */
+ if (optimize && find_regno_note (insn, REG_DEAD, HARD_X_REGNUM)
+ && dead_register_here (insn, d_reg))
+ {
+ output_asm_insn ("xgdx", operands);
+ output_asm_insn ("xgdy", operands);
+ CC_STATUS_INIT;
+ }
+ else
+ {
+ output_asm_insn ("stx\t%t1", operands);
+ output_asm_insn ("ldy\t%t1", operands);
+ }
}
else if (SP_REG_P (operands[1]))
{