diff options
author | Gustavo Frederico Temple Pedrosa <gustavo.pedrosa@eldorado.org.br> | 2014-12-11 17:48:41 +0000 |
---|---|---|
committer | Remi Collet <remi@php.net> | 2014-12-12 10:47:50 +0100 |
commit | fd045c7021cabe4462dd99611ab9d003adc203a5 (patch) | |
tree | 3b01c680f3882f9104acbdf537b038dda8e7c7ba /Zend/zend_operators.h | |
parent | 14e29f51460ecd1ec9ae7a26dfb9dcb2c81768d5 (diff) | |
download | php-git-fd045c7021cabe4462dd99611ab9d003adc203a5.tar.gz |
PowerPC64 support for operators with overflow check
This adds fast architecture-specific implementations of
the following functions for the ppc64:
* fast_increment_function
* fast_decrement_function
Diffstat (limited to 'Zend/zend_operators.h')
-rw-r--r-- | Zend/zend_operators.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index d7967c458a..c6d40b8f85 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -443,6 +443,33 @@ static zend_always_inline int fast_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 */ @@ -485,6 +512,33 @@ static zend_always_inline int fast_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 */ |