Skip to content

Commit 62e0b83

Browse files
committed
JIT/x86: Reuse code when MOD is going to be converted to AND.
1 parent 0ce2359 commit 62e0b83

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15276,6 +15276,7 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1527615276
op2_info = OP2_INFO();
1527715277
if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
1527815278
!(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
15279+
bw_op:
1527915280
regset = ZEND_REGSET_EMPTY;
1528015281
if (ssa_op->result_def != current_var &&
1528115282
(ssa_op->op1_use != current_var || !last_use)) {
@@ -15291,25 +15292,15 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1529115292
op2_info = OP2_INFO();
1529215293
if (!(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG)) &&
1529315294
!(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-MAY_BE_LONG))) {
15294-
regset = ZEND_REGSET_EMPTY;
1529515295
if (opline->op2_type == IS_CONST &&
1529615296
Z_TYPE_P(RT_CONSTANT(opline, opline->op2)) == IS_LONG &&
1529715297
zend_long_is_power_of_two(Z_LVAL_P(RT_CONSTANT(opline, opline->op2))) &&
1529815298
OP1_HAS_RANGE() &&
1529915299
OP1_MIN_RANGE() >= 0) {
15300-
if (ssa_op->result_def != current_var &&
15301-
(ssa_op->op1_use != current_var || !last_use)) {
15302-
ZEND_REGSET_INCL(regset, ZREG_R0);
15303-
}
15304-
if (sizeof(void*) == 8
15305-
&& !IS_SIGNED_32BIT(Z_LVAL_P(RT_CONSTANT(opline, opline->op2)) - 1)) {
15306-
if (!ZEND_REGSET_IN(regset, ZREG_R0)) {
15307-
ZEND_REGSET_INCL(regset, ZREG_R0);
15308-
} else {
15309-
ZEND_REGSET_INCL(regset, ZREG_R1);
15310-
}
15311-
}
15300+
/* MOD is going to be optimized into AND */
15301+
goto bw_op;
1531215302
} else {
15303+
regset = ZEND_REGSET_EMPTY;
1531315304
ZEND_REGSET_INCL(regset, ZREG_R0);
1531415305
ZEND_REGSET_INCL(regset, ZREG_R2);
1531515306
if (opline->op2_type == IS_CONST) {

0 commit comments

Comments
 (0)