Browse Source

* src/float/base/cl_ieee.cc: try to do magic to the FPU only if

_FPU_IEEE is really defined.
        * include/cln/modules.h: change assembler labels from `label' to
          `label:' on hppa, needed by Linux (see comment).
        * autoconf/acinclude.m4: new file (for storing CLN-specific macros).
        * Makefile.devel: adjusted.
        * autoconf/aclocal.m4: regenerate.
        * src/base/low/cl_low_mul.cc: moved POD variables that are declared
          extern "C" elsewhere out of the namespace.
        * src/base/low/cl_low_div.cc: Likewise.
master
Richard Kreckel 24 years ago
parent
commit
fbb507f3fd
  1. 13
      ChangeLog
  2. 15
      Makefile.devel
  3. 41
      autoconf/acinclude.m4
  4. 124
      autoconf/aclocal.m4
  5. 6
      include/cln/modules.h
  6. 11
      src/base/low/cl_low_div.cc
  7. 11
      src/base/low/cl_low_mul.cc
  8. 27
      src/float/base/cl_ieee.cc

13
ChangeLog

@ -1,3 +1,16 @@
2000-07-22 Richard Kreckel <kreckel@ginac.de>
* src/float/base/cl_ieee.cc: try to do magic to the FPU only if
_FPU_IEEE is really defined.
* include/cln/modules.h: change assembler labels from `label' to
`label:' on hppa, needed by Linux (see comment).
* autoconf/acinclude.m4: new file (for storing CLN-specific macros).
* Makefile.devel: adjusted.
* autoconf/aclocal.m4: regenerate.
* src/base/low/cl_low_mul.cc: moved POD variables that are declared
extern "C" elsewhere out of the namespace.
* src/base/low/cl_low_div.cc: Likewise.
2000-06-08 Bruno Haible <haible@clisp.cons.org> 2000-06-08 Bruno Haible <haible@clisp.cons.org>
* autoconf/config.{guess,sub}: Update to GNU version 2001-05-11. * autoconf/config.{guess,sub}: Update to GNU version 2001-05-11.

15
Makefile.devel

@ -26,15 +26,12 @@ configures : $(CONFIGURES)
configure : configure.in $(AUTOCONF_FILES) configure : configure.in $(AUTOCONF_FILES)
./autoconf/autoconf -m autoconf ./autoconf/autoconf -m autoconf
# # ACLOCAL = /home/bruno/clisp/src/autoconf/aclocal.m4
# # ACSELECT = /home/bruno/clisp/src/autoconf/acselect
# # OTHERMACROS = /home/bruno/clisp/src/autoconf/libtool.m4
# ACLOCAL = /home/kreckel/contrib/src/clisp/src/autoconf/aclocal.m4
# ACSELECT = /home/kreckel/contrib/src/clisp/src/autoconf/acselect
# OTHERMACROS = /home/kreckel/contrib/src/clisp/src/autoconf/libtool.m4
#
# autoconf/aclocal.m4 : $(ACLOCAL)
# ($(ACSELECT) `cat $(CONFIGURES_IN) | grep '^[A-Z][A-Z]_' | sed 's,[^A-Z_].*$$,,g' | sort | uniq` < $(ACLOCAL) ; cat $(OTHERMACROS) | sed -e 's,AC_CANONICAL_HOST,CL_CANONICAL_HOST,g' -e 's,AC_PROG_RANLIB,CL_PROG_RANLIB,g') > autoconf/aclocal.m4
CLISP_ACLOCAL = /home/kreckel/contrib/src/clisp/src/autoconf/aclocal.m4
ACSELECT = /home/kreckel/contrib/src/clisp/src/autoconf/acselect
LIBTOOLMACROS = /home/kreckel/contrib/libtool/libtool.m4
autoconf/aclocal.m4 : $(CLISP_ACLOCAL)
($(ACSELECT) `cat $(CONFIGURES_IN) | grep '^[A-Z][A-Z]_' | sed 's,[^A-Z_].*$$,,g' | sort | uniq` < $(CLISP_ACLOCAL) ; cat $(LIBTOOLMACROS) | sed -e 's,AC_CANONICAL_HOST,CL_CANONICAL_HOST,g' -e 's,AC_PROG_RANLIB,CL_PROG_RANLIB,g'; cat autoconf/acinclude.m4) > autoconf/aclocal.m4
# Syntaxcheck # Syntaxcheck
check-configures : $(CONFIGURES) check-configures : $(CONFIGURES)

