Skip to content

Commit

Permalink
Improve register allocator (register reuse)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstogov committed Oct 20, 2020
1 parent ea15909 commit 5e17d88
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -4430,6 +4430,8 @@ static int zend_jit_math_double_double(dasm_State **Dst,
result_reg = Z_REG(res_addr);
} else if (Z_MODE(op1_addr) == IS_REG && Z_LAST_USE(op1_addr)) {
result_reg = Z_REG(op1_addr);
} else if (zend_is_commutative(opcode) && Z_MODE(op2_addr) == IS_REG && Z_LAST_USE(op2_addr)) {
result_reg = Z_REG(op2_addr);
} else {
result_reg = ZREG_XMM0;
}
Expand Down Expand Up @@ -15279,7 +15281,8 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
}
if ((op1_info & MAY_BE_DOUBLE) && (op2_info & MAY_BE_DOUBLE)) {
if (ssa_op->result_def != current_var &&
(ssa_op->op1_use != current_var || !last_use)) {
(ssa_op->op1_use != current_var || !last_use) &&
(!zend_is_commutative(opline->opcode) || ssa_op->op2_use != current_var || !last_use)) {
ZEND_REGSET_INCL(regset, ZREG_XMM0);
}
}
Expand Down

0 comments on commit 5e17d88

Please sign in to comment.