Commit fe91bac5 by Stephane Carrez Committed by Stephane Carrez

m68hc11.c (print_operand): Handle 'b' modifier for D register to specify the low part of it, aka B.

	* config/m68hc11/m68hc11.c (print_operand): Handle 'b' modifier
	for D register to specify the low part of it, aka B.
	(m68hc11_gen_movhi): Use REG_WAS_0 note and increment or decrement
	the register if we are loading 1 or -1 to it; avoid using temp
	register when moving X/Y to Y/X.
	(m68hc11_gen_movqi): Likewise.
	(m68hc11_check_z_replacement): Fix last insn setting for compare case.

From-SVN: r64447
parent ddc67067
2003-03-16 Stephane Carrez <stcarrez@nerim.fr>
* config/m68hc11/m68hc11.c (print_operand): Handle 'b' modifier
for D register to specify the low part of it, aka B.
(m68hc11_gen_movhi): Use REG_WAS_0 note and increment or decrement
the register if we are loading 1 or -1 to it; avoid using temp
register when moving X/Y to Y/X.
(m68hc11_gen_movqi): Likewise.
(m68hc11_check_z_replacement): Fix last insn setting for compare case.
2003-03-14 Mark Mitchell <mark@codesourcery.com> 2003-03-14 Mark Mitchell <mark@codesourcery.com>
PR optimization/9016 PR optimization/9016
......
...@@ -2154,6 +2154,10 @@ print_operand (file, op, letter) ...@@ -2154,6 +2154,10 @@ print_operand (file, op, letter)
asm_print_register (file, REGNO (op)); asm_print_register (file, REGNO (op));
fprintf (file, "+1"); fprintf (file, "+1");
} }
else if (letter == 'b' && D_REG_P (op))
{
asm_print_register (file, HARD_B_REGNUM);
}
else else
{ {
asm_print_register (file, REGNO (op)); asm_print_register (file, REGNO (op));
...@@ -3205,6 +3209,16 @@ m68hc11_gen_movhi (insn, operands) ...@@ -3205,6 +3209,16 @@ m68hc11_gen_movhi (insn, operands)
{ {
if (SP_REG_P (operands[0])) if (SP_REG_P (operands[0]))
output_asm_insn ("lds\t%1", operands); output_asm_insn ("lds\t%1", operands);
else if (!D_REG_P (operands[0])
&& GET_CODE (operands[1]) == CONST_INT
&& (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
&& find_reg_note (insn, REG_WAS_0, 0))
{
if (INTVAL (operands[1]) == 1)
output_asm_insn ("in%0", operands);
else
output_asm_insn ("de%0", operands);
}
else else
output_asm_insn ("ld%0\t%1", operands); output_asm_insn ("ld%0\t%1", operands);
} }
...@@ -3370,11 +3384,17 @@ m68hc11_gen_movhi (insn, operands) ...@@ -3370,11 +3384,17 @@ m68hc11_gen_movhi (insn, operands)
output_asm_insn ("xgdx", operands); output_asm_insn ("xgdx", operands);
CC_STATUS_INIT; CC_STATUS_INIT;
} }
else else if (!optimize_size)
{ {
output_asm_insn ("sty\t%t1", operands); output_asm_insn ("sty\t%t1", operands);
output_asm_insn ("ldx\t%t1", operands); output_asm_insn ("ldx\t%t1", operands);
} }
else
{
CC_STATUS_INIT;
output_asm_insn ("pshy", operands);
output_asm_insn ("pulx", operands);
}
} }
else if (SP_REG_P (operands[1])) else if (SP_REG_P (operands[1]))
{ {
...@@ -3382,6 +3402,15 @@ m68hc11_gen_movhi (insn, operands) ...@@ -3382,6 +3402,15 @@ m68hc11_gen_movhi (insn, operands)
cc_status = cc_prev_status; cc_status = cc_prev_status;
output_asm_insn ("tsx", operands); output_asm_insn ("tsx", operands);
} }
else if (GET_CODE (operands[1]) == CONST_INT
&& (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
&& find_reg_note (insn, REG_WAS_0, 0))
{
if (INTVAL (operands[1]) == 1)
output_asm_insn ("in%0", operands);
else
output_asm_insn ("de%0", operands);
}
else else
{ {
output_asm_insn ("ldx\t%1", operands); output_asm_insn ("ldx\t%1", operands);
...@@ -3412,11 +3441,17 @@ m68hc11_gen_movhi (insn, operands) ...@@ -3412,11 +3441,17 @@ m68hc11_gen_movhi (insn, operands)
output_asm_insn ("xgdy", operands); output_asm_insn ("xgdy", operands);
CC_STATUS_INIT; CC_STATUS_INIT;
} }
else else if (!optimize_size)
{ {
output_asm_insn ("stx\t%t1", operands); output_asm_insn ("stx\t%t1", operands);
output_asm_insn ("ldy\t%t1", operands); output_asm_insn ("ldy\t%t1", operands);
} }
else
{
CC_STATUS_INIT;
output_asm_insn ("pshx", operands);
output_asm_insn ("puly", operands);
}
} }
else if (SP_REG_P (operands[1])) else if (SP_REG_P (operands[1]))
{ {
...@@ -3424,7 +3459,16 @@ m68hc11_gen_movhi (insn, operands) ...@@ -3424,7 +3459,16 @@ m68hc11_gen_movhi (insn, operands)
cc_status = cc_prev_status; cc_status = cc_prev_status;
output_asm_insn ("tsy", operands); output_asm_insn ("tsy", operands);
} }
else else if (GET_CODE (operands[1]) == CONST_INT
&& (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
&& find_reg_note (insn, REG_WAS_0, 0))
{
if (INTVAL (operands[1]) == 1)
output_asm_insn ("in%0", operands);
else
output_asm_insn ("de%0", operands);
}
else
{ {
output_asm_insn ("ldy\t%1", operands); output_asm_insn ("ldy\t%1", operands);
} }
...@@ -3664,6 +3708,15 @@ m68hc11_gen_movqi (insn, operands) ...@@ -3664,6 +3708,15 @@ m68hc11_gen_movqi (insn, operands)
output_asm_insn ("ldab\t%T0", operands); output_asm_insn ("ldab\t%T0", operands);
} }
} }
else if (GET_CODE (operands[1]) == CONST_INT
&& (INTVAL (operands[1]) == 1 || INTVAL (operands[1]) == -1)
&& find_reg_note (insn, REG_WAS_0, 0))
{
if (INTVAL (operands[1]) == 1)
output_asm_insn ("inc%b0", operands);
else
output_asm_insn ("dec%b0", operands);
}
else if (!DB_REG_P (operands[1]) && !D_REG_P (operands[1]) else if (!DB_REG_P (operands[1]) && !D_REG_P (operands[1])
&& !DA_REG_P (operands[1])) && !DA_REG_P (operands[1]))
{ {
...@@ -4191,7 +4244,7 @@ m68hc11_check_z_replacement (insn, info) ...@@ -4191,7 +4244,7 @@ m68hc11_check_z_replacement (insn, info)
info->need_save_z = 0; info->need_save_z = 0;
info->found_call = 1; info->found_call = 1;
info->regno = SOFT_Z_REGNUM; info->regno = SOFT_Z_REGNUM;
info->last = insn; info->last = NEXT_INSN (insn);
} }
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment