Add hint to reuse register in ZEXT/SEXT

This commit is contained in:
Dmitry Stogov 2023-02-15 18:33:02 +03:00
parent d07a2db592
commit c7e2cca534
2 changed files with 7 additions and 4 deletions

View File

@ -513,8 +513,7 @@ int ir_compute_live_ranges(ir_ctx *ctx)
/* We add two uses to emulate move from op1 to res */
ir_add_use(ctx, ctx->vregs[ref], 0, IR_DEF_LIVE_POS_FROM_REF(ref), reg, def_flags, 0);
def_pos = IR_LOAD_LIVE_POS_FROM_REF(ref);
if (!IR_IS_CONST_REF(insn->op1)) {
IR_ASSERT(ctx->vregs[insn->op1]);
if (!IR_IS_CONST_REF(insn->op1) && ctx->vregs[insn->op1]) {
hint_ref = insn->op1;
}
} else if (def_flags & IR_DEF_CONFLICTS_WITH_INPUT_REGS) {

View File

@ -814,8 +814,6 @@ cmp_fp:
flags = IR_DEF_REUSES_OP1_REG | IR_USE_MUST_BE_IN_REG | IR_OP1_MUST_BE_IN_REG | IR_OP2_SHOULD_BE_IN_REG;
break;
case IR_SHIFT_CONST:
case IR_COPY_INT:
case IR_COPY_FP:
case IR_INC:
case IR_DEC:
case IR_MUL_PWR2:
@ -825,6 +823,12 @@ cmp_fp:
case IR_OP_FP:
flags = IR_DEF_REUSES_OP1_REG | IR_USE_MUST_BE_IN_REG | IR_OP1_MUST_BE_IN_REG;
break;
case IR_COPY_INT:
case IR_COPY_FP:
case IR_SEXT:
case IR_ZEXT:
flags = IR_DEF_REUSES_OP1_REG | IR_USE_MUST_BE_IN_REG | IR_OP1_SHOULD_BE_IN_REG;
break;
case IR_ABS_INT:
flags = IR_DEF_CONFLICTS_WITH_INPUT_REGS | IR_USE_MUST_BE_IN_REG | IR_OP1_MUST_BE_IN_REG;
break;