aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephane Carrez <stcarrez@nerim.fr>2003-03-16 22:26:04 +0100
committerStephane Carrez <ciceron@gcc.gnu.org>2003-03-16 22:26:04 +0100
commitfe91bac51d53c711ce19edb8a1e66e5e9e97fd3b (patch)
tree173d737559cdd50359b14aae379463178964234d
parentddc67067146f2783f386e61f880d6fe87fb324a3 (diff)
downloadgcc-fe91bac51d53c711ce19edb8a1e66e5e9e97fd3b.zip
gcc-fe91bac51d53c711ce19edb8a1e66e5e9e97fd3b.tar.gz
gcc-fe91bac51d53c711ce19edb8a1e66e5e9e97fd3b.tar.bz2
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
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/config/m68hc11/m68hc11.c61
2 files changed, 67 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9fee358..49069bdc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c
index ba4407b..0794a3e 100644
--- a/gcc/config/m68hc11/m68hc11.c
+++ b/gcc/config/m68hc11/m68hc11.c
@@ -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;
}