mirror of
https://github.com/php/php-src.git
synced 2025-01-22 11:44:09 +08:00
PowerPC64 support in long multiplication
In long integer multiplications, avoid casting both operands to long double and use an inline assembly-based overflow checking function instead.
This commit is contained in:
parent
d04685732e
commit
87e0802a99
@ -84,6 +84,24 @@
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#elif defined(__powerpc64__) && defined(__GNUC__)
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
long __tmpvar; \
|
||||
__asm__("li 14, 0\n\t" \
|
||||
"mtxer 14\n\t" \
|
||||
"mulldo. %0, %2,%3\n\t" \
|
||||
"xor %1, %1, %1\n\t" \
|
||||
"bns+ 0f\n\t" \
|
||||
"li %1, 1\n\t" \
|
||||
"0:\n" \
|
||||
: "=r"(__tmpvar),"=r"(usedval) \
|
||||
: "r"(a), "r"(b) \
|
||||
: "r14", "cc"); \
|
||||
if (usedval) (dval) = (double) (a) * (double) (b); \
|
||||
else (lval) = __tmpvar; \
|
||||
} while (0)
|
||||
|
||||
#elif SIZEOF_ZEND_LONG == 4
|
||||
|
||||
#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \
|
||||
|
Loading…
Reference in New Issue
Block a user