summaryrefslogtreecommitdiff
path: root/longlong.h
diff options
context:
space:
mode:
authortege <tege@gmplib.org>2008-02-27 15:13:32 +0100
committertege <tege@gmplib.org>2008-02-27 15:13:32 +0100
commite829d3fdc0c6e866799e3d1cd10ccf11cd52dbc3 (patch)
tree6170d122f4e66e6e78a39ee526a1b79041db6e20 /longlong.h
parent062ffb5c58049a5d401d46436aa2b4731c7d54d1 (diff)
downloadgmp-e829d3fdc0c6e866799e3d1cd10ccf11cd52dbc3.tar.gz
(umul_ppmm) [alpha]: Define using __builtin_alpha_umulh when possible.
(count_trailing_zeros): Force destination register mode.
Diffstat (limited to 'longlong.h')
-rw-r--r--longlong.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/longlong.h b/longlong.h
index 369170ddd..4ae8d3988 100644
--- a/longlong.h
+++ b/longlong.h
@@ -54,8 +54,8 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
/* Define auxiliary asm macros.
- 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand) multiplies two
- UWtype integers MULTIPLER and MULTIPLICAND, and generates a two UWtype
+ 1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two
+ UWtype integers MULTIPLIER and MULTIPLICAND, and generates a two UWtype
word product in HIGH_PROD and LOW_PROD.
2) __umulsidi3(a,b) multiplies two UWtype integers A and B, and returns a
@@ -175,6 +175,14 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
#if defined (__alpha) && W_TYPE_SIZE == 64
/* Most alpha-based machines, except Cray systems. */
#if defined (__GNUC__)
+#if __GMP_GNUC_PREREQ (3,3)
+#define umul_ppmm(ph, pl, m0, m1) \
+ do { \
+ UDItype __m0 = (m0), __m1 = (m1); \
+ (ph) = __builtin_alpha_umulh (__m0, __m1); \
+ (pl) = __m0 * __m1; \
+ } while (0)
+#else
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
@@ -183,6 +191,7 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
: "%rJ" (m0), "rI" (m1)); \
(pl) = __m0 * __m1; \
} while (0)
+#endif
#define UMUL_TIME 18
#else /* ! __GNUC__ */
#include <machine/builtins.h>
@@ -782,7 +791,7 @@ extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
#define count_trailing_zeros(count, x) \
do { \
ASSERT ((x) != 0); \
- __asm__ ("bsfl %1,%0" : "=r" (count) : "rm" ((USItype)(x))); \
+ __asm__ ("bsfl %1,%k0" : "=r" (count) : "rm" ((USItype)(x))); \
} while (0)
#endif /* asm bsfl */