Skip to content

Commit 6d038c0

Browse files
committed
Support failed JIT test case: shift_left_002.phpt
This patch handles the case where the second operand is constant.
1 parent 426e74b commit 6d038c0

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

+14-1
Original file line numberDiff line numberDiff line change
@@ -3313,7 +3313,20 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
33133313
if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
33143314
zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
33153315

3316-
| brk #0 // TODO
3316+
if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
3317+
if (EXPECTED(op2_lval > 0)) {
3318+
| mov Rx(result_reg), xzr
3319+
} else {
3320+
| SET_EX_OPLINE opline, REG0
3321+
| b ->negative_shift
3322+
}
3323+
} else if (Z_MODE(op1_addr) == IS_REG && op2_lval == 1) {
3324+
| add Rx(result_reg), Rx(Z_REG(op1_addr)), Rx(Z_REG(op1_addr))
3325+
} else {
3326+
| GET_ZVAL_LVAL result_reg, op1_addr, TMP1
3327+
| mov TMP1w, #op2_lval
3328+
| lsl Rx(result_reg), Rx(result_reg), TMP1
3329+
}
33173330
} else {
33183331
if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_REG1) {
33193332
| GET_ZVAL_LVAL ZREG_REG1, op2_addr, TMP1

0 commit comments

Comments
 (0)