Skip to content

Commit 66826f6

Browse files
authored
JIT/AArch64: Use D registers for floating-point operations (#7080)
In AArch64, 32 registers, i.e. v0~v31, can be used by the SIMD and floating-point operations. [1][2] In PHP the floating-point operations use 64-bit DOUBLE type, and SIMD operations are not supported currently. Hence we can use D registers directly. Note that "ZREG_V*" is kept to denote the register index. [1] https://developer.arm.com/documentation/den0024/a/ARMv8-Registers/NEON-and-floating-point-registers/Scalar-register-sizes [2] https://github.com/ARM-software/abi-aa/blob/2bcab1e3b22d55170c563c3c7940134089176746/aapcs64/aapcs64.rst#612simd-and-floating-point-registers Change-Id: I286ce07a49e837b560e3401c742ec91fc561546b
1 parent 7c2a3a9 commit 66826f6

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@
5757
|.define REG1w, w9
5858
|.define REG2, x10
5959
|.define REG2w, w10
60-
|.define FPR0, v0
61-
|.define FPR1, v1
62-
|.define FPR0d, d0
63-
|.define FPR1d, d1
60+
|.define FPR0, d0
61+
|.define FPR1, d1
6462

6563
|.define ZREG_REG0, ZREG_X8
6664
|.define ZREG_REG1, ZREG_X9
@@ -75,8 +73,7 @@
7573
|.define TMP2w, w16
7674
|.define TMP3, x17 // TODO: remember about hard-coded: mrs TMP3, tpidr_el0
7775
|.define TMP3w, w17
78-
|.define FPTMP, v16
79-
|.define FPTMPd, d16
76+
|.define FPTMP, d16
8077

8178
|.define ZREG_TMP1, ZREG_X15
8279
|.define ZREG_TMP2, ZREG_X16
@@ -167,10 +164,10 @@ const char* zend_reg_name[] = {
167164
"x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
168165
"x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23",
169166
"x24", "x25", "x26", "x27", "x28", "x29", "x30", "sp",
170-
"v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
171-
"v8", "v9", "v10", "v11", "v12", "v13", "v14", "v15",
172-
"v16", "v17", "v18", "v19", "v20", "v21", "v22", "v23",
173-
"v24", "v25", "v26", "v27", "v28", "v29", "v30", "v31"
167+
"d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
168+
"d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
169+
"d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
170+
"d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31"
174171
};
175172

176173
#ifdef HAVE_GCC_GLOBAL_REGS
@@ -3909,13 +3906,13 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, uint32_t op
39093906
if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
39103907
uint64_t val = 0x3ff0000000000000; // 1.0
39113908
| LOAD_64BIT_VAL TMP1, val
3912-
| fmov FPTMPd, TMP1
3913-
| fadd Rd(tmp_reg-ZREG_V0), Rd(tmp_reg-ZREG_V0), FPTMPd
3909+
| fmov FPTMP, TMP1
3910+
| fadd Rd(tmp_reg-ZREG_V0), Rd(tmp_reg-ZREG_V0), FPTMP
39143911
} else {
39153912
uint64_t val = 0x3ff0000000000000; // 1.0
39163913
| LOAD_64BIT_VAL TMP1, val
3917-
| fmov FPTMPd, TMP1
3918-
| fsub Rd(tmp_reg-ZREG_V0), Rd(tmp_reg-ZREG_V0), FPTMPd
3914+
| fmov FPTMP, TMP1
3915+
| fsub Rd(tmp_reg-ZREG_V0), Rd(tmp_reg-ZREG_V0), FPTMP
39193916
}
39203917
| SET_ZVAL_DVAL op1_def_addr, tmp_reg, ZREG_TMP1
39213918
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
@@ -8088,7 +8085,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
80888085

80898086
if ((op1_info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
80908087
| mov TMP1, xzr
8091-
| fmov FPR0d, TMP1
8088+
| fmov FPR0, TMP1
80928089
| DOUBLE_CMP ZREG_FPR0, op1_addr, ZREG_TMP1, ZREG_FPTMP
80938090

80948091
if (set_bool) {

0 commit comments

Comments
 (0)