[php-src] jit-arm64: Improve code for MUL overflow detection (less instructions and less

From: Date: Thu, 29 Apr 2021 22:26:47 +0000
Subject: [php-src] jit-arm64: Improve code for MUL overflow detection (less instructions and less
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-115971@lists.php.net to get a copy of this message
Author: Dmitry Stogov (dstogov) Date: 2021-04-30T01:25:41+03:00 Commit: https://github.com/php/php-src/commit/1e59a8dae9d4ca77896cec241115356a6ca1f99e Raw diff: https://github.com/php/php-src/commit/1e59a8dae9d4ca77896cec241115356a6ca1f99e.diff Improve code for MUL overflow detection (less instructions and less temporary registers) Changed paths: 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 45164929f379..afb486b3e7e0 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -3903,9 +3903,9 @@ static int zend_jit_math_long_long(dasm_State **Dst, | NIY // TODO: test #endif } else if (opcode == ZEND_MUL) { - | GET_ZVAL_LVAL ZREG_TMP2, op1_addr, TMP1 - | GET_ZVAL_LVAL ZREG_TMP3, op2_addr, TMP1 - | mul Rx(result_reg), TMP2, TMP3 + | GET_ZVAL_LVAL ZREG_TMP1, op1_addr, TMP1 + | GET_ZVAL_LVAL ZREG_TMP2, op2_addr, TMP2 + | mul Rx(result_reg), TMP1, TMP2 if(may_overflow) { /* Use 'smulh' to get the upper 64 bits fo the 128-bit result. * For signed multiplication, the top 65 bits of the result will contain @@ -3915,9 +3915,8 @@ static int zend_jit_math_long_long(dasm_State **Dst, * Flag: bne -> overflow. beq -> no overflow. */ use_ovf_flag = 0; - | smulh TMP1, TMP2, TMP3 - | asr TMP2, Rx(result_reg), #63 - | cmp TMP1, TMP2 + | smulh TMP1, TMP1, TMP2 + | cmp TMP1, Rx(result_reg), asr #63 } } else { | GET_ZVAL_LVAL result_reg, op1_addr, TMP1

« previous php.cvs (#115971) next »