[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] [php-src] jit-arm64: Improve code for MUL overflow detection (less instructions and less
From:       Dmitry Stogov <noreply () php ! net>
Date:       2021-04-29 22:26:47
Message-ID: ngmjmEktNdrJlB87nfSovDTbMU0g0WA1AqdpL1sRkE () main ! php ! net
[Download RAW message or body]

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

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic