From fe91bac51d53c711ce19edb8a1e66e5e9e97fd3b Mon Sep 17 00:00:00 2001 From: Stephane Carrez Date: Sun, 16 Mar 2003 22:26:04 +0100 Subject: [PATCH] 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 --- gcc/ChangeLog | 10 ++++++ gcc/config/m68hc11/m68hc11.c | 61 +++++++++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9fee3589340..49069bdc7cb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2003-03-16 Stephane Carrez + + * 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 PR optimization/9016 diff --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index ba4407b9f35..0794a3e5e65 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; } -- 2.30.2