File tree 1 file changed +36
-1
lines changed
1 file changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -3351,7 +3351,42 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
3351
3351
|1:
3352
3352
}
3353
3353
} else if (opcode == ZEND_SR) {
3354
- | brk #0 // TODO
3354
+ | GET_ZVAL_LVAL result_reg, op1_addr, TMP1
3355
+ if (Z_MODE(op2_addr) == IS_CONST_ZVAL) {
3356
+ zend_long op2_lval = Z_LVAL_P(Z_ZV(op2_addr));
3357
+
3358
+ if (UNEXPECTED((zend_ulong)op2_lval >= SIZEOF_ZEND_LONG * 8)) {
3359
+ if (EXPECTED(op2_lval > 0)) {
3360
+ | asr Rx(result_reg), Rx(result_reg), #((SIZEOF_ZEND_LONG * 8) - 1)
3361
+ } else {
3362
+ | SET_EX_OPLINE opline, REG0
3363
+ | b ->negative_shift
3364
+ }
3365
+ } else {
3366
+ | mov TMP1w, #op2_lval
3367
+ | asr Rx(result_reg), Rx(result_reg), TMP1
3368
+ }
3369
+ } else {
3370
+ if (Z_MODE(op2_addr) != IS_REG || Z_REG(op2_addr) != ZREG_REG1) {
3371
+ | GET_ZVAL_LVAL ZREG_REG1, op2_addr, TMP1
3372
+ }
3373
+ if (!op2_range ||
3374
+ op2_range->min < 0 ||
3375
+ op2_range->max >= SIZEOF_ZEND_LONG * 8) {
3376
+ | cmp REG1, #(SIZEOF_ZEND_LONG*8)
3377
+ | bhs >1
3378
+ |.cold_code
3379
+ |1:
3380
+ | cmp REG1, xzr
3381
+ | mov REG1w, #((SIZEOF_ZEND_LONG * 8) - 1)
3382
+ | bgt >1
3383
+ | SET_EX_OPLINE opline, REG0
3384
+ | b ->negative_shift
3385
+ |.code
3386
+ }
3387
+ |1:
3388
+ | asr Rx(result_reg), Rx(result_reg), REG1
3389
+ }
3355
3390
} else if (opcode == ZEND_MOD) {
3356
3391
| brk #0 // TODO
3357
3392
} else if (same_ops) {
You can’t perform that action at this time.
0 commit comments