com php-src: Improve performance of PowerPC64 fast_long_inc rement_function: Zend/zend_operators.h

From: Date: Tue, 28 Jul 2015 16:38:23 +0000
Subject: com php-src: Improve performance of PowerPC64 fast_long_inc rement_function: Zend/zend_operators.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-88211@lists.php.net to get a copy of this message
Commit: 4d578f28df214c5faf115d3a629f9ffe82640b2b Author: Anton Blanchard <anton@samba.org> Tue, 26 May 2015 23:06:12 +1000 Committer: Remi Collet <remi@php.net> Tue, 28 Jul 2015 18:38:23 +0200 Parents: 305199a13163e246b909ef32880df032823bff05 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4d578f28df214c5faf115d3a629f9ffe82640b2b Log: Improve performance of PowerPC64 fast_long_increment_function Detecting overflow with the XER is slow, partially because we have to clear it before use. gcc does a better job of detecting overflow of an increment or decrement than we can with inline assembly. It knows that an increment will only overflow if it is one less than the overflow value. This means we end up with a simple compare/branch. Furthermore, leaving it in c allows gcc to schedule the instructions better. This is 6% faster on a POWER8 running a simple testcase: <?php function testcase($count = 100000000) { $x = 1; for ($i = 0; $i < $count; $i++) { $x++; $x++; $x++; $x++; $x++; } } testcase(); ?> Changed paths: M Zend/zend_operators.h Diff: diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 21bf9dd..7e4fdcc 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -460,33 +460,6 @@ static zend_always_inline void fast_long_increment_function(zval *op1) "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "cc"); -#elif defined(__GNUC__) && defined(__powerpc64__) - __asm__( - "ld 14, 0(%0)\n\t" - "li 15, 1\n\t" - "li 16, 0\n\t" - "mtxer 16\n\t" - "addo. 14, 14, 15\n\t" - "std 14, 0(%0)\n\t" - "bns+ 0f\n\t" - "xor 14, 14, 14\n\t" - "lis 15, 0x43e00000@h\n\t" - "ori 15, 15, 0x43e00000@l\n\t" -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - "stw 14, 0(%0)\n\t" - "stw 15, 0x4(%0)\n\t" -#else - "stw 14, 0x4(%0)\n\t" - "stw 15, 0(%0)\n\t" -#endif - "li 14, %1\n\t" - "stw 14, %c2(%0)\n" - "0:" - : - : "r"(&op1->value), - "n"(IS_DOUBLE), - "n"(ZVAL_OFFSETOF_TYPE) - : "r14", "r15", "r16", "cc"); #else if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MAX)) { /* switch to double */ @@ -525,33 +498,6 @@ static zend_always_inline void fast_long_decrement_function(zval *op1) "n"(IS_DOUBLE), "n"(ZVAL_OFFSETOF_TYPE) : "cc"); -#elif defined(__GNUC__) && defined(__powerpc64__) - __asm__( - "ld 14, 0(%0)\n\t" - "li 15, 1\n\t" - "li 16, 0\n\t" - "mtxer 16\n\t" - "subo. 14, 14, 15\n\t" - "std 14, 0(%0)\n\t" - "bns+ 0f\n\t" - "xor 14, 14, 14\n\t" - "lis 15, 0xc3e00000@h\n\t" - "ori 15, 15, 0xc3e00000@l\n\t" -#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ - "stw 14, 0(%0)\n\t" - "stw 15, 0x4(%0)\n\t" -#else - "stw 14, 0x4(%0)\n\t" - "stw 15, 0(%0)\n\t" -#endif - "li 14, %1\n\t" - "stw 14, %c2(%0)\n" - "0:" - : - : "r"(&op1->value), - "n"(IS_DOUBLE), - "n"(ZVAL_OFFSETOF_TYPE) - : "r14", "r15", "r16", "cc"); #else if (UNEXPECTED(Z_LVAL_P(op1) == ZEND_LONG_MIN)) { /* switch to double */

« previous php.cvs (#88211) next »