@@ -3972,11 +3972,19 @@ static int zend_jit_math_long_long(dasm_State **Dst,
3972
3972
IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op1_addr))) &&
3973
3973
is_power_of_two(Z_LVAL_P(Z_ZV(op1_addr)))))) {
3974
3974
if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
3975
- | GET_ZVAL_LVAL result_reg, op1_addr
3976
- | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
3975
+ if (Z_MODE(op1_addr) == IS_REG && Z_LVAL_P(Z_ZV(op2_addr)) == 2) {
3976
+ | lea Ra(result_reg), [Ra(Z_REG(op1_addr))+Ra(Z_REG(op1_addr))]
3977
+ } else {
3978
+ | GET_ZVAL_LVAL result_reg, op1_addr
3979
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op2_addr)))
3980
+ }
3977
3981
} else {
3978
- | GET_ZVAL_LVAL result_reg, op2_addr
3979
- | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op1_addr)))
3982
+ if (Z_MODE(op2_addr) == IS_REG && Z_LVAL_P(Z_ZV(op1_addr)) == 2) {
3983
+ | lea Ra(result_reg), [Ra(Z_REG(op2_addr))+Ra(Z_REG(op2_addr))]
3984
+ } else {
3985
+ | GET_ZVAL_LVAL result_reg, op2_addr
3986
+ | shl Ra(result_reg), floor_log2(Z_LVAL_P(Z_ZV(op1_addr)))
3987
+ }
3980
3988
}
3981
3989
} else if (opcode == ZEND_DIV &&
3982
3990
(Z_MODE(op2_addr) == IS_CONST_ZVAL &&
@@ -4593,6 +4601,8 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
4593
4601
| SAVE_VALID_OPLINE opline, r0
4594
4602
| jmp ->negative_shift
4595
4603
}
4604
+ } else if (Z_MODE(op1_addr) == IS_REG && op2_lval == 1) {
4605
+ | lea Ra(result_reg), [Ra(Z_REG(op1_addr))+Ra(Z_REG(op1_addr))]
4596
4606
} else {
4597
4607
| GET_ZVAL_LVAL result_reg, op1_addr
4598
4608
| shl Ra(result_reg), op2_lval
0 commit comments