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
This commit is contained in:
Stephane Carrez 2003-03-16 22:26:04 +01:00 committed by Stephane Carrez
parent ddc6706714
commit fe91bac51d
2 changed files with 67 additions and 4 deletions

View File

@ -1,3 +1,13 @@
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>
PR optimization/9016

View File

@ -2154,6 +2154,10 @@ print_operand (file, op, letter)
asm_print_register (file, REGNO (op));
fprintf (file, "+1");
}
else if (letter == 'b' && D_REG_P (op))
{
asm_print_register (file, HARD_B_REGNUM);
}
else
{
asm_print_register (file, REGNO (op));
@ -3205,6 +3209,16 @@ m68hc11_gen_movhi (insn, operands)
{
if (SP_REG_P (operands[0]))
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
output_asm_insn ("ld%0\t%1", operands);
}
@ -3370,11 +3384,17 @@ m68hc11_gen_movhi (insn, operands)
output_asm_insn ("xgdx", operands);
CC_STATUS_INIT;
}
else
else if (!optimize_size)
{
output_asm_insn ("sty\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]))
{
@ -3382,6 +3402,15 @@ m68hc11_gen_movhi (insn, operands)
cc_status = cc_prev_status;
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
{
output_asm_insn ("ldx\t%1", operands);
@ -3412,11 +3441,17 @@ m68hc11_gen_movhi (insn, operands)
output_asm_insn ("xgdy", operands);
CC_STATUS_INIT;
}
else
else if (!optimize_size)
{
output_asm_insn ("stx\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]))
{
@ -3424,7 +3459,16 @@ m68hc11_gen_movhi (insn, operands)
cc_status = cc_prev_status;
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);
}
@ -3664,6 +3708,15 @@ m68hc11_gen_movqi (insn, 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])
&& !DA_REG_P (operands[1]))
{
@ -4191,7 +4244,7 @@ m68hc11_check_z_replacement (insn, info)
info->need_save_z = 0;
info->found_call = 1;
info->regno = SOFT_Z_REGNUM;
info->last = insn;
info->last = NEXT_INSN (insn);
}
return 0;
}