@@ -670,6 +670,16 @@ static int logical_immediate_p (uint64_t value, uint32_t reg_size)
670
670
|| }
671
671
|.endmacro
672
672
673
+ |.macro ADD_IP_SHIFT, val, shift, tmp_reg
674
+ || if (GCC_GLOBAL_REGS) {
675
+ | add IP, IP, val, shift
676
+ || } else {
677
+ | ldr tmp_reg, EX->opline
678
+ | add tmp_reg, tmp_reg, val, shift
679
+ | str tmp_reg, EX->opline
680
+ || }
681
+ |.endmacro
682
+
673
683
|.macro ADD_IP_FROM_CST, val, tmp_reg
674
684
|| ZEND_ASSERT(val >=0 && val <= ADD_SUB_IMM);
675
685
|| if (GCC_GLOBAL_REGS) {
@@ -1926,8 +1936,7 @@ static int zend_jit_undefined_offset_stub(dasm_State **Dst)
1926
1936
| ldrb REG1w, OP:REG0->op2_type
1927
1937
| cmp REG1w, #IS_CONST
1928
1938
| bne >2
1929
- | ldr REG1w, OP:REG0->op2.constant
1930
- | sxtw REG1, REG1w
1939
+ | ldrsw REG1, OP:REG0->op2.constant
1931
1940
| add REG0, REG0, REG1
1932
1941
| b >3
1933
1942
|2:
@@ -1964,8 +1973,7 @@ static int zend_jit_undefined_index_stub(dasm_State **Dst)
1964
1973
| ldrb REG1w, OP:REG0->op2_type
1965
1974
| cmp REG1w, #IS_CONST
1966
1975
| bne >2
1967
- | ldr REG1w, OP:REG0->op2.constant
1968
- | sxtw REG1, REG1w
1976
+ | ldrsw REG1, OP:REG0->op2.constant
1969
1977
| add REG0, REG0, REG1
1970
1978
| b >3
1971
1979
|2:
@@ -2019,8 +2027,7 @@ static int zend_jit_undefined_function_stub(dasm_State **Dst)
2019
2027
| ldr REG0, EX->opline
2020
2028
| mov CARG1, xzr
2021
2029
| LOAD_ADDR CARG2, "Call to undefined function %s()"
2022
- | ldr CARG3w, [REG0, #offsetof(zend_op, op2.constant)]
2023
- | sxtw CARG3, CARG3w
2030
+ | ldrsw CARG3, [REG0, #offsetof(zend_op, op2.constant)]
2024
2031
| ldr CARG3, [REG0, CARG3]
2025
2032
| add CARG3, CARG3, #offsetof(zend_string, val)
2026
2033
| EXT_CALL zend_throw_error, REG0
@@ -4939,14 +4946,11 @@ static int zend_jit_fetch_dimension_address_inner(dasm_State **Dst, const zend_o
4939
4946
if (val >= 0) {
4940
4947
| ldr REG0, [FCARG1x, #offsetof(zend_array, arData)]
4941
4948
if (val != 0) {
4942
- | LOAD_64BIT_VAL TMP1, val * sizeof(Bucket)
4943
- | add REG0, REG0, TMP1
4949
+ | ADD_SUB_64_WITH_CONST add, REG0, REG0, (val * sizeof(Bucket)), TMP1
4944
4950
}
4945
4951
} else {
4946
- | mov REG0, FCARG2x
4947
- | lsl REG0, REG0, #5
4948
4952
| ldr TMP1, [FCARG1x, #offsetof(zend_array, arData)]
4949
- | add REG0, REG0, TMP1
4953
+ | add REG0, TMP1, FCARG2x, lsl #5
4950
4954
}
4951
4955
}
4952
4956
}
@@ -8257,9 +8261,8 @@ static int zend_jit_push_call_frame(dasm_State **Dst, const zend_op *opline, con
8257
8261
| ldr TMP1w, [REG0, #offsetof(zend_closure, func.op_array.T)]
8258
8262
| sub REG2w, REG2w, TMP1w
8259
8263
}
8260
- | lsl REG2w, REG2w, #5
8261
8264
| sxtw REG2, REG2w
8262
- | sub FCARG1x, FCARG1x, REG2
8265
+ | sub FCARG1x, FCARG1x, REG2, lsl #5
8263
8266
|1:
8264
8267
}
8265
8268
@@ -9469,8 +9472,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
9469
9472
| // opline += num_args;
9470
9473
|| ZEND_ASSERT(sizeof(zend_op) == 32);
9471
9474
| mov REG2w, REG1w
9472
- | lsl REG2, REG2, #5
9473
- | ADD_IP REG2, TMP1
9475
+ | ADD_IP_SHIFT REG2, lsl #5, TMP1
9474
9476
}
9475
9477
|1:
9476
9478
| // if (EXPECTED((int)num_args < op_array->last_var)) {
@@ -9482,8 +9484,7 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
9482
9484
| subs REG2w, REG2w, REG1w
9483
9485
| ble >3
9484
9486
| // zval *var = EX_VAR_NUM(num_args);
9485
- | lsl REG1, REG1, #4
9486
- | add REG1, REG1, FP
9487
+ | add REG1, FP, REG1, lsl #4
9487
9488
|| ZEND_ASSERT(ZEND_CALL_FRAME_SLOT * sizeof(zval) <= ADD_SUB_IMM);
9488
9489
| add REG1, REG1, #(ZEND_CALL_FRAME_SLOT * sizeof(zval))
9489
9490
|2:
@@ -11783,8 +11784,7 @@ static int zend_jit_bind_global(dasm_State **Dst, const zend_op *opline, uint32_
11783
11784
| sub REG0, REG0, #1
11784
11785
| // if (EXPECTED(idx < EG(symbol_table).nNumUsed * sizeof(Bucket)))
11785
11786
| MEM_LOAD_32_ZTS ldr, REG1w, executor_globals, symbol_table.nNumUsed, REG1
11786
- | lsl REG1, REG1, #5
11787
- | cmp REG0, REG1
11787
+ | cmp REG0, REG1, lsl #5
11788
11788
| bhs >9
11789
11789
| // Bucket *p = (Bucket*)((char*)EG(symbol_table).arData + idx);
11790
11790
| MEM_LOAD_ZTS ldr, TMP1, executor_globals, symbol_table.arData, REG1
@@ -13791,8 +13791,7 @@ static int zend_jit_switch(dasm_State **Dst, const zend_op *opline, const zend_o
13791
13791
| bhs =>default_b
13792
13792
}
13793
13793
| adr REG0, >4
13794
- | lsl TMP1, FCARG2x, #3
13795
- | ldr TMP1, [REG0, TMP1]
13794
+ | ldr TMP1, [REG0, FCARG2x, lsl #3]
13796
13795
| br TMP1
13797
13796
13798
13797
|.jmp_table
@@ -14132,9 +14131,8 @@ static int zend_jit_fe_fetch(dasm_State **Dst, const zend_op *opline, uint32_t o
14132
14131
| // p = fe_ht->arData + pos;
14133
14132
|| ZEND_ASSERT(sizeof(Bucket) == 32);
14134
14133
| mov FCARG2w, REG0w
14135
- | lsl FCARG2x, FCARG2x, #5
14136
14134
| ldr TMP1, [FCARG1x, #offsetof(zend_array, arData)]
14137
- | add FCARG2x, FCARG2x, TMP1
14135
+ | add FCARG2x, TMP1, FCARG2x, lsl #5
14138
14136
|1:
14139
14137
| // if (UNEXPECTED(pos >= fe_ht->nNumUsed)) {
14140
14138
| ldr TMP1w, [FCARG1x, #offsetof(zend_array, nNumUsed)]
0 commit comments