41
autoconf/acinclude.m4

@ -0,0 +1,41 @@
# Is the gmp header file new enough? (should be implemented with an argument)
AC_DEFUN(CL_GMP_H_VERSION,
[AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
AC_TRY_CPP([#include <gmp.h>
#if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
#error "ancient gmp.h"
#endif],
cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
])])dnl
# Does libgmp provide some functionality introduced in version 3.0?
AC_DEFUN(CL_GMP_CHECK,
[AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
SAVELIBS=$LIBS
LIBS="$LIBS -lgmp"
AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
])])
# What is sizeof(mp_limb_t)? (It has to match sizeof(uintD) later.)
AC_DEFUN(CL_GMP_SET_UINTD,
[AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [
AC_TRY_RUN([#include <stdio.h>
#include <gmp.h>
int main() {
FILE *f=fopen("conftestval", "w");
if (!f) return(1);
if (sizeof(mp_limb_t) > sizeof(long))
fprintf(f, "long long");
else if (sizeof(mp_limb_t) == sizeof(long))
fprintf(f, "long");
else if (sizeof(mp_limb_t) == sizeof(int))
fprintf(f, "int");
else return(1);
return(0);
}], cl_cv_gmp_set_uintd=`cat conftestval`; \
cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`";
AC_DEFINE_UNQUOTED($cl_gmp_demands),
AC_MSG_ERROR([CLN can't handle the result]),dnl
AC_MSG_ERROR([cross-compiling - cannot determine]))
])])

124
autoconf/aclocal.m4

@ -1,8 +1,8 @@
dnl local autoconf macros dnl local autoconf macros
dnl Bruno Haible 21.9.1997
dnl Marcus Daniels 10.4.1997
dnl Bruno Haible 2001-02-04
dnl Marcus Daniels 1997-04-10
dnl dnl
AC_PREREQ(2.13)dnl
AC_PREREQ(2.12)dnl
dnl dnl
dnl without AC_MSG_...: with AC_MSG_... and caching: dnl without AC_MSG_...: with AC_MSG_... and caching:
dnl AC_TRY_CPP CL_CPP_CHECK dnl AC_TRY_CPP CL_CPP_CHECK
@ -207,13 +207,13 @@ AC_DEFUN(CL_CANONICAL_HOST,
[AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS]) [AC_REQUIRE([AC_PROG_CC]) dnl Actually: AC_REQUIRE([CL_CC_WORKS])
dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it. dnl Set ac_aux_dir before the cache check, because AM_PROG_LIBTOOL needs it.
ac_aux_dir=${srcdir}/$1 ac_aux_dir=${srcdir}/$1
AC_CACHE_CHECK(host system type, cl_cv_host, [
dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh. dnl A substitute for AC_CONFIG_AUX_DIR_DEFAULT, so we don't need install.sh.
ac_config_guess=$ac_aux_dir/config.guess ac_config_guess=$ac_aux_dir/config.guess
ac_config_sub=$ac_aux_dir/config.sub ac_config_sub=$ac_aux_dir/config.sub
AC_CACHE_CHECK(host system type, cl_cv_host, [
dnl Mostly copied from AC_CANONICAL_HOST. dnl Mostly copied from AC_CANONICAL_HOST.
# Make sure we can run config.sub. # Make sure we can run config.sub.
if $ac_config_sub sun4 >/dev/null 2>&1; then :
if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
else AC_MSG_ERROR(can not run $ac_config_sub) else AC_MSG_ERROR(can not run $ac_config_sub)
fi fi
host_alias=$host host_alias=$host
@ -221,18 +221,21 @@ case "$host_alias" in
NONE) NONE)
case $nonopt in case $nonopt in
NONE) dnl config.guess needs to compile things NONE) dnl config.guess needs to compile things
host_alias=`export CC; $ac_config_guess` ;;
host_alias=`export CC; ${CONFIG_SHELL-/bin/sh} $ac_config_guess` ;;
*) host_alias=$nonopt ;; *) host_alias=$nonopt ;;
esac ;; esac ;;
esac esac
# Don't fail just because the system is not listed in GNU's database. # Don't fail just because the system is not listed in GNU's database.
if test -n "$host_alias"; then if test -n "$host_alias"; then
host=`$ac_config_sub $host_alias`
host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
else else
host_alias=unknown
host=unknown-unknown-unknown host=unknown-unknown-unknown
fi fi
cl_cv_host_alias="$host_alias"
cl_cv_host="$host" cl_cv_host="$host"
]) ])
host_alias="$cl_cv_host_alias"
host="$cl_cv_host" host="$cl_cv_host"
changequote(,)dnl changequote(,)dnl
host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
@ -243,6 +246,10 @@ AC_SUBST(host)dnl
AC_SUBST(host_cpu)dnl AC_SUBST(host_cpu)dnl
AC_SUBST(host_vendor)dnl AC_SUBST(host_vendor)dnl
AC_SUBST(host_os)dnl AC_SUBST(host_os)dnl
dnl We have defined $ac_aux_dir.
AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
dnl We have defined $host_alias and $host.
AC_PROVIDE([AC_CANONICAL_HOST])dnl
])dnl ])dnl
dnl dnl
AC_DEFUN(CL_CANONICAL_HOST_CPU, AC_DEFUN(CL_CANONICAL_HOST_CPU,
@ -649,7 +656,14 @@ cat > conftest.$ac_ext <<EOF
#include "confdefs.h" #include "confdefs.h"
EOF EOF
cat "$cl_machine_file_c" >> conftest.$ac_ext cat "$cl_machine_file_c" >> conftest.$ac_ext
ORIGCC="$CC"
if test $ac_cv_prog_gcc = yes; then
# gcc -O (gcc version <= 2.3.2) crashes when compiling long long shifts for
# target 80386. Strip "-O".
CC=`echo "$CC " | sed -e 's/-O //g'`
fi
AC_TRY_EVAL(ac_link) AC_TRY_EVAL(ac_link)
CC="$ORIGCC"
if test -s conftest; then if test -s conftest; then
echo "creating $cl_machine_file_h" echo "creating $cl_machine_file_h"
./conftest > conftest.h ./conftest > conftest.h
@ -671,50 +685,6 @@ echo "cross-compiling - cannot create $cl_machine_file_h"
fi fi
])dnl ])dnl
dnl dnl
# Is the gmp header file new enough? (should be implemented with an argument)
AC_DEFUN(CL_GMP_H_VERSION,
[AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
AC_TRY_CPP([#include <gmp.h>
#if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
#error "ancient gmp.h"
#endif],
cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
])])dnl
# Does libgmp provide some functionality introduced in version 3.0?
AC_DEFUN(CL_GMP_CHECK,
[AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
SAVELIBS=$LIBS
LIBS="$LIBS -lgmp"
AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
])])
# What is sizeof(mp_limb_t)? (It has to match sizeof(uintD) later.)
AC_DEFUN(CL_GMP_SET_UINTD,
[AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [
AC_TRY_RUN([#include <stdio.h>
#include <gmp.h>
int main() {
FILE *f=fopen("conftestval", "w");
if (!f) return(1);
if (sizeof(mp_limb_t) > sizeof(long))
fprintf(f, "long long");
else if (sizeof(mp_limb_t) == sizeof(long))
fprintf(f, "long");
else if (sizeof(mp_limb_t) == sizeof(int))
fprintf(f, "int");
else return(1);
return(0);
}], cl_cv_gmp_set_uintd=`cat conftestval`; \
cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`";
AC_DEFINE_UNQUOTED($cl_gmp_demands),
AC_MSG_ERROR([CLN can't handle the result]),dnl
AC_MSG_ERROR([cross-compiling - cannot determine]))
])])
# =============================================================================
# libtool.m4 - Configure libtool for the host system. -*-Shell-script-*- # libtool.m4 - Configure libtool for the host system. -*-Shell-script-*-
## Copyright 1996, 1997, 1998, 1999, 2000, 2001 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001
## Free Software Foundation, Inc. ## Free Software Foundation, Inc.
@ -739,9 +709,6 @@ int main() {
## configuration script generated by Autoconf, you may include it under ## configuration script generated by Autoconf, you may include it under
## the same distribution terms that you use for the rest of that program. ## the same distribution terms that you use for the rest of that program.
# The next line was added by Bruno Haible 2001-06-08.
undefine([symbols])
# serial 46 AC_PROG_LIBTOOL # serial 46 AC_PROG_LIBTOOL
AC_DEFUN([AC_PROG_LIBTOOL], AC_DEFUN([AC_PROG_LIBTOOL],
[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl [AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
@ -762,7 +729,7 @@ AC_DEFUN([AC_LIBTOOL_SETUP],
AC_REQUIRE([AC_ENABLE_SHARED])dnl AC_REQUIRE([AC_ENABLE_SHARED])dnl
AC_REQUIRE([AC_ENABLE_STATIC])dnl AC_REQUIRE([AC_ENABLE_STATIC])dnl
AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([CL_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl
AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_PROG_LD])dnl AC_REQUIRE([AC_PROG_LD])dnl
@ -877,7 +844,7 @@ AC_DEFUN(_LT_AC_CHECK_DLFCN,
# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
# --------------------------------- # ---------------------------------
AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
[AC_REQUIRE([AC_CANONICAL_HOST])
[AC_REQUIRE([CL_CANONICAL_HOST])
AC_REQUIRE([AC_PROG_NM]) AC_REQUIRE([AC_PROG_NM])
AC_REQUIRE([AC_OBJEXT]) AC_REQUIRE([AC_OBJEXT])
# Check for command to grab the raw symbol name followed by C symbol from nm. # Check for command to grab the raw symbol name followed by C symbol from nm.
@ -3735,7 +3702,7 @@ AC_DEFUN([AC_PROG_LD],
[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], [ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_CC])dnl
AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([CL_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld ac_prog=ld
if test "$GCC" = yes; then if test "$GCC" = yes; then
@ -4035,7 +4002,7 @@ AC_MSG_RESULT([$NM])
# AC_CHECK_LIBM - check for math library # AC_CHECK_LIBM - check for math library
AC_DEFUN([AC_CHECK_LIBM], AC_DEFUN([AC_CHECK_LIBM],
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
[AC_REQUIRE([CL_CANONICAL_HOST])dnl
LIBM= LIBM=
case $host in case $host in
*-*-beos* | *-*-cygwin* | *-*-pw32*) *-*-beos* | *-*-cygwin* | *-*-pw32*)
@ -4115,3 +4082,44 @@ AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
# This is just to silence aclocal about the macro not being used # This is just to silence aclocal about the macro not being used
ifelse([AC_DISABLE_FAST_INSTALL]) ifelse([AC_DISABLE_FAST_INSTALL])
# Is the gmp header file new enough? (should be implemented with an argument)
AC_DEFUN(CL_GMP_H_VERSION,
[AC_CACHE_CHECK([for recent enough gmp.h], cl_cv_new_gmp_h, [
AC_TRY_CPP([#include <gmp.h>
#if !defined(__GNU_MP_VERSION) || (__GNU_MP_VERSION < 3)
#error "ancient gmp.h"
#endif],
cl_cv_new_gmp_h="yes", cl_cv_new_gmp_h="no")
])])dnl
# Does libgmp provide some functionality introduced in version 3.0?
AC_DEFUN(CL_GMP_CHECK,
[AC_CACHE_CHECK([for working libgmp], cl_cv_new_libgmp, [
SAVELIBS=$LIBS
LIBS="$LIBS -lgmp"
AC_TRY_LINK([#include <gmp.h>],[mpn_divexact_by3(0,0,0)],
cl_cv_new_libgmp="yes", cl_cv_new_libgmp="no"; LIBS=$SAVELIBS)
])])
# What is sizeof(mp_limb_t)? (It has to match sizeof(uintD) later.)
AC_DEFUN(CL_GMP_SET_UINTD,
[AC_CACHE_CHECK([how large gmp demands uintD to be], cl_cv_gmp_set_uintd, [
AC_TRY_RUN([#include <stdio.h>
#include <gmp.h>
int main() {
FILE *f=fopen("conftestval", "w");
if (!f) return(1);
if (sizeof(mp_limb_t) > sizeof(long))
fprintf(f, "long long");
else if (sizeof(mp_limb_t) == sizeof(long))
fprintf(f, "long");
else if (sizeof(mp_limb_t) == sizeof(int))
fprintf(f, "int");
else return(1);
return(0);
}], cl_cv_gmp_set_uintd=`cat conftestval`; \
cl_gmp_demands="GMP_DEMANDS_UINTD_`echo ${cl_cv_gmp_set_uintd} | sed -e 'y/ gilnot/_GILNOT/'`";
AC_DEFINE_UNQUOTED($cl_gmp_demands),
AC_MSG_ERROR([CLN can't handle the result]),dnl
AC_MSG_ERROR([cross-compiling - cannot determine]))
])])

6
include/cln/modules.h

@ -97,7 +97,11 @@
// Output a label inside a function. // Output a label inside a function.
// See macro ASM_OUTPUT_LABEL in the gcc sources. // See macro ASM_OUTPUT_LABEL in the gcc sources.
#if defined(__hppa__) #if defined(__hppa__)
#define CL_OUTPUT_LABEL(label) ASM_VOLATILE ("\n" label)
// Some hppa (Linux) systems want `label:', HPUX used to use just `label'.
// I tried to find out, but was unable to find the assembler on my HPUX-11
// boxen so decided to potentially ditch the support (no joke). Please
// send an email if you can explain to me what's going on! (-rbk. 07/2001)
#define CL_OUTPUT_LABEL(label) ASM_VOLATILE ("\n" label ":")
#else #else
#define CL_OUTPUT_LABEL(label) ASM_VOLATILE ("\n" label ":") #define CL_OUTPUT_LABEL(label) ASM_VOLATILE ("\n" label ":")
#endif #endif

11
src/base/low/cl_low_div.cc

@ -9,14 +9,13 @@
// Implementation. // Implementation.
namespace cln {
#ifdef NEED_VAR_divu_16_rest #ifdef NEED_VAR_divu_16_rest
uint16 divu_16_rest; uint16 divu_16_rest;
#endif #endif
#ifdef NEED_FUNCTION_divu_3216_1616_ #ifdef NEED_FUNCTION_divu_3216_1616_
uint16 divu_16_rest; uint16 divu_16_rest;
namespace cln {
#if 1 #if 1
// Most processors have a good 32 by 32 bit division, use that. // Most processors have a good 32 by 32 bit division, use that.
uint16 divu_3216_1616_ (uint32 x, uint16 y) uint16 divu_3216_1616_ (uint32 x, uint16 y)
@ -85,9 +84,11 @@ uint16 divu_3216_1616_ (uint32 x, uint16 y)
// This algorithm is implemented in cl_asm_arm.cc and (in slightly modified // This algorithm is implemented in cl_asm_arm.cc and (in slightly modified
// form) in cl_asm_sparc.cc. // form) in cl_asm_sparc.cc.
#endif #endif
} // namespace cln
#endif #endif
#ifdef NEED_FUNCTION_divu_3232_3232_ #ifdef NEED_FUNCTION_divu_3232_3232_
namespace cln {
// Dies dient nur noch als Hilfsfunktion für floorD(). // Dies dient nur noch als Hilfsfunktion für floorD().
// Die Rückgabe des Restes in divu_32_rest ist also hier nicht nötig. // Die Rückgabe des Restes in divu_32_rest ist also hier nicht nötig.
uint32 divu_3232_3232_(uint32 x, uint32 y) uint32 divu_3232_3232_(uint32 x, uint32 y)
@ -96,6 +97,7 @@ uint32 divu_3232_3232_(uint32 x, uint32 y)
divu_3232_3232(x,y,q=,); divu_3232_3232(x,y,q=,);
return q; return q;
} }
} // namespace cln
#endif #endif
#ifdef NEED_VAR_divu_32_rest #ifdef NEED_VAR_divu_32_rest
@ -104,6 +106,7 @@ uint32 divu_32_rest;
#ifdef NEED_FUNCTION_divu_6432_3232_ #ifdef NEED_FUNCTION_divu_6432_3232_
uint32 divu_32_rest; uint32 divu_32_rest;
namespace cln {
uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y) uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y)
// Methode: // Methode:
// Wie UDS_divide mit intDsize=16, a_len=4, b_len=2. // Wie UDS_divide mit intDsize=16, a_len=4, b_len=2.
@ -200,6 +203,7 @@ uint32 divu_6432_3232_(uint32 xhi, uint32 xlo, uint32 y)
divu_32_rest = r >> s; // Rest divu_32_rest = r >> s; // Rest
return highlow32(q1,q0); // Quotient return highlow32(q1,q0); // Quotient
} } } } } }
} // namespace cln
#endif #endif
#ifdef NEED_VAR_divu_64_rest #ifdef NEED_VAR_divu_64_rest
@ -208,6 +212,7 @@ uint64 divu_64_rest;
#ifdef NEED_FUNCTION_divu_12864_6464_ #ifdef NEED_FUNCTION_divu_12864_6464_
uint64 divu_64_rest; uint64 divu_64_rest;
namespace cln {
uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y) uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y)
// Methode: // Methode:
// Wie UDS_divide mit intDsize=32, a_len=4, b_len=2. // Wie UDS_divide mit intDsize=32, a_len=4, b_len=2.
@ -304,6 +309,6 @@ uint64 divu_12864_6464_(uint64 xhi, uint64 xlo, uint64 y)
divu_64_rest = r >> s; // Rest divu_64_rest = r >> s; // Rest
return highlow64(q1,q0); // Quotient return highlow64(q1,q0); // Quotient
} } } } } }
} // namespace cln
#endif #endif
} // namespace cln

