x86-64 fixes: Part 2
Andreas Jaeger
aj@suse.de
Thu, 24 Oct 2002 14:37:59 +0200
The appended patch fixes some compile problems in longlong.h for
x86-64:
- The feature macro is __x86_64__
- Correctly implement the count*zeroes (they generated wrong code with
size mismatches)
Andreas
diff -ur gmp-4.1/longlong.h /suse/aj/gmp-4.1/longlong.h
--- gmp-4.1/longlong.h Tue May 21 01:33:57 2002
+++ /suse/aj/gmp-4.1/longlong.h Sun Sep 29 11:39:53 2002
@@ -685,7 +685,7 @@
#endif
#endif /* 80x86 */
-#if defined (__x86_64) && W_TYPE_SIZE == 64
+#if defined (__x86_64__) && W_TYPE_SIZE == 64
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addq %5,%1\n\tadcq %3,%0" \
: "=r" ((UDItype)(sh)), "=&r" ((UDItype)(sl)) \
@@ -706,15 +706,17 @@
: "0" ((UDItype)(n0)), "1" ((UDItype)(n1)), "rm" ((UDItype)(dx)))
#define count_leading_zeros(count, x) \
do { \
- USItype __cbtmp; \
+ UWtype __cbtmp; \
ASSERT ((x) != 0); \
- __asm__ ("bsrq %1,%0" : "=r" (__cbtmp) : "rm" ((USItype)(x))); \
+ __asm__ ("bsrq %1,%0" : "=r" (__cbtmp) : "rm" ((UWtype)(x))); \
(count) = __cbtmp ^ 63; \
} while (0)
#define count_trailing_zeros(count, x) \
do { \
+ UWtype __cbtmp; \
ASSERT ((x) != 0); \
- __asm__ ("bsfq %1,%0" : "=r" (count) : "rm" ((USItype)(x))); \
+ __asm__ ("bsfq %1,%0" : "=r" (__cbtmp) : "rm" ((UWtype)(x))); \
+ (count) = __cbtmp; \
} while (0)
#endif /* x86_64 */
--
Andreas Jaeger
SuSE Labs aj@suse.de
private aj@arthur.inka.de
http://www.suse.de/~aj