[php-src] jit-arm64: Support for bitwise operations with the same operands ($a ^ $a)

From: Date: Tue, 20 Apr 2021 19:05:34 +0000
Subject: [php-src] jit-arm64: Support for bitwise operations with the same operands ($a ^ $a)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-115713@lists.php.net to get a copy of this message
Author: Dmitry Stogov (dstogov) Date: 2021-04-20T19:48:57+03:00 Commit: https://github.com/php/php-src/commit/81460c03b04d7ba544b4584abf4c00efaead7a46 Raw diff: https://github.com/php/php-src/commit/81460c03b04d7ba544b4584abf4c00efaead7a46.diff Support for bitwise operations with the same operands ($a ^ $a) Changed paths: A ext/opcache/tests/jit/arm64/xor_002.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 3211b80a5b0d..66f4abfc8ae2 100644 --- a/ext/opcache/jit/zend_jit_arm64.dasc +++ b/ext/opcache/jit/zend_jit_arm64.dasc @@ -753,8 +753,29 @@ static void* dasm_labels[zend_lb_MAX]; || } |.endmacro -|.macro LONG_MATH_REG, opcode, dst_reg, src_reg -| NIY // TODO +|.macro LONG_MATH_REG, opcode, dst_reg, src_reg1, src_reg2 +|| switch (opcode) { +|| case ZEND_ADD: +| adds dst_reg, src_reg1, src_reg2 +|| break; +|| case ZEND_SUB: +| subs dst_reg, src_reg1, src_reg2 +|| break; +|| case ZEND_MUL: +| NIY // LONG_OP imul, reg, addr +|| break; +|| case ZEND_BW_OR: +| orr dst_reg, src_reg1, src_reg2 +|| break; +|| case ZEND_BW_AND: +| and dst_reg, src_reg1, src_reg2 +|| break; +|| case ZEND_BW_XOR: +| eor dst_reg, src_reg1, src_reg2 +|| break; +|| default: +|| ZEND_UNREACHABLE(); +|| } |.endmacro // In x86 implementation, argument 'lval' of SET_ZVAL_LVAL can be either a LONG constant @@ -3601,7 +3622,8 @@ static int zend_jit_long_math_helper(dasm_State **Dst, } } } else if (same_ops) { - | NIY // TODO + | GET_ZVAL_LVAL result_reg, op1_addr, TMP1 + | LONG_MATH_REG opcode, Rx(result_reg), Rx(result_reg), Rx(result_reg) } else { | GET_ZVAL_LVAL result_reg, op1_addr, TMP1 | LONG_MATH opcode, result_reg, op2_addr, TMP1, TMP2 diff --git a/ext/opcache/tests/jit/arm64/xor_002.phpt b/ext/opcache/tests/jit/arm64/xor_002.phpt new file mode 100644 index 000000000000..2f8ff8461300 --- /dev/null +++ b/ext/opcache/tests/jit/arm64/xor_002.phpt @@ -0,0 +1,20 @@ +--TEST-- +JIT XOR: 002 +--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($var) { + $res = $var ^ $var; + var_dump($res); +} +foo(5); +?> +--EXPECT-- +int(0)

« previous php.cvs (#115713) next »