11
src/base/low/cl_low_mul.cc

@ -9,14 +9,13 @@
// Implementation. // Implementation.
namespace cln {
#ifdef NEED_VAR_mulu32_high #ifdef NEED_VAR_mulu32_high
uint32 mulu32_high; uint32 mulu32_high;
#endif #endif
#ifdef NEED_FUNCTION_mulu32_ #ifdef NEED_FUNCTION_mulu32_
uint32 mulu32_high; uint32 mulu32_high;
namespace cln {
uint32 mulu32_ (uint32 x, uint32 y) uint32 mulu32_ (uint32 x, uint32 y)
{ {
var uint16 x1 = high16(x); var uint16 x1 = high16(x);
@ -35,23 +34,29 @@ uint32 mulu32_ (uint32 x, uint32 y)
} }
mulu32_high = hi; return lo; mulu32_high = hi; return lo;
} }
} // namespace cln
#endif #endif
#ifdef NEED_FUNCTION_mulu32_w #ifdef NEED_FUNCTION_mulu32_w
namespace cln {
uint64 mulu32_w (uint32 arg1, uint32 arg2) uint64 mulu32_w (uint32 arg1, uint32 arg2)
{ {
var uint32 lo = mulu32_(arg1,arg2); var uint32 lo = mulu32_(arg1,arg2);
var uint32 hi = mulu32_high; var uint32 hi = mulu32_high;
return highlow64(hi,lo); return highlow64(hi,lo);
} }
} // namespace cln
#endif #endif
#ifdef NEED_VAR_mulu64_high #ifdef NEED_VAR_mulu64_high
uint64 mulu64_high; uint64 mulu64_high;
#endif #endif
#ifdef NEED_FUNCTION_mulu64_ #ifdef NEED_FUNCTION_mulu64_
uint64 mulu64_high; uint64 mulu64_high;
namespace cln {
extern "C" uint64 mulu64_ (uint64 x, uint64 y);
uint64 mulu64_ (uint64 x, uint64 y) uint64 mulu64_ (uint64 x, uint64 y)
{ {
var uint32 x1 = high32(x); var uint32 x1 = high32(x);
@ -70,6 +75,6 @@ uint64 mulu64_ (uint64 x, uint64 y)
} }
mulu64_high = hi; return lo; mulu64_high = hi; return lo;
} }
} // namespace cln
#endif #endif
} // namespace cln

