[php-src] jit-arm64: Support for bitwise operations with non-integer arguments

From: Date: Tue, 20 Apr 2021 19:05:35 +0000
Subject: [php-src] jit-arm64: Support for bitwise operations with non-integer arguments
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-115714@lists.php.net to get a copy of this message
Author: Dmitry Stogov (dstogov) Date: 2021-04-20T20:19:56+03:00 Commit: https://github.com/php/php-src/commit/e83361b12f5ae2fae13716d3174bdba9618b11b6 Raw diff: https://github.com/php/php-src/commit/e83361b12f5ae2fae13716d3174bdba9618b11b6.diff Support for bitwise operations with non-integer arguments Changed paths: A ext/opcache/tests/jit/arm64/xor_003.phpt M ext/opcache/jit/zend_jit_arm64.dasc Diff: diff --git a/ext/opcache/jit/zend_jit_arm64.dasc b/ext/opcache/jit/zend_jit_arm64.dasc index 66f4abfc8ae2..47a69364a190 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -3647,7 +3647,46 @@ static int zend_jit_long_math_helper(dasm_State **Dst, |.cold_code } |6: - | NIY // TODO + if (Z_MODE(res_addr) == IS_REG) { + zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, res_var); + | LOAD_ZVAL_ADDR FCARG1x, real_addr + } else if (Z_REG(res_addr) != ZREG_FCARG1x || Z_OFFSET(res_addr) != 0) { + | LOAD_ZVAL_ADDR FCARG1x, res_addr + } + if (Z_MODE(op1_addr) == IS_REG) { + zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op1.var); + if (!zend_jit_spill_store(Dst, op1_addr, real_addr, op1_info, 1)) { + return 0; + } + op1_addr = real_addr; + } + | LOAD_ZVAL_ADDR FCARG2x, op1_addr + if (Z_MODE(op2_addr) == IS_REG) { + zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, op2.var); + if (!zend_jit_spill_store(Dst, op2_addr, real_addr, op2_info, 1)) { + return 0; + } + op2_addr = real_addr; + } + | LOAD_ZVAL_ADDR CARG3, op2_addr + | SET_EX_OPLINE opline, REG0 + if (opcode == ZEND_BW_OR) { + | EXT_CALL bitwise_or_function, REG0 + } else if (opcode == ZEND_BW_AND) { + | EXT_CALL bitwise_and_function, REG0 + } else if (opcode == ZEND_BW_XOR) { + | EXT_CALL bitwise_xor_function, REG0 + } else if (opcode == ZEND_SL) { + | EXT_CALL shift_left_function, REG0 + } else if (opcode == ZEND_SR) { + | EXT_CALL shift_right_function, REG0 + } else if (opcode == ZEND_MOD) { + | EXT_CALL mod_function, REG0 + } else { + ZEND_UNREACHABLE(); + } + | FREE_OP op1_type, op1, op1_info, 0, opline, ZREG_TMP1, ZREG_TMP2 + | FREE_OP op2_type, op2, op2_info, 0, opline, ZREG_TMP1, ZREG_TMP2 if (may_throw) { zend_jit_check_exception(Dst); } diff --git a/ext/opcache/tests/jit/arm64/xor_003.phpt b/ext/opcache/tests/jit/arm64/xor_003.phpt new file mode 100644 index 000000000000..9d0277b4b358 --- /dev/null +++ b/ext/opcache/tests/jit/arm64/xor_003.phpt @@ -0,0 +1,20 @@ +--TEST-- +JIT XOR: 003 +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=32M +;opcache.jit_debug=257 +--EXTENSIONS-- +opcache +--FILE-- +<?php +function foo($a, $b) { + $res = $a ^ $b; + var_dump($res); +} +foo("abc", "\001\002\003"); +?> +--EXPECT-- +string(3) "```"

« previous php.cvs (#115714) next »