From: David Carlier Date: Tue, 28 Nov 2017 20:37:53 +0000 (+0000) Subject: Add configure check for asm goto support X-Git-Tag: php-7.3.0alpha1~924 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e0b3c0c4c27cddcff6013a2c408597bbe87d2d5;p=php Add configure check for asm goto support asm goto is not supported by couple of systems. To make sure it does, we can check it at configure-time. --- diff --git a/Zend/zend_operators.h b/Zend/zend_operators.h index 44ef072862..30c758118d 100644 --- a/Zend/zend_operators.h +++ b/Zend/zend_operators.h @@ -464,7 +464,7 @@ ZEND_API void zend_update_current_locale(void); static zend_always_inline void fast_long_increment_function(zval *op1) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(HAVE_ASM_GOTO) && defined(__i386__) __asm__ goto( "incl (%0)\n\t" "jo %l1\n" @@ -475,7 +475,7 @@ static zend_always_inline void fast_long_increment_function(zval *op1) return; overflow: ZEND_ATTRIBUTE_COLD_LABEL ZVAL_DOUBLE(op1, (double)ZEND_LONG_MAX + 1.0); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__) __asm__ goto( "incq (%0)\n\t" "jo %l1\n" @@ -514,7 +514,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL static zend_always_inline void fast_long_decrement_function(zval *op1) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(HAVE_ASM_GOTO) && defined(__i386__) __asm__ goto( "decl (%0)\n\t" "jo %l1\n" @@ -525,7 +525,7 @@ static zend_always_inline void fast_long_decrement_function(zval *op1) return; overflow: ZEND_ATTRIBUTE_COLD_LABEL ZVAL_DOUBLE(op1, (double)ZEND_LONG_MIN - 1.0); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__) __asm__ goto( "decq (%0)\n\t" "jo %l1\n" @@ -564,7 +564,7 @@ overflow: ZEND_ATTRIBUTE_COLD_LABEL static zend_always_inline void fast_long_add_function(zval *result, zval *op1, zval *op2) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(HAVE_ASM_GOTO) && defined(__i386__) __asm__ goto( "movl (%1), %%eax\n\t" "addl (%2), %%eax\n\t" @@ -582,7 +582,7 @@ static zend_always_inline void fast_long_add_function(zval *result, zval *op1, z return; overflow: ZEND_ATTRIBUTE_COLD_LABEL ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) + (double) Z_LVAL_P(op2)); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__) __asm__ goto( "movq (%1), %%rax\n\t" "addq (%2), %%rax\n\t" @@ -654,7 +654,7 @@ static zend_always_inline int fast_add_function(zval *result, zval *op1, zval *o static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, zval *op2) { -#if defined(__GNUC__) && defined(__i386__) +#if defined(HAVE_ASM_GOTO) && defined(__i386__) __asm__ goto( "movl (%1), %%eax\n\t" "subl (%2), %%eax\n\t" @@ -672,7 +672,7 @@ static zend_always_inline void fast_long_sub_function(zval *result, zval *op1, z return; overflow: ZEND_ATTRIBUTE_COLD_LABEL ZVAL_DOUBLE(result, (double) Z_LVAL_P(op1) - (double) Z_LVAL_P(op2)); -#elif defined(__GNUC__) && defined(__x86_64__) +#elif defined(HAVE_ASM_GOTO) && defined(__x86_64__) __asm__ goto( "movq (%1), %%rax\n\t" "subq (%2), %%rax\n\t" diff --git a/configure.ac b/configure.ac index 6ba8b798bf..afe1eddc1c 100644 --- a/configure.ac +++ b/configure.ac @@ -753,6 +753,20 @@ if test "x$php_crypt_r" = "x1"; then PHP_CRYPT_R_STYLE fi +dnl Check for asm goto support +AC_CACHE_CHECK([for asm goto], ac_cv__asm_goto, +[AC_TRY_RUN([ +int main(void) { + __asm__ goto("jmp %l0\n" :::: end); +end: + return 0; +} + ],ac_cv__asm_goto=yes, ac_cv__asm_goto=no, ac_cv__asm_goto=no)]) + +if test "$ac_cv__asm_goto" = yes; then + AC_DEFINE(HAVE_ASM_GOTO,1,[Define if asm goto support]) +fi + PHP_CHECK_VALGRIND dnl General settings.