27
src/float/base/cl_ieee.cc

@ -17,13 +17,13 @@ CL_PROVIDE(cl_ieee)
#if (defined(linux) || defined(__linux)) && (defined(FAST_FLOAT) || defined(FAST_DOUBLE)) #if (defined(linux) || defined(__linux)) && (defined(FAST_FLOAT) || defined(FAST_DOUBLE))
// Damit Division durch 0.0 ein NaN und kein SIGFPE liefert:
// Entweder mit -lieee linken,
// oder libc-linux/sysdeps/linux/{i386,m68k}/ieee.c kopieren:
// Division by 0.0 should return NaN and not raise an SIGFPE.
// For this, we either have to link with -lieee or copy some
// part from libc-linux/sysdeps/linux/{i386,m68k}/ieee.c:
#include <fpu_control.h> #include <fpu_control.h>
#if 0 // Leider gibt das einen Error, wenn man zusätzlich mit -lieee linkt.
#if 0 // Unfortunately this gives an error if also linked with -lieee
#if defined(HAVE_FPU_CONTROL_T) #if defined(HAVE_FPU_CONTROL_T)
fpu_control_t __fpu_control = _FPU_IEEE; fpu_control_t __fpu_control = _FPU_IEEE;
#else #else
@ -32,14 +32,19 @@ CL_PROVIDE(cl_ieee)
#else #else
AT_INITIALIZATION(ieee) AT_INITIALIZATION(ieee)
{ {
#if defined(HAVE_FPU_CONTROL_T)
extern fpu_control_t __fpu_control;
__fpu_control = _FPU_IEEE;
#elif defined(HAVE_SETFPUCW)
__setfpucw(_FPU_IEEE);
#if defined(_FPU_IEEE)
#if defined(HAVE_FPU_CONTROL_T)
extern fpu_control_t __fpu_control;
__fpu_control = _FPU_IEEE;
#elif defined(HAVE_SETFPUCW)
__setfpucw(_FPU_IEEE);
#else
extern unsigned short __fpu_control;
__fpu_control = _FPU_IEEE;
#endif
#else #else
extern unsigned short __fpu_control;
__fpu_control = _FPU_IEEE;
// Nothing to do (as on some architectures):
// probably this means that _FPU_DEFAULT is just as good as _FPU_IEEE.
#endif #endif
} }
#endif #endif

Loading…
Cancel
Save