Re: cln cvs, cl_low_div.cc and mulu32_64
Hi! Thank you, Sven, for sending a patch. I'm talking this to the mailing list. (Since I'll start traveling in a couple of hours and come back next year.) There seems to be some confusion about the CLN version you're having. You say that you're using CLN 1.1.13. But your patch looks more like it is for CLN-1.2 from CVS HEAD, not for the CLN-1.1 branch. I've only had a quick glance at your patch. What is __arch64__ and why is __sparc64__ not defined? Regards -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/> Sven Verdoolaege wrote:
On Thu, Dec 21, 2006 at 12:50:21AM +0100, Sven Verdoolaege wrote:
I was trying to compile cln 1.1.13 on a sparc and I ran into some problems, so I thought I'd try the cvs version. I'm using gmp 4.2.1 (64 bits) and gcc 4.1.1
After fixing a couple of problems (see below), I'm stuck with this one:
/bin/sh ../libtool --mode=compile g++ -m64 -mptr64 -I/home/verdoolaege/solaris-5.9-gcc-4.1.1/include/ -I../include -I../include -I./base -c ./base/low/cl_low_div.cc g++ -m64 -mptr64 -I/home/verdoolaege/solaris-5.9-gcc-4.1.1/include/ -I../include -I../include -I./base -c ./base/low/cl_low_div.cc -fPIC -DPIC -o .libs/cl_low_div.o ./base/low/cl_low_div.cc: In function 'uint64 cln::divu_6464_6464_(uint64, uint64)': ./base/low/cl_low_div.cc:262: error: 'mulu32_64' was not declared in this scope
It seems you introduced this in your patch from Wed Mar 22 21:45:15 2006 +0000. mulu32_64 doesn't appear to be defined anywhere, neither in the current version nor in the version of that date:
I'm assuming this should be mulu32_w.
I now finally got cln compiled with the patch below, but now the exam test segfaults:
Program received signal SIGSEGV, Segmentation fault. 0xffffffff7edae178 in cln::cl_inc_pointer_refcount (pointer=0x0) at ../include/cln/object.h:205 205 pointer->refcount++; (gdb) bt #0 0xffffffff7edae178 in cln::cl_inc_pointer_refcount (pointer=0x0) at ../include/cln/object.h:205 #1 0xffffffff7edced28 in cln::cl_gcobject::inc_pointer_refcount ( this=0xffffffff7f052e58) at ../include/cln/object.h:317 #2 0xffffffff7edd716c in cln::cl_gcobject::_as_cl_private_thing ( this=0xffffffff7f052e58) at ../include/cln/object.h:501 #3 0xffffffff7ede06b4 in cln::as_cl_private_thing (x=@0xffffffff7f052e58) at ../include/cln/object.h:506 #4 0xffffffff7ee1d6ec in cl_DF (this=0xffffffff7f053400, x=@0xffffffff7f052e58) at ../include/cln/dfloat_class.h:61 #5 0xffffffff7ed10924 in cln::cl_I_to_DF (x=@0xffffffff7fffda88) at float/dfloat/elem/cl_DF_from_I.cc:34 #6 0xffffffff7ed10db8 in cln::cl_RA_to_DF (x=@0xffffffff7fffda88) at float/dfloat/elem/cl_DF_from_RA.cc:36 #7 0xffffffff7ed8f538 in __static_initialization_and_destruction_0 ( __initialize_p=1, __priority=65535) at real/format-output/cl_fmt_scaleexp.cc:50 #8 0xffffffff7ed8f8f0 in global constructors keyed to _ZN3cln21format_scale_exponentERKNS_4cl_FE () at real/format-output/cl_fmt_scaleexp.cc:117 #9 0xffffffff7ed9d9c0 in __do_global_ctors_aux () at /solapplic/gcc-4.1.1/lib/gcc/sparc-sun-solaris2.9/4.1.1/../../../../include/c++/4.1.1/iostream:76 #10 0xffffffff7ec7feb4 in _init () from /home/verdoolaege/solaris-5.9-gcc-4.1.1/lib//libcln.so.5 #11 0xffffffff7f612398 in call_init () from /lib/sparcv9/ld.so.1 #12 0xffffffff7f611844 in setup () from /lib/sparcv9/ld.so.1 #13 0xffffffff7f620a8c in _setup () from /lib/sparcv9/ld.so.1 #14 0xffffffff7f605480 in _alias_start () from /lib/sparcv9/ld.so.1 #15 0xffffffff7f605480 in _alias_start () from /lib/sparcv9/ld.so.1 Previous frame identical to this frame (corrupt stack?)
skimo
diff --git a/include/cln/types.h b/include/cln/types.h index 067411e..d46aaee 100644 --- a/include/cln/types.h +++ b/include/cln/types.h @@ -48,7 +48,7 @@ #undef HAVE_LONGLONG #endif #endif - #if defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__x86_64__)) + #if defined(HAVE_LONGLONG) && (defined(__alpha__) || defined(__ia64__) || defined(__mips64__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__x86_64__) || defined(__arch64__)) // 64 bit registers in hardware #define HAVE_FAST_LONGLONG #endif diff --git a/src/base/cl_low.h b/src/base/cl_low.h index 46485b9..226a448 100644 --- a/src/base/cl_low.h +++ b/src/base/cl_low.h @@ -439,7 +439,7 @@ inline uint32 mulu32_unchecked (uint32 a __asm__ __volatile__ ( \ "wr %%g0,%%g0,%%y\n\t" \ "udiv %2,%3,%0\n\t" \ - "umul %0,%3,%1" \ + "umul %0,%3,%1\n\t" \ "sub %2,%1,%1" \ : "=&r" (__q), "=&r" (__r) \ : "r" (__x), "r" (__y)); \ @@ -528,7 +528,7 @@ inline uint32 mulu32_unchecked (uint32 a __asm__ __volatile__ ( \ "wr %%g0,%%g0,%%y\n\t" \ "udiv %2,%3,%0\n\t" \ - "umul %0,%3,%1" \ + "umul %0,%3,%1\n\t" \ "sub %2,%1,%1" \ : "=&r" (__q), "=&r" (__r) \ : "r" (__x), "r" (__y)); \ @@ -578,7 +578,7 @@ inline uint32 mulu32_unchecked (uint32 a __asm__ __volatile__ ( \ "wr %%g0,%%g0,%%y\n\t" \ "udiv %2,%3,%0\n\t" \ - "umul %0,%3,%1" \ + "umul %0,%3,%1\n\t" \ "sub %2,%1,%1" \ : "=&r" (__q), "=&r" (__r) \ : "r" (__x), "r" (__y)); \ @@ -690,7 +690,7 @@ inline uint32 mulu32_unchecked (uint32 a __asm__ __volatile__ ( \ "wr %2,%%g0,%%y\n\t" \ "udiv %3,%4,%0\n\t" \ - "umul %0,%4,%1" \ + "umul %0,%4,%1\n\t" \ "sub %3,%1,%1" \ : "=&r" (__q), "=&r" (__r) \ : "r" (__xhi), "r" (__xlo), "r" (__y)); \ @@ -791,7 +791,7 @@ inline uint32 mulu32_unchecked (uint32 a __asm__ __volatile__ ( \ "wr %2,%%g0,%%y\n\t" \ "udiv %3,%4,%0\n\t" \ - "umul %0,%4,%1" \ + "umul %0,%4,%1\n\t" \ "sub %3,%1,%1" \ : "=&r" (__q), "=&r" (__r) \ : "r" (__xhi), "r" (__xlo), "r" (__y)); \ diff --git a/src/base/digitseq/cl_asm_sparc64_.cc b/src/base/digitseq/cl_asm_sparc64_.cc index e4acced..7936327 100644 --- a/src/base/digitseq/cl_asm_sparc64_.cc +++ b/src/base/digitseq/cl_asm_sparc64_.cc @@ -40,6 +40,8 @@ #define ret jmp %i7+8 // return from subroutine #define retl jmp %o7+8 // return from leaf subroutine (no save/restore)
+ .register %g2,#scratch + .seg "text"
.global C(mulu16_),C(mulu32_),C(mulu32_unchecked),C(mulu64_) diff --git a/src/base/digitseq/cl_asm_sparc_.cc b/src/base/digitseq/cl_asm_sparc_.cc index aac70ae..965ac0c 100644 --- a/src/base/digitseq/cl_asm_sparc_.cc +++ b/src/base/digitseq/cl_asm_sparc_.cc @@ -39,6 +39,8 @@ #define ret jmp %i7+8 // return from subroutine #define retl jmp %o7+8 // return from leaf subroutine (no save/restore)
+ .register %g2,#scratch + .seg "text"
.global C(mulu16_),C(mulu32_),C(mulu32_unchecked) diff --git a/src/base/low/cl_low_div.cc b/src/base/low/cl_low_div.cc index f631a51..64e8c36 100644 --- a/src/base/low/cl_low_div.cc +++ b/src/base/low/cl_low_div.cc @@ -259,9 +259,9 @@ uint64 divu_6464_6464_(uint64 x, uint64 } // q = floor(x1/(y1+1)) // x-q*y bilden (eine 32-mal-64-Bit-Multiplikation ohne Überlauf): - x -= highlow64_0(mulu32_64(q,high32(y))); // q * high32(y) * beta + x -= highlow64_0(mulu32_w(q,high32(y))); // q * high32(y) * beta // gefahrlos, da q*high32(y) <= q*y/beta <= x/beta < beta - x -= mulu32_64(q,low32(y)); // q * low32(y) + x -= mulu32_w(q,low32(y)); // q * low32(y) // gefahrlos, da q*high32(y)*beta + q*low32(y) = q*y <= x // Noch höchstens 2 mal y abziehen: if (x >= y) diff --git a/src/polynomial/elem/cl_UP_GF2.h b/src/polynomial/elem/cl_UP_GF2.h index fa2c5b1..f3c9936 100644 --- a/src/polynomial/elem/cl_UP_GF2.h +++ b/src/polynomial/elem/cl_UP_GF2.h @@ -95,7 +95,7 @@ static const _cl_UP gf2_uminus (cl_heap_ return x; }
-#if !(defined(__sparc__) || defined(__sparc64__)) +#if (intDsize==64) // Multiplication of polynomials over GF(2) can unfortunately not profit // from hardware multiply instructions. Use a table instead. // This is a 2^8 x 2^4 table. Maybe a 2^6 x 2^6 table would be better?
On Thu, Dec 21, 2006 at 10:51:33PM +0100, Richard B. Kreckel wrote:
Hi!
Thank you, Sven, for sending a patch.
Well, don't thank me yet, because I only made it to compile so far and not actually run....
I'm talking this to the mailing list. (Since I'll start traveling in a couple of hours and come back next year.)
There seems to be some confusion about the CLN version you're having. You say that you're using CLN 1.1.13. But your patch looks more like it is for CLN-1.2 from CVS HEAD, not for the CLN-1.1 branch.
Yes. Sorry for not being clear about that. My patch is against this commit (from a cvsimport to git): commit 41d512525f170280a1746f478334ffadb75d9fbb Author: haible <haible> Date: Tue Dec 19 14:50:43 2006 +0000 Avoid using undeclared function exit().
I've only had a quick glance at your patch. What is __arch64__ and why is __sparc64__ not defined?
I've no idea. bash-2.04$ uname -a SunOS zeta 5.9 Generic_118558-30 sun4u sparc SUNW,Sun-Fire-V890 bash-2.04$ cpp --version cpp (GCC) 4.1.1 Copyright (C) 2006 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. bash-2.04$ echo | cpp -E -dM -m64 -mptr64 #define __DBL_MIN_EXP__ (-1021) #define __FLT_MIN__ 1.17549435e-38F #define __CHAR_BIT__ 8 #define __WCHAR_MAX__ 2147483647 #define __DBL_DENORM_MIN__ 4.9406564584124654e-324 #define __FLT_EVAL_METHOD__ 0 #define __DBL_MIN_10_EXP__ (-307) #define __FINITE_MATH_ONLY__ 0 #define __GNUC_PATCHLEVEL__ 1 #define sparc 1 #define __SHRT_MAX__ 32767 #define __LDBL_MAX__ 1.18973149535723176508575932662800702e+4932L #define __UINTMAX_TYPE__ long unsigned int #define __unix 1 #define __LDBL_MAX_EXP__ 16384 #define __SCHAR_MAX__ 127 #define __USER_LABEL_PREFIX__ #define __STDC_HOSTED__ 1 #define __LDBL_HAS_INFINITY__ 1 #define __DBL_DIG__ 15 #define __FLT_EPSILON__ 1.19209290e-7F #define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L #define __unix__ 1 #define __DECIMAL_DIG__ 36 #define __LDBL_HAS_QUIET_NAN__ 1 #define __GNUC__ 4 #define __DBL_MAX__ 1.7976931348623157e+308 #define __DBL_HAS_INFINITY__ 1 #define __SVR4 1 #define __DBL_MAX_EXP__ 1024 #define __LONG_LONG_MAX__ 9223372036854775807LL #define __sparc__ 1 #define __GXX_ABI_VERSION 1002 #define __FLT_MIN_EXP__ (-125) #define __DBL_MIN__ 2.2250738585072014e-308 #define __LP64__ 1 #define __DBL_HAS_QUIET_NAN__ 1 #define __sun 1 #define __REGISTER_PREFIX__ #define __NO_INLINE__ 1 #define __sparcv9 1 #define __FLT_MANT_DIG__ 24 #define __VERSION__ "4.1.1" #define __sparc 1 #define sun 1 #define unix 1 #define __SIZE_TYPE__ long unsigned int #define __ELF__ 1 #define __FLT_RADIX__ 2 #define __LDBL_EPSILON__ 1.92592994438723585305597794258492732e-34L #define __LDBL_DIG__ 33 #define __FLT_HAS_QUIET_NAN__ 1 #define __FLT_MAX_10_EXP__ 38 #define __LONG_MAX__ 9223372036854775807L #define __FLT_HAS_INFINITY__ 1 #define __PRAGMA_REDEFINE_EXTNAME 1 #define __LDBL_MANT_DIG__ 113 #define __WCHAR_TYPE__ int #define __FLT_DIG__ 6 #define __INT_MAX__ 2147483647 #define __FLT_MAX_EXP__ 128 #define __DBL_MANT_DIG__ 53 #define __WINT_TYPE__ int #define __LDBL_MIN_EXP__ (-16381) #define __LDBL_MAX_10_EXP__ 4932 #define __DBL_EPSILON__ 2.2204460492503131e-16 #define _LP64 1 #define __sun__ 1 #define __svr4__ 1 #define __INTMAX_MAX__ 9223372036854775807L #define __FLT_DENORM_MIN__ 1.40129846e-45F #define __FLT_MAX__ 3.40282347e+38F #define __FLT_MIN_10_EXP__ (-37) #define __INTMAX_TYPE__ long int #define __GNUC_MINOR__ 1 #define __DBL_MAX_10_EXP__ 308 #define __LDBL_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966L #define __PTRDIFF_TYPE__ long int #define __arch64__ 1 #define __LDBL_MIN_10_EXP__ (-4931) skimo
participants (2)
-
Richard B. Kreckel
-
Sven Verdoolaege