diff options
Diffstat (limited to 'gmp/tests/mpn')
49 files changed, 389 insertions, 4358 deletions
diff --git a/gmp/tests/mpn/Makefile.am b/gmp/tests/mpn/Makefile.am index 180c58692c..f67138a6cc 100644 --- a/gmp/tests/mpn/Makefile.am +++ b/gmp/tests/mpn/Makefile.am @@ -1,36 +1,28 @@ ## Process this file with automake to generate Makefile.in -# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2003 Free Software Foundation, Inc. # -# This file is part of the GNU MP Library test suite. +# This file is part of the GNU MP Library. # -# The GNU MP Library test suite is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3 of the License, -# or (at your option) any later version. +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. # -# The GNU MP Library test suite is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +# License for more details. # -# You should have received a copy of the GNU General Public License along with -# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. +# You should have received a copy of the GNU Lesser General Public License +# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la -check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-mod_1 t-fat t-get_d \ - t-instrument t-iord_u t-mp_bases t-perfsqr t-scan logic \ - t-toom22 t-toom32 t-toom33 t-toom42 t-toom43 t-toom44 \ - t-toom52 t-toom53 t-toom54 t-toom62 t-toom63 t-toom6h t-toom8h \ - t-toom2-sqr t-toom3-sqr t-toom4-sqr t-toom6-sqr t-toom8-sqr \ - t-mul t-mullo t-mulmod_bnm1 t-sqrmod_bnm1 t-mulmid \ - t-hgcd t-hgcd_appr t-matrix22 t-invert t-div t-bdiv \ - t-broot t-brootinv t-minvert t-sizeinbase - -EXTRA_DIST = toom-shared.h toom-sqr-shared.h +check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-fat t-get_d \ + t-instrument t-iord_u t-mp_bases t-perfsqr t-scan t-hgcd t-matrix22 TESTS = $(check_PROGRAMS) diff --git a/gmp/tests/mpn/Makefile.in b/gmp/tests/mpn/Makefile.in index 5db22d4f0c..341256217b 100644 --- a/gmp/tests/mpn/Makefile.in +++ b/gmp/tests/mpn/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.8.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# 2003, 2004 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -15,45 +14,33 @@ @SET_MAKE@ -# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc. +# Copyright 2001, 2002, 2003 Free Software Foundation, Inc. # -# This file is part of the GNU MP Library test suite. +# This file is part of the GNU MP Library. # -# The GNU MP Library test suite is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 3 of the License, -# or (at your option) any later version. +# The GNU MP Library is free software; you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. # -# The GNU MP Library test suite is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -# Public License for more details. +# The GNU MP Library is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +# License for more details. # -# You should have received a copy of the GNU General Public License along with -# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. +# You should have received a copy of the GNU Lesser General Public License +# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. +SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c t-perfsqr.c t-scan.c + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ VPATH = @srcdir@ -am__make_dryrun = \ - { \ - am__dry=no; \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ - | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ - *) \ - for am__flg in $$MAKEFLAGS; do \ - case $$am__flg in \ - *=*|--*) ;; \ - *n*) am__dry=yes; break;; \ - esac; \ - done;; \ - esac; \ - test $$am__dry = yes; \ - } pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c @@ -65,301 +52,102 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_triplet = @build@ host_triplet = @host@ +ANSI2KNR = $(top_builddir)/ansi2knr check_PROGRAMS = t-asmtype$(EXEEXT) t-aors_1$(EXEEXT) \ - t-divrem_1$(EXEEXT) t-mod_1$(EXEEXT) t-fat$(EXEEXT) \ - t-get_d$(EXEEXT) t-instrument$(EXEEXT) t-iord_u$(EXEEXT) \ - t-mp_bases$(EXEEXT) t-perfsqr$(EXEEXT) t-scan$(EXEEXT) \ - logic$(EXEEXT) t-toom22$(EXEEXT) t-toom32$(EXEEXT) \ - t-toom33$(EXEEXT) t-toom42$(EXEEXT) t-toom43$(EXEEXT) \ - t-toom44$(EXEEXT) t-toom52$(EXEEXT) t-toom53$(EXEEXT) \ - t-toom54$(EXEEXT) t-toom62$(EXEEXT) t-toom63$(EXEEXT) \ - t-toom6h$(EXEEXT) t-toom8h$(EXEEXT) t-toom2-sqr$(EXEEXT) \ - t-toom3-sqr$(EXEEXT) t-toom4-sqr$(EXEEXT) t-toom6-sqr$(EXEEXT) \ - t-toom8-sqr$(EXEEXT) t-mul$(EXEEXT) t-mullo$(EXEEXT) \ - t-mulmod_bnm1$(EXEEXT) t-sqrmod_bnm1$(EXEEXT) \ - t-mulmid$(EXEEXT) t-hgcd$(EXEEXT) t-hgcd_appr$(EXEEXT) \ - t-matrix22$(EXEEXT) t-invert$(EXEEXT) t-div$(EXEEXT) \ - t-bdiv$(EXEEXT) t-broot$(EXEEXT) t-brootinv$(EXEEXT) \ - t-minvert$(EXEEXT) t-sizeinbase$(EXEEXT) + t-divrem_1$(EXEEXT) t-fat$(EXEEXT) t-get_d$(EXEEXT) \ + t-instrument$(EXEEXT) t-iord_u$(EXEEXT) t-mp_bases$(EXEEXT) \ + t-perfsqr$(EXEEXT) t-scan$(EXEEXT) t-hgcd$(EXEEXT) \ + t-matrix22$(EXEEXT) subdir = tests/mpn DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) -mkinstalldirs = $(install_sh) -d +mkinstalldirs = $(mkdir_p) CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -logic_SOURCES = logic.c -logic_OBJECTS = logic.$(OBJEXT) -logic_LDADD = $(LDADD) -logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_aors_1_SOURCES = t-aors_1.c -t_aors_1_OBJECTS = t-aors_1.$(OBJEXT) +t_aors_1_OBJECTS = t-aors_1$U.$(OBJEXT) t_aors_1_LDADD = $(LDADD) t_aors_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_asmtype_SOURCES = t-asmtype.c -t_asmtype_OBJECTS = t-asmtype.$(OBJEXT) +t_asmtype_OBJECTS = t-asmtype$U.$(OBJEXT) t_asmtype_LDADD = $(LDADD) t_asmtype_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_bdiv_SOURCES = t-bdiv.c -t_bdiv_OBJECTS = t-bdiv.$(OBJEXT) -t_bdiv_LDADD = $(LDADD) -t_bdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_broot_SOURCES = t-broot.c -t_broot_OBJECTS = t-broot.$(OBJEXT) -t_broot_LDADD = $(LDADD) -t_broot_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_brootinv_SOURCES = t-brootinv.c -t_brootinv_OBJECTS = t-brootinv.$(OBJEXT) -t_brootinv_LDADD = $(LDADD) -t_brootinv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_div_SOURCES = t-div.c -t_div_OBJECTS = t-div.$(OBJEXT) -t_div_LDADD = $(LDADD) -t_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_divrem_1_SOURCES = t-divrem_1.c -t_divrem_1_OBJECTS = t-divrem_1.$(OBJEXT) +t_divrem_1_OBJECTS = t-divrem_1$U.$(OBJEXT) t_divrem_1_LDADD = $(LDADD) t_divrem_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_fat_SOURCES = t-fat.c -t_fat_OBJECTS = t-fat.$(OBJEXT) +t_fat_OBJECTS = t-fat$U.$(OBJEXT) t_fat_LDADD = $(LDADD) t_fat_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_get_d_SOURCES = t-get_d.c -t_get_d_OBJECTS = t-get_d.$(OBJEXT) +t_get_d_OBJECTS = t-get_d$U.$(OBJEXT) t_get_d_LDADD = $(LDADD) t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_hgcd_SOURCES = t-hgcd.c -t_hgcd_OBJECTS = t-hgcd.$(OBJEXT) +t_hgcd_OBJECTS = t-hgcd$U.$(OBJEXT) t_hgcd_LDADD = $(LDADD) t_hgcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_hgcd_appr_SOURCES = t-hgcd_appr.c -t_hgcd_appr_OBJECTS = t-hgcd_appr.$(OBJEXT) -t_hgcd_appr_LDADD = $(LDADD) -t_hgcd_appr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_instrument_SOURCES = t-instrument.c -t_instrument_OBJECTS = t-instrument.$(OBJEXT) +t_instrument_OBJECTS = t-instrument$U.$(OBJEXT) t_instrument_LDADD = $(LDADD) t_instrument_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_invert_SOURCES = t-invert.c -t_invert_OBJECTS = t-invert.$(OBJEXT) -t_invert_LDADD = $(LDADD) -t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_iord_u_SOURCES = t-iord_u.c -t_iord_u_OBJECTS = t-iord_u.$(OBJEXT) +t_iord_u_OBJECTS = t-iord_u$U.$(OBJEXT) t_iord_u_LDADD = $(LDADD) t_iord_u_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_matrix22_SOURCES = t-matrix22.c -t_matrix22_OBJECTS = t-matrix22.$(OBJEXT) +t_matrix22_OBJECTS = t-matrix22$U.$(OBJEXT) t_matrix22_LDADD = $(LDADD) t_matrix22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_minvert_SOURCES = t-minvert.c -t_minvert_OBJECTS = t-minvert.$(OBJEXT) -t_minvert_LDADD = $(LDADD) -t_minvert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_mod_1_SOURCES = t-mod_1.c -t_mod_1_OBJECTS = t-mod_1.$(OBJEXT) -t_mod_1_LDADD = $(LDADD) -t_mod_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_mp_bases_SOURCES = t-mp_bases.c -t_mp_bases_OBJECTS = t-mp_bases.$(OBJEXT) +t_mp_bases_OBJECTS = t-mp_bases$U.$(OBJEXT) t_mp_bases_LDADD = $(LDADD) t_mp_bases_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_mul_SOURCES = t-mul.c -t_mul_OBJECTS = t-mul.$(OBJEXT) -t_mul_LDADD = $(LDADD) -t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_mullo_SOURCES = t-mullo.c -t_mullo_OBJECTS = t-mullo.$(OBJEXT) -t_mullo_LDADD = $(LDADD) -t_mullo_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_mulmid_SOURCES = t-mulmid.c -t_mulmid_OBJECTS = t-mulmid.$(OBJEXT) -t_mulmid_LDADD = $(LDADD) -t_mulmid_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_mulmod_bnm1_SOURCES = t-mulmod_bnm1.c -t_mulmod_bnm1_OBJECTS = t-mulmod_bnm1.$(OBJEXT) -t_mulmod_bnm1_LDADD = $(LDADD) -t_mulmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la t_perfsqr_SOURCES = t-perfsqr.c -t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT) +t_perfsqr_OBJECTS = t-perfsqr$U.$(OBJEXT) t_perfsqr_LDADD = $(LDADD) t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la t_scan_SOURCES = t-scan.c -t_scan_OBJECTS = t-scan.$(OBJEXT) +t_scan_OBJECTS = t-scan$U.$(OBJEXT) t_scan_LDADD = $(LDADD) t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ $(top_builddir)/libgmp.la -t_sizeinbase_SOURCES = t-sizeinbase.c -t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT) -t_sizeinbase_LDADD = $(LDADD) -t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_sqrmod_bnm1_SOURCES = t-sqrmod_bnm1.c -t_sqrmod_bnm1_OBJECTS = t-sqrmod_bnm1.$(OBJEXT) -t_sqrmod_bnm1_LDADD = $(LDADD) -t_sqrmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom2_sqr_SOURCES = t-toom2-sqr.c -t_toom2_sqr_OBJECTS = t-toom2-sqr.$(OBJEXT) -t_toom2_sqr_LDADD = $(LDADD) -t_toom2_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom22_SOURCES = t-toom22.c -t_toom22_OBJECTS = t-toom22.$(OBJEXT) -t_toom22_LDADD = $(LDADD) -t_toom22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom3_sqr_SOURCES = t-toom3-sqr.c -t_toom3_sqr_OBJECTS = t-toom3-sqr.$(OBJEXT) -t_toom3_sqr_LDADD = $(LDADD) -t_toom3_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom32_SOURCES = t-toom32.c -t_toom32_OBJECTS = t-toom32.$(OBJEXT) -t_toom32_LDADD = $(LDADD) -t_toom32_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom33_SOURCES = t-toom33.c -t_toom33_OBJECTS = t-toom33.$(OBJEXT) -t_toom33_LDADD = $(LDADD) -t_toom33_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom4_sqr_SOURCES = t-toom4-sqr.c -t_toom4_sqr_OBJECTS = t-toom4-sqr.$(OBJEXT) -t_toom4_sqr_LDADD = $(LDADD) -t_toom4_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom42_SOURCES = t-toom42.c -t_toom42_OBJECTS = t-toom42.$(OBJEXT) -t_toom42_LDADD = $(LDADD) -t_toom42_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom43_SOURCES = t-toom43.c -t_toom43_OBJECTS = t-toom43.$(OBJEXT) -t_toom43_LDADD = $(LDADD) -t_toom43_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom44_SOURCES = t-toom44.c -t_toom44_OBJECTS = t-toom44.$(OBJEXT) -t_toom44_LDADD = $(LDADD) -t_toom44_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom52_SOURCES = t-toom52.c -t_toom52_OBJECTS = t-toom52.$(OBJEXT) -t_toom52_LDADD = $(LDADD) -t_toom52_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom53_SOURCES = t-toom53.c -t_toom53_OBJECTS = t-toom53.$(OBJEXT) -t_toom53_LDADD = $(LDADD) -t_toom53_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom54_SOURCES = t-toom54.c -t_toom54_OBJECTS = t-toom54.$(OBJEXT) -t_toom54_LDADD = $(LDADD) -t_toom54_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom6_sqr_SOURCES = t-toom6-sqr.c -t_toom6_sqr_OBJECTS = t-toom6-sqr.$(OBJEXT) -t_toom6_sqr_LDADD = $(LDADD) -t_toom6_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom62_SOURCES = t-toom62.c -t_toom62_OBJECTS = t-toom62.$(OBJEXT) -t_toom62_LDADD = $(LDADD) -t_toom62_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom63_SOURCES = t-toom63.c -t_toom63_OBJECTS = t-toom63.$(OBJEXT) -t_toom63_LDADD = $(LDADD) -t_toom63_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom6h_SOURCES = t-toom6h.c -t_toom6h_OBJECTS = t-toom6h.$(OBJEXT) -t_toom6h_LDADD = $(LDADD) -t_toom6h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom8_sqr_SOURCES = t-toom8-sqr.c -t_toom8_sqr_OBJECTS = t-toom8-sqr.$(OBJEXT) -t_toom8_sqr_LDADD = $(LDADD) -t_toom8_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -t_toom8h_SOURCES = t-toom8h.c -t_toom8h_OBJECTS = t-toom8h.$(OBJEXT) -t_toom8h_LDADD = $(LDADD) -t_toom8h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \ - $(top_builddir)/libgmp.la -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) -LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ - --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ - $(LDFLAGS) -o $@ -SOURCES = logic.c t-aors_1.c t-asmtype.c t-bdiv.c t-broot.c \ - t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c \ - t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \ - t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \ - t-mullo.c t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \ - t-sizeinbase.c t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c \ - t-toom3-sqr.c t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c \ - t-toom43.c t-toom44.c t-toom52.c t-toom53.c t-toom54.c \ - t-toom6-sqr.c t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c \ - t-toom8h.c -DIST_SOURCES = logic.c t-aors_1.c t-asmtype.c t-bdiv.c t-broot.c \ - t-brootinv.c t-div.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c \ - t-hgcd_appr.c t-instrument.c t-invert.c t-iord_u.c \ - t-matrix22.c t-minvert.c t-mod_1.c t-mp_bases.c t-mul.c \ - t-mullo.c t-mulmid.c t-mulmod_bnm1.c t-perfsqr.c t-scan.c \ - t-sizeinbase.c t-sqrmod_bnm1.c t-toom2-sqr.c t-toom22.c \ - t-toom3-sqr.c t-toom32.c t-toom33.c t-toom4-sqr.c t-toom42.c \ - t-toom43.c t-toom44.c t-toom52.c t-toom53.c t-toom54.c \ - t-toom6-sqr.c t-toom62.c t-toom63.c t-toom6h.c t-toom8-sqr.c \ - t-toom8h.c -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c \ + t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c \ + t-perfsqr.c t-scan.c +DIST_SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c \ + t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c \ + t-perfsqr.c t-scan.c ETAGS = etags CTAGS = ctags -am__tty_colors = \ -red=; grn=; lgn=; blu=; std= DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ABI = @ABI@ ACLOCAL = @ACLOCAL@ @@ -371,6 +159,7 @@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ +BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@ CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@ CC = @CC@ CCAS = @CCAS@ @@ -386,17 +175,16 @@ CYGPATH_W = @CYGPATH_W@ DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@ DEFS = @DEFS@ DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ +ECHO = @ECHO@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ +ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@ +ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@ EXEEXT = @EXEEXT@ EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@ -FGREP = @FGREP@ GMP_LDFLAGS = @GMP_LDFLAGS@ -GMP_LIMB_BITS = @GMP_LIMB_BITS@ GMP_NAIL_BITS = @GMP_NAIL_BITS@ GREP = @GREP@ HAVE_CLOCK_01 = @HAVE_CLOCK_01@ @@ -410,12 +198,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@ HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@ HAVE_STACK_T_01 = @HAVE_STACK_T_01@ HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@ -INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -LD = @LD@ LDFLAGS = @LDFLAGS@ LEX = @LEX@ LEXLIB = @LEXLIB@ @@ -430,26 +216,20 @@ LIBOBJS = @LIBOBJS@ LIBREADLINE = @LIBREADLINE@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ M4 = @M4@ MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -NM = @NM@ -NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -459,31 +239,26 @@ SHELL = @SHELL@ SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@ STRIP = @STRIP@ TAL_OBJECT = @TAL_OBJECT@ -TUNE_LIBS = @TUNE_LIBS@ TUNE_SQR_OBJ = @TUNE_SQR_OBJ@ +U = @U@ U_FOR_BUILD = @U_FOR_BUILD@ VERSION = @VERSION@ +WANT_CXX_FALSE = @WANT_CXX_FALSE@ +WANT_CXX_TRUE = @WANT_CXX_TRUE@ +WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@ +WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@ WITH_READLINE_01 = @WITH_READLINE_01@ YACC = @YACC@ YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__leading_dot = @am__leading_dot@ -am__tar = @am__tar@ -am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ -builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ @@ -507,6 +282,7 @@ mandir = @mandir@ mkdir_p = @mkdir_p@ mpn_objects = @mpn_objects@ mpn_objs_in_libgmp = @mpn_objs_in_libgmp@ +mpn_objs_in_libmp = @mpn_objs_in_libmp@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ @@ -514,15 +290,10 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la -EXTRA_DIST = toom-shared.h toom-sqr-shared.h TESTS = $(check_PROGRAMS) all: all-am @@ -532,14 +303,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ exit 1;; \ esac; \ done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ @@ -557,157 +328,60 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list -logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES) - @rm -f logic$(EXEEXT) - $(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS) -t-aors_1$(EXEEXT): $(t_aors_1_OBJECTS) $(t_aors_1_DEPENDENCIES) $(EXTRA_t_aors_1_DEPENDENCIES) + @list='$(check_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +t-aors_1$(EXEEXT): $(t_aors_1_OBJECTS) $(t_aors_1_DEPENDENCIES) @rm -f t-aors_1$(EXEEXT) - $(LINK) $(t_aors_1_OBJECTS) $(t_aors_1_LDADD) $(LIBS) -t-asmtype$(EXEEXT): $(t_asmtype_OBJECTS) $(t_asmtype_DEPENDENCIES) $(EXTRA_t_asmtype_DEPENDENCIES) + $(LINK) $(t_aors_1_LDFLAGS) $(t_aors_1_OBJECTS) $(t_aors_1_LDADD) $(LIBS) +t-asmtype$(EXEEXT): $(t_asmtype_OBJECTS) $(t_asmtype_DEPENDENCIES) @rm -f t-asmtype$(EXEEXT) - $(LINK) $(t_asmtype_OBJECTS) $(t_asmtype_LDADD) $(LIBS) -t-bdiv$(EXEEXT): $(t_bdiv_OBJECTS) $(t_bdiv_DEPENDENCIES) $(EXTRA_t_bdiv_DEPENDENCIES) - @rm -f t-bdiv$(EXEEXT) - $(LINK) $(t_bdiv_OBJECTS) $(t_bdiv_LDADD) $(LIBS) -t-broot$(EXEEXT): $(t_broot_OBJECTS) $(t_broot_DEPENDENCIES) $(EXTRA_t_broot_DEPENDENCIES) - @rm -f t-broot$(EXEEXT) - $(LINK) $(t_broot_OBJECTS) $(t_broot_LDADD) $(LIBS) -t-brootinv$(EXEEXT): $(t_brootinv_OBJECTS) $(t_brootinv_DEPENDENCIES) $(EXTRA_t_brootinv_DEPENDENCIES) - @rm -f t-brootinv$(EXEEXT) - $(LINK) $(t_brootinv_OBJECTS) $(t_brootinv_LDADD) $(LIBS) -t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES) $(EXTRA_t_div_DEPENDENCIES) - @rm -f t-div$(EXEEXT) - $(LINK) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS) -t-divrem_1$(EXEEXT): $(t_divrem_1_OBJECTS) $(t_divrem_1_DEPENDENCIES) $(EXTRA_t_divrem_1_DEPENDENCIES) + $(LINK) $(t_asmtype_LDFLAGS) $(t_asmtype_OBJECTS) $(t_asmtype_LDADD) $(LIBS) +t-divrem_1$(EXEEXT): $(t_divrem_1_OBJECTS) $(t_divrem_1_DEPENDENCIES) @rm -f t-divrem_1$(EXEEXT) - $(LINK) $(t_divrem_1_OBJECTS) $(t_divrem_1_LDADD) $(LIBS) -t-fat$(EXEEXT): $(t_fat_OBJECTS) $(t_fat_DEPENDENCIES) $(EXTRA_t_fat_DEPENDENCIES) + $(LINK) $(t_divrem_1_LDFLAGS) $(t_divrem_1_OBJECTS) $(t_divrem_1_LDADD) $(LIBS) +t-fat$(EXEEXT): $(t_fat_OBJECTS) $(t_fat_DEPENDENCIES) @rm -f t-fat$(EXEEXT) - $(LINK) $(t_fat_OBJECTS) $(t_fat_LDADD) $(LIBS) -t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES) + $(LINK) $(t_fat_LDFLAGS) $(t_fat_OBJECTS) $(t_fat_LDADD) $(LIBS) +t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) @rm -f t-get_d$(EXEEXT) - $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS) -t-hgcd$(EXEEXT): $(t_hgcd_OBJECTS) $(t_hgcd_DEPENDENCIES) $(EXTRA_t_hgcd_DEPENDENCIES) + $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS) +t-hgcd$(EXEEXT): $(t_hgcd_OBJECTS) $(t_hgcd_DEPENDENCIES) @rm -f t-hgcd$(EXEEXT) - $(LINK) $(t_hgcd_OBJECTS) $(t_hgcd_LDADD) $(LIBS) -t-hgcd_appr$(EXEEXT): $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_DEPENDENCIES) $(EXTRA_t_hgcd_appr_DEPENDENCIES) - @rm -f t-hgcd_appr$(EXEEXT) - $(LINK) $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_LDADD) $(LIBS) -t-instrument$(EXEEXT): $(t_instrument_OBJECTS) $(t_instrument_DEPENDENCIES) $(EXTRA_t_instrument_DEPENDENCIES) + $(LINK) $(t_hgcd_LDFLAGS) $(t_hgcd_OBJECTS) $(t_hgcd_LDADD) $(LIBS) +t-instrument$(EXEEXT): $(t_instrument_OBJECTS) $(t_instrument_DEPENDENCIES) @rm -f t-instrument$(EXEEXT) - $(LINK) $(t_instrument_OBJECTS) $(t_instrument_LDADD) $(LIBS) -t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES) - @rm -f t-invert$(EXEEXT) - $(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS) -t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES) $(EXTRA_t_iord_u_DEPENDENCIES) + $(LINK) $(t_instrument_LDFLAGS) $(t_instrument_OBJECTS) $(t_instrument_LDADD) $(LIBS) +t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES) @rm -f t-iord_u$(EXEEXT) - $(LINK) $(t_iord_u_OBJECTS) $(t_iord_u_LDADD) $(LIBS) -t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(t_matrix22_DEPENDENCIES) $(EXTRA_t_matrix22_DEPENDENCIES) + $(LINK) $(t_iord_u_LDFLAGS) $(t_iord_u_OBJECTS) $(t_iord_u_LDADD) $(LIBS) +t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(t_matrix22_DEPENDENCIES) @rm -f t-matrix22$(EXEEXT) - $(LINK) $(t_matrix22_OBJECTS) $(t_matrix22_LDADD) $(LIBS) -t-minvert$(EXEEXT): $(t_minvert_OBJECTS) $(t_minvert_DEPENDENCIES) $(EXTRA_t_minvert_DEPENDENCIES) - @rm -f t-minvert$(EXEEXT) - $(LINK) $(t_minvert_OBJECTS) $(t_minvert_LDADD) $(LIBS) -t-mod_1$(EXEEXT): $(t_mod_1_OBJECTS) $(t_mod_1_DEPENDENCIES) $(EXTRA_t_mod_1_DEPENDENCIES) - @rm -f t-mod_1$(EXEEXT) - $(LINK) $(t_mod_1_OBJECTS) $(t_mod_1_LDADD) $(LIBS) -t-mp_bases$(EXEEXT): $(t_mp_bases_OBJECTS) $(t_mp_bases_DEPENDENCIES) $(EXTRA_t_mp_bases_DEPENDENCIES) + $(LINK) $(t_matrix22_LDFLAGS) $(t_matrix22_OBJECTS) $(t_matrix22_LDADD) $(LIBS) +t-mp_bases$(EXEEXT): $(t_mp_bases_OBJECTS) $(t_mp_bases_DEPENDENCIES) @rm -f t-mp_bases$(EXEEXT) - $(LINK) $(t_mp_bases_OBJECTS) $(t_mp_bases_LDADD) $(LIBS) -t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES) - @rm -f t-mul$(EXEEXT) - $(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS) -t-mullo$(EXEEXT): $(t_mullo_OBJECTS) $(t_mullo_DEPENDENCIES) $(EXTRA_t_mullo_DEPENDENCIES) - @rm -f t-mullo$(EXEEXT) - $(LINK) $(t_mullo_OBJECTS) $(t_mullo_LDADD) $(LIBS) -t-mulmid$(EXEEXT): $(t_mulmid_OBJECTS) $(t_mulmid_DEPENDENCIES) $(EXTRA_t_mulmid_DEPENDENCIES) - @rm -f t-mulmid$(EXEEXT) - $(LINK) $(t_mulmid_OBJECTS) $(t_mulmid_LDADD) $(LIBS) -t-mulmod_bnm1$(EXEEXT): $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_DEPENDENCIES) $(EXTRA_t_mulmod_bnm1_DEPENDENCIES) - @rm -f t-mulmod_bnm1$(EXEEXT) - $(LINK) $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_LDADD) $(LIBS) -t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES) + $(LINK) $(t_mp_bases_LDFLAGS) $(t_mp_bases_OBJECTS) $(t_mp_bases_LDADD) $(LIBS) +t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) @rm -f t-perfsqr$(EXEEXT) - $(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS) -t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES) + $(LINK) $(t_perfsqr_LDFLAGS) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS) +t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) @rm -f t-scan$(EXEEXT) - $(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS) -t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES) - @rm -f t-sizeinbase$(EXEEXT) - $(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS) -t-sqrmod_bnm1$(EXEEXT): $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_DEPENDENCIES) $(EXTRA_t_sqrmod_bnm1_DEPENDENCIES) - @rm -f t-sqrmod_bnm1$(EXEEXT) - $(LINK) $(t_sqrmod_bnm1_OBJECTS) $(t_sqrmod_bnm1_LDADD) $(LIBS) -t-toom2-sqr$(EXEEXT): $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_DEPENDENCIES) $(EXTRA_t_toom2_sqr_DEPENDENCIES) - @rm -f t-toom2-sqr$(EXEEXT) - $(LINK) $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_LDADD) $(LIBS) -t-toom22$(EXEEXT): $(t_toom22_OBJECTS) $(t_toom22_DEPENDENCIES) $(EXTRA_t_toom22_DEPENDENCIES) - @rm -f t-toom22$(EXEEXT) - $(LINK) $(t_toom22_OBJECTS) $(t_toom22_LDADD) $(LIBS) -t-toom3-sqr$(EXEEXT): $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_DEPENDENCIES) $(EXTRA_t_toom3_sqr_DEPENDENCIES) - @rm -f t-toom3-sqr$(EXEEXT) - $(LINK) $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_LDADD) $(LIBS) -t-toom32$(EXEEXT): $(t_toom32_OBJECTS) $(t_toom32_DEPENDENCIES) $(EXTRA_t_toom32_DEPENDENCIES) - @rm -f t-toom32$(EXEEXT) - $(LINK) $(t_toom32_OBJECTS) $(t_toom32_LDADD) $(LIBS) -t-toom33$(EXEEXT): $(t_toom33_OBJECTS) $(t_toom33_DEPENDENCIES) $(EXTRA_t_toom33_DEPENDENCIES) - @rm -f t-toom33$(EXEEXT) - $(LINK) $(t_toom33_OBJECTS) $(t_toom33_LDADD) $(LIBS) -t-toom4-sqr$(EXEEXT): $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_DEPENDENCIES) $(EXTRA_t_toom4_sqr_DEPENDENCIES) - @rm -f t-toom4-sqr$(EXEEXT) - $(LINK) $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_LDADD) $(LIBS) -t-toom42$(EXEEXT): $(t_toom42_OBJECTS) $(t_toom42_DEPENDENCIES) $(EXTRA_t_toom42_DEPENDENCIES) - @rm -f t-toom42$(EXEEXT) - $(LINK) $(t_toom42_OBJECTS) $(t_toom42_LDADD) $(LIBS) -t-toom43$(EXEEXT): $(t_toom43_OBJECTS) $(t_toom43_DEPENDENCIES) $(EXTRA_t_toom43_DEPENDENCIES) - @rm -f t-toom43$(EXEEXT) - $(LINK) $(t_toom43_OBJECTS) $(t_toom43_LDADD) $(LIBS) -t-toom44$(EXEEXT): $(t_toom44_OBJECTS) $(t_toom44_DEPENDENCIES) $(EXTRA_t_toom44_DEPENDENCIES) - @rm -f t-toom44$(EXEEXT) - $(LINK) $(t_toom44_OBJECTS) $(t_toom44_LDADD) $(LIBS) -t-toom52$(EXEEXT): $(t_toom52_OBJECTS) $(t_toom52_DEPENDENCIES) $(EXTRA_t_toom52_DEPENDENCIES) - @rm -f t-toom52$(EXEEXT) - $(LINK) $(t_toom52_OBJECTS) $(t_toom52_LDADD) $(LIBS) -t-toom53$(EXEEXT): $(t_toom53_OBJECTS) $(t_toom53_DEPENDENCIES) $(EXTRA_t_toom53_DEPENDENCIES) - @rm -f t-toom53$(EXEEXT) - $(LINK) $(t_toom53_OBJECTS) $(t_toom53_LDADD) $(LIBS) -t-toom54$(EXEEXT): $(t_toom54_OBJECTS) $(t_toom54_DEPENDENCIES) $(EXTRA_t_toom54_DEPENDENCIES) - @rm -f t-toom54$(EXEEXT) - $(LINK) $(t_toom54_OBJECTS) $(t_toom54_LDADD) $(LIBS) -t-toom6-sqr$(EXEEXT): $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_DEPENDENCIES) $(EXTRA_t_toom6_sqr_DEPENDENCIES) - @rm -f t-toom6-sqr$(EXEEXT) - $(LINK) $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_LDADD) $(LIBS) -t-toom62$(EXEEXT): $(t_toom62_OBJECTS) $(t_toom62_DEPENDENCIES) $(EXTRA_t_toom62_DEPENDENCIES) - @rm -f t-toom62$(EXEEXT) - $(LINK) $(t_toom62_OBJECTS) $(t_toom62_LDADD) $(LIBS) -t-toom63$(EXEEXT): $(t_toom63_OBJECTS) $(t_toom63_DEPENDENCIES) $(EXTRA_t_toom63_DEPENDENCIES) - @rm -f t-toom63$(EXEEXT) - $(LINK) $(t_toom63_OBJECTS) $(t_toom63_LDADD) $(LIBS) -t-toom6h$(EXEEXT): $(t_toom6h_OBJECTS) $(t_toom6h_DEPENDENCIES) $(EXTRA_t_toom6h_DEPENDENCIES) - @rm -f t-toom6h$(EXEEXT) - $(LINK) $(t_toom6h_OBJECTS) $(t_toom6h_LDADD) $(LIBS) -t-toom8-sqr$(EXEEXT): $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_DEPENDENCIES) $(EXTRA_t_toom8_sqr_DEPENDENCIES) - @rm -f t-toom8-sqr$(EXEEXT) - $(LINK) $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_LDADD) $(LIBS) -t-toom8h$(EXEEXT): $(t_toom8h_OBJECTS) $(t_toom8h_DEPENDENCIES) $(EXTRA_t_toom8h_DEPENDENCIES) - @rm -f t-toom8h$(EXEEXT) - $(LINK) $(t_toom8h_OBJECTS) $(t_toom8h_LDADD) $(LIBS) + $(LINK) $(t_scan_LDFLAGS) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c +$(top_builddir)/ansi2knr: + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr + +mostlyclean-kr: + -test "$U" = "" || rm -f *_.c .c.o: $(COMPILE) -c $< @@ -717,6 +391,37 @@ distclean-compile: .c.lo: $(LTCOMPILE) -c -o $@ $< +t-aors_1_.c: t-aors_1.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-aors_1.c; then echo $(srcdir)/t-aors_1.c; else echo t-aors_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-asmtype_.c: t-asmtype.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-asmtype.c; then echo $(srcdir)/t-asmtype.c; else echo t-asmtype.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-divrem_1_.c: t-divrem_1.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divrem_1.c; then echo $(srcdir)/t-divrem_1.c; else echo t-divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-fat_.c: t-fat.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fat.c; then echo $(srcdir)/t-fat.c; else echo t-fat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-get_d_.c: t-get_d.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-hgcd_.c: t-hgcd.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-hgcd.c; then echo $(srcdir)/t-hgcd.c; else echo t-hgcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-instrument_.c: t-instrument.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-instrument.c; then echo $(srcdir)/t-instrument.c; else echo t-instrument.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-iord_u_.c: t-iord_u.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-iord_u.c; then echo $(srcdir)/t-iord_u.c; else echo t-iord_u.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-matrix22_.c: t-matrix22.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-matrix22.c; then echo $(srcdir)/t-matrix22.c; else echo t-matrix22.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-mp_bases_.c: t-mp_bases.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mp_bases.c; then echo $(srcdir)/t-mp_bases.c; else echo t-mp_bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-perfsqr_.c: t-perfsqr.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfsqr.c; then echo $(srcdir)/t-perfsqr.c; else echo t-perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-scan_.c: t-scan.c $(ANSI2KNR) + $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-scan.c; then echo $(srcdir)/t-scan.c; else echo t-scan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@ +t-aors_1_.$(OBJEXT) t-aors_1_.lo t-asmtype_.$(OBJEXT) t-asmtype_.lo \ +t-divrem_1_.$(OBJEXT) t-divrem_1_.lo t-fat_.$(OBJEXT) t-fat_.lo \ +t-get_d_.$(OBJEXT) t-get_d_.lo t-hgcd_.$(OBJEXT) t-hgcd_.lo \ +t-instrument_.$(OBJEXT) t-instrument_.lo t-iord_u_.$(OBJEXT) \ +t-iord_u_.lo t-matrix22_.$(OBJEXT) t-matrix22_.lo \ +t-mp_bases_.$(OBJEXT) t-mp_bases_.lo t-perfsqr_.$(OBJEXT) \ +t-perfsqr_.lo t-scan_.$(OBJEXT) t-scan_.lo : $(ANSI2KNR) mostlyclean-libtool: -rm -f *.lo @@ -724,54 +429,54 @@ mostlyclean-libtool: clean-libtool: -rm -rf .libs _libs +distclean-libtool: + -rm -f libtool +uninstall-info-am: + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) - set x; \ + tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -z "$$unique" && unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in files) print i; }; }'`; \ - test -z "$(CTAGS_ARGS)$$unique" \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique + $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags @@ -779,8 +484,7 @@ distclean-tags: check-TESTS: $(TESTS) @failed=0; all=0; xfail=0; xpass=0; skip=0; \ srcdir=$(srcdir); export srcdir; \ - list=' $(TESTS) '; \ - $(am__tty_colors); \ + list='$(TESTS)'; \ if test -n "$$list"; then \ for tst in $$list; do \ if test -f ./$$tst; then dir=./; \ @@ -789,113 +493,91 @@ check-TESTS: $(TESTS) if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ + *" $$tst "*) \ xpass=`expr $$xpass + 1`; \ failed=`expr $$failed + 1`; \ - col=$$red; res=XPASS; \ + echo "XPASS: $$tst"; \ ;; \ *) \ - col=$$grn; res=PASS; \ + echo "PASS: $$tst"; \ ;; \ esac; \ elif test $$? -ne 77; then \ all=`expr $$all + 1`; \ case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$tst[\ \ ]*) \ + *" $$tst "*) \ xfail=`expr $$xfail + 1`; \ - col=$$lgn; res=XFAIL; \ + echo "XFAIL: $$tst"; \ ;; \ *) \ failed=`expr $$failed + 1`; \ - col=$$red; res=FAIL; \ + echo "FAIL: $$tst"; \ ;; \ esac; \ else \ skip=`expr $$skip + 1`; \ - col=$$blu; res=SKIP; \ + echo "SKIP: $$tst"; \ fi; \ - echo "$${col}$$res$${std}: $$tst"; \ done; \ - if test "$$all" -eq 1; then \ - tests="test"; \ - All=""; \ - else \ - tests="tests"; \ - All="All "; \ - fi; \ if test "$$failed" -eq 0; then \ if test "$$xfail" -eq 0; then \ - banner="$$All$$all $$tests passed"; \ + banner="All $$all tests passed"; \ else \ - if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ - banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + banner="All $$all tests behaved as expected ($$xfail expected failures)"; \ fi; \ else \ if test "$$xpass" -eq 0; then \ - banner="$$failed of $$all $$tests failed"; \ + banner="$$failed of $$all tests failed"; \ else \ - if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ - banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \ fi; \ fi; \ dashes="$$banner"; \ skipped=""; \ if test "$$skip" -ne 0; then \ - if test "$$skip" -eq 1; then \ - skipped="($$skip test was not run)"; \ - else \ - skipped="($$skip tests were not run)"; \ - fi; \ - test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + skipped="($$skip tests were not run)"; \ + test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \ dashes="$$skipped"; \ fi; \ report=""; \ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ report="Please report to $(PACKAGE_BUGREPORT)"; \ - test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \ dashes="$$report"; \ fi; \ dashes=`echo "$$dashes" | sed s/./=/g`; \ - if test "$$failed" -eq 0; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - fi; \ - echo "$${col}$$dashes$${std}"; \ - echo "$${col}$$banner$${std}"; \ - test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ - test -z "$$report" || echo "$${col}$$report$${std}"; \ - echo "$${col}$$dashes$${std}"; \ + echo "$$dashes"; \ + echo "$$banner"; \ + test -n "$$skipped" && echo "$$skipped"; \ + test -n "$$report" && echo "$$report"; \ + echo "$$dashes"; \ test "$$failed" -eq 0; \ else :; fi distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done @@ -915,22 +597,16 @@ install-am: all-am installcheck: installcheck-am install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -943,7 +619,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags + distclean-libtool distclean-tags dvi: dvi-am @@ -951,38 +627,18 @@ dvi-am: html: html-am -html-am: - info: info-am info-am: install-data-am: -install-dvi: install-dvi-am - -install-dvi-am: - install-exec-am: -install-html: install-html-am - -install-html-am: - install-info: install-info-am -install-info-am: - install-man: -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - installcheck-am: maintainer-clean: maintainer-clean-am @@ -991,7 +647,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ +mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \ mostlyclean-libtool pdf: pdf-am @@ -1002,28 +658,23 @@ ps: ps-am ps-am: -uninstall-am: - -.MAKE: check-am install-am install-strip +uninstall-am: uninstall-info-am .PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \ clean-checkPROGRAMS clean-generic clean-libtool ctags \ distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ - install-data-am install-dvi install-dvi-am install-exec \ - install-exec-am install-html install-html-am install-info \ - install-info-am install-man install-pdf install-pdf-am \ - install-ps install-ps-am install-strip installcheck \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am + mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \ + pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am $(top_builddir)/tests/libtests.la: cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la - # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/gmp/tests/mpn/logic.c b/gmp/tests/mpn/logic.c deleted file mode 100644 index 75b5dca1fc..0000000000 --- a/gmp/tests/mpn/logic.c +++ /dev/null @@ -1,134 +0,0 @@ -/* Test mpn_and, mpn_ior, mpn_xor, mpn_andn, mpn_iorn, mpn_xnor, mpn_nand, and - mpn_nior. - -Copyright 2011-2013 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -/* Fake native prevalence of the tested operations, so that we actually test - the compiled functions, i.e., the ones which users will reach. The inlined - variants will be tested through tests/mpz/logic.c. */ -#define HAVE_NATIVE_mpn_com 1 -#define HAVE_NATIVE_mpn_and_n 1 -#define HAVE_NATIVE_mpn_andn_n 1 -#define HAVE_NATIVE_mpn_nand_n 1 -#define HAVE_NATIVE_mpn_ior_n 1 -#define HAVE_NATIVE_mpn_iorn_n 1 -#define HAVE_NATIVE_mpn_nior_n 1 -#define HAVE_NATIVE_mpn_xor_n 1 -#define HAVE_NATIVE_mpn_xnor_n 1 - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - - -void -check_one (mp_srcptr refp, mp_srcptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n, char *funcname) -{ - if (mpn_cmp (refp, rp, n)) - { - printf ("ERROR in mpn_%s\n", funcname); - printf ("a: "); mpn_dump (ap, n); - printf ("b: "); mpn_dump (bp, n); - printf ("r: "); mpn_dump (rp, n); - printf ("ref: "); mpn_dump (refp, n); - abort(); - } -} - -int -main (int argc, char **argv) -{ - mpz_t a, b; - mp_ptr ap, bp, rp, refp; - mp_size_t max_n, n, i; - gmp_randstate_ptr rands; - long test, reps = 1000; - TMP_SDECL; - TMP_SMARK; - - tests_start (); - TESTS_REPS (reps, argv, argc); - - mpz_inits (a, b, NULL); - - rands = RANDS; /* FIXME: not used */ - - max_n = 100; - - rp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS); - refp = TMP_SALLOC_LIMBS (1 + max_n * 8 / GMP_LIMB_BITS); - - for (test = 0; test < reps; test++) - { - for (i = 1; i <= max_n; i++) - { - mpz_rrandomb (a, rands, i * 8); - mpz_rrandomb (b, rands, i * 8); - mpz_setbit (a, i * 8 - 1); - mpz_setbit (b, i * 8 - 1); - ap = PTR(a); - bp = PTR(b); - n = SIZ(a); - - refmpn_and_n (refp, ap, bp, n); - mpn_and_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "and_n"); - - refmpn_ior_n (refp, ap, bp, n); - mpn_ior_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "ior_n"); - - refmpn_xor_n (refp, ap, bp, n); - mpn_xor_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "xor_n"); - - refmpn_andn_n (refp, ap, bp, n); - mpn_andn_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "andn_n"); - - refmpn_iorn_n (refp, ap, bp, n); - mpn_iorn_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "iorn_n"); - - refmpn_nand_n (refp, ap, bp, n); - mpn_nand_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "nand_n"); - - refmpn_nior_n (refp, ap, bp, n); - mpn_nior_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "nior_n"); - - refmpn_xnor_n (refp, ap, bp, n); - mpn_xnor_n (rp, ap, bp, n); - check_one (refp, rp, ap, bp, n, "xnor_n"); - - refmpn_com (refp, ap, n); - mpn_com (rp, ap, n); - check_one (refp, rp, ap, bp, n, "com"); - } - } - - TMP_SFREE; - mpz_clears (a, b, NULL); - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-aors_1.c b/gmp/tests/mpn/t-aors_1.c index 6a946f2d57..a1878bb845 100644 --- a/gmp/tests/mpn/t-aors_1.c +++ b/gmp/tests/mpn/t-aors_1.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -48,8 +48,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ got, data[i].want, data[i].size); \ } while (0) -typedef mp_limb_t (*mpn_aors_1_t) (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t); -mpn_aors_1_t fudge (mpn_aors_1_t); +typedef mp_limb_t (*mpn_aors_1_t) + __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)); +mpn_aors_1_t fudge __GMP_PROTO ((mpn_aors_1_t)); void @@ -133,8 +134,6 @@ check_add_1 (void) mp_limb_t got[ASIZE]; mp_limb_t got_c; - /* mpn_sec_add_a_itch(n) <= n */ - mp_limb_t scratch[ASIZE]; int i; for (i = 0; i < numberof (data); i++) @@ -147,16 +146,6 @@ check_add_1 (void) got_c = mpn_add_1 (got, got, data[i].size, data[i].n); VERIFY ("check_add_1 (in-place)"); - SETUP (); - scratch [mpn_sec_add_1_itch(data[i].size)] = MAGIC; - got_c = mpn_sec_add_1 (got, data[i].src, data[i].size, data[i].n, scratch); - got_c ^= scratch [mpn_sec_add_1_itch(data[i].size)] ^ MAGIC; - VERIFY ("check_sec_add_1 (separate)"); - - SETUP_INPLACE (); - got_c = mpn_sec_add_1 (got, got, data[i].size, data[i].n, scratch); - VERIFY ("check_sec_add_1 (in-place)"); - if (data[i].n == 1) { SETUP (); @@ -166,16 +155,6 @@ check_add_1 (void) SETUP_INPLACE (); got_c = mpn_add_1 (got, got, data[i].size, CNST_LIMB(1)); VERIFY ("check_add_1 (in-place, const 1)"); - - SETUP (); - got_c = mpn_sec_add_1 (got, data[i].src, data[i].size, - CNST_LIMB(1), scratch); - VERIFY ("check_sec_add_1 (separate, const 1)"); - - SETUP_INPLACE (); - got_c = mpn_sec_add_1 (got, got, data[i].size, - CNST_LIMB(1), scratch); - VERIFY ("check_sec_add_1 (in-place, const 1)"); } /* Same again on functions, not inlines. */ @@ -234,8 +213,6 @@ check_sub_1 (void) mp_limb_t got[ASIZE]; mp_limb_t got_c; - /* mpn_sec_sub_1_itch(n) <= n */ - mp_limb_t scratch[ASIZE]; int i; for (i = 0; i < numberof (data); i++) @@ -248,16 +225,6 @@ check_sub_1 (void) got_c = mpn_sub_1 (got, got, data[i].size, data[i].n); VERIFY ("check_sub_1 (in-place)"); - SETUP (); - scratch [mpn_sec_sub_1_itch(data[i].size)] = MAGIC; - got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size, data[i].n, scratch); - got_c ^= scratch [mpn_sec_sub_1_itch(data[i].size)] ^ MAGIC; - VERIFY ("check_sec_sub_1 (separate)"); - - SETUP_INPLACE (); - got_c = mpn_sec_sub_1 (got, got, data[i].size, data[i].n, scratch); - VERIFY ("check_sec_sub_1 (in-place)"); - if (data[i].n == 1) { SETUP (); @@ -267,16 +234,6 @@ check_sub_1 (void) SETUP_INPLACE (); got_c = mpn_sub_1 (got, got, data[i].size, CNST_LIMB(1)); VERIFY ("check_sub_1 (in-place, const 1)"); - - SETUP (); - got_c = mpn_sec_sub_1 (got, data[i].src, data[i].size, - CNST_LIMB(1), scratch); - VERIFY ("check_sec_sub_1 (separate, const 1)"); - - SETUP_INPLACE (); - got_c = mpn_sec_sub_1 (got, got, data[i].size, - CNST_LIMB(1), scratch); - VERIFY ("check_sec_sub_1 (in-place, const 1)"); } /* Same again on functions, not inlines. */ diff --git a/gmp/tests/mpn/t-asmtype.c b/gmp/tests/mpn/t-asmtype.c index 93960f7aef..4ee5a7ab2f 100644 --- a/gmp/tests/mpn/t-asmtype.c +++ b/gmp/tests/mpn/t-asmtype.c @@ -2,20 +2,20 @@ Copyright 2001 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> diff --git a/gmp/tests/mpn/t-bdiv.c b/gmp/tests/mpn/t-bdiv.c deleted file mode 100644 index 0056ca9e38..0000000000 --- a/gmp/tests/mpn/t-bdiv.c +++ /dev/null @@ -1,368 +0,0 @@ -/* Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> /* for strtol */ -#include <stdio.h> /* for printf */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include "tests/tests.h" - - -static void -dumpy (mp_srcptr p, mp_size_t n) -{ - mp_size_t i; - if (n > 20) - { - for (i = n - 1; i >= n - 4; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" "); - } - printf ("... "); - for (i = 3; i >= 0; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" " + (i == 0)); - } - } - else - { - for (i = n - 1; i >= 0; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" " + (i == 0)); - } - } - puts (""); -} - -static unsigned long test; - -void -check_one (mp_ptr qp, mp_srcptr rp, mp_limb_t rh, - mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, const char *fname) -{ - mp_size_t qn; - int cmp; - mp_ptr tp; - mp_limb_t cy = 4711; /* silence warnings */ - TMP_DECL; - - qn = nn - dn; - - if (qn == 0) - return; - - TMP_MARK; - - tp = TMP_ALLOC_LIMBS (nn + 1); - - if (dn >= qn) - mpn_mul (tp, dp, dn, qp, qn); - else - mpn_mul (tp, qp, qn, dp, dn); - - if (rp != NULL) - { - cy = mpn_add_n (tp + qn, tp + qn, rp, dn); - cmp = cy != rh || mpn_cmp (tp, np, nn) != 0; - } - else - cmp = mpn_cmp (tp, np, nn - dn) != 0; - - if (cmp != 0) - { - printf ("\r*******************************************************************************\n"); - printf ("%s inconsistent in test %lu\n", fname, test); - printf ("N= "); dumpy (np, nn); - printf ("D= "); dumpy (dp, dn); - printf ("Q= "); dumpy (qp, qn); - if (rp != NULL) - { - printf ("R= "); dumpy (rp, dn); - printf ("Rb= %d, Cy=%d\n", (int) cy, (int) rh); - } - printf ("T= "); dumpy (tp, nn); - printf ("nn = %ld, dn = %ld, qn = %ld", nn, dn, qn); - printf ("\n*******************************************************************************\n"); - abort (); - } - - TMP_FREE; -} - - -/* These are *bit* sizes. */ -#define SIZE_LOG 16 -#define MAX_DN (1L << SIZE_LOG) -#define MAX_NN (1L << (SIZE_LOG + 1)) - -#define COUNT 500 - -mp_limb_t -random_word (gmp_randstate_ptr rs) -{ - mpz_t x; - mp_limb_t r; - TMP_DECL; - TMP_MARK; - - MPZ_TMP_INIT (x, 2); - mpz_urandomb (x, rs, 32); - r = mpz_get_ui (x); - TMP_FREE; - return r; -} - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - unsigned long maxnbits, maxdbits, nbits, dbits; - mpz_t n, d, tz; - mp_size_t maxnn, maxdn, nn, dn, clearn, i; - mp_ptr np, dp, qp, rp; - mp_limb_t rh; - mp_limb_t t; - mp_limb_t dinv; - int count = COUNT; - mp_ptr scratch; - mp_limb_t ran; - mp_size_t alloc, itch; - mp_limb_t rran0, rran1, qran0, qran1; - TMP_DECL; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - - maxdbits = MAX_DN; - maxnbits = MAX_NN; - - tests_start (); - rands = RANDS; - - mpz_init (n); - mpz_init (d); - mpz_init (tz); - - maxnn = maxnbits / GMP_NUMB_BITS + 1; - maxdn = maxdbits / GMP_NUMB_BITS + 1; - - TMP_MARK; - - qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1; - rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1; - - alloc = 1; - scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc); - - for (test = 0; test < count;) - { - nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS; - if (maxdbits > nbits) - dbits = random_word (rands) % nbits + 1; - else - dbits = random_word (rands) % maxdbits + 1; - -#if RAND_UNIFORM -#define RANDFUNC mpz_urandomb -#else -#define RANDFUNC mpz_rrandomb -#endif - - do - { - RANDFUNC (n, rands, nbits); - do - { - RANDFUNC (d, rands, dbits); - } - while (mpz_sgn (d) == 0); - - np = PTR (n); - dp = PTR (d); - nn = SIZ (n); - dn = SIZ (d); - } - while (nn < dn); - - dp[0] |= 1; - - mpz_urandomb (tz, rands, 32); - t = mpz_get_ui (tz); - - if (t % 17 == 0) - dp[0] = GMP_NUMB_MAX; - - switch ((int) t % 16) - { - case 0: - clearn = random_word (rands) % nn; - for (i = 0; i <= clearn; i++) - np[i] = 0; - break; - case 1: - mpn_sub_1 (np + nn - dn, dp, dn, random_word (rands)); - break; - case 2: - mpn_add_1 (np + nn - dn, dp, dn, random_word (rands)); - break; - } - - test++; - - binvert_limb (dinv, dp[0]); - - rran0 = random_word (rands); - rran1 = random_word (rands); - qran0 = random_word (rands); - qran1 = random_word (rands); - - qp[-1] = qran0; - qp[nn - dn + 1] = qran1; - rp[-1] = rran0; - - ran = random_word (rands); - - if ((double) (nn - dn) * dn < 1e5) - { - if (nn > dn) - { - /* Test mpn_sbpi1_bdiv_qr */ - MPN_ZERO (qp, nn - dn); - MPN_ZERO (rp, dn); - MPN_COPY (rp, np, nn); - rh = mpn_sbpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_sbpi1_bdiv_qr"); - } - - if (nn > dn) - { - /* Test mpn_sbpi1_bdiv_q */ - MPN_COPY (rp, np, nn); - MPN_ZERO (qp, nn - dn); - mpn_sbpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_q"); - } - } - - if (dn >= 4 && nn - dn >= 2) - { - /* Test mpn_dcpi1_bdiv_qr */ - MPN_COPY (rp, np, nn); - MPN_ZERO (qp, nn - dn); - rh = mpn_dcpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_dcpi1_bdiv_qr"); - } - - if (dn >= 4 && nn - dn >= 2) - { - /* Test mpn_dcpi1_bdiv_q */ - MPN_COPY (rp, np, nn); - MPN_ZERO (qp, nn - dn); - mpn_dcpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_dcpi1_bdiv_q"); - } - - if (nn > dn) - { - /* Test mpn_bdiv_qr */ - itch = mpn_bdiv_qr_itch (nn, dn); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_ZERO (qp, nn - dn); - MPN_ZERO (rp, dn); - rp[dn] = rran1; - rh = mpn_bdiv_qr (qp, rp, np, nn, dp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1); - - check_one (qp, rp, rh, np, nn, dp, dn, "mpn_bdiv_qr"); - } - - if (nn - dn < 2 || dn < 2) - continue; - - /* Test mpn_mu_bdiv_qr */ - itch = mpn_mu_bdiv_qr_itch (nn, dn); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_ZERO (qp, nn - dn); - MPN_ZERO (rp, dn); - rp[dn] = rran1; - rh = mpn_mu_bdiv_qr (qp, rp, np, nn, dp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1); - check_one (qp, rp, rh, np, nn, dp, dn, "mpn_mu_bdiv_qr"); - - /* Test mpn_mu_bdiv_q */ - itch = mpn_mu_bdiv_q_itch (nn, dn); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_ZERO (qp, nn - dn + 1); - mpn_mu_bdiv_q (qp, np, nn - dn, dp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_mu_bdiv_q"); - } - - __GMP_FREE_FUNC_LIMBS (scratch, alloc); - - TMP_FREE; - - mpz_clear (n); - mpz_clear (d); - mpz_clear (tz); - - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-broot.c b/gmp/tests/mpn/t-broot.c deleted file mode 100644 index 1aa43319ec..0000000000 --- a/gmp/tests/mpn/t-broot.c +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> /* for strtol */ -#include <stdio.h> /* for printf */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include "tests/tests.h" - -#define MAX_LIMBS 150 -#define COUNT 500 - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - - mp_ptr ap, rp, pp, scratch; - int count = COUNT; - unsigned i; - TMP_DECL; - - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - ap = TMP_ALLOC_LIMBS (MAX_LIMBS); - rp = TMP_ALLOC_LIMBS (MAX_LIMBS); - pp = TMP_ALLOC_LIMBS (MAX_LIMBS); - scratch = TMP_ALLOC_LIMBS (3*MAX_LIMBS); /* For mpn_powlo */ - - for (i = 0; i < count; i++) - { - mp_size_t n; - mp_limb_t k; - int c; - - n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS); - - if (i & 1) - mpn_random2 (ap, n); - else - mpn_random (ap, n); - - ap[0] |= 1; - - if (i < 100) - k = 3 + 2*i; - else - { - mpn_random (&k, 1); - if (k < 3) - k = 3; - else - k |= 1; - } - mpn_broot (rp, ap, n, k); - mpn_powlo (pp, rp, &k, 1, n, scratch); - - MPN_CMP (c, ap, pp, n); - if (c != 0) - { - gmp_fprintf (stderr, - "mpn_broot returned bad result: %u limbs\n", - (unsigned) n); - gmp_fprintf (stderr, "k = %Mx\n", k); - gmp_fprintf (stderr, "a = %Nx\n", ap, n); - gmp_fprintf (stderr, "r = %Nx\n", rp, n); - gmp_fprintf (stderr, "r^n = %Nx\n", pp, n); - abort (); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-brootinv.c b/gmp/tests/mpn/t-brootinv.c deleted file mode 100644 index 11f40b9543..0000000000 --- a/gmp/tests/mpn/t-brootinv.c +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> /* for strtol */ -#include <stdio.h> /* for printf */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include "tests/tests.h" - -#define MAX_LIMBS 150 -#define COUNT 500 - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - - mp_ptr ap, rp, pp, app, scratch; - int count = COUNT; - unsigned i; - TMP_DECL; - - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - ap = TMP_ALLOC_LIMBS (MAX_LIMBS); - rp = TMP_ALLOC_LIMBS (MAX_LIMBS); - pp = TMP_ALLOC_LIMBS (MAX_LIMBS); - app = TMP_ALLOC_LIMBS (MAX_LIMBS); - scratch = TMP_ALLOC_LIMBS (5*MAX_LIMBS); - - for (i = 0; i < count; i++) - { - mp_size_t n; - mp_limb_t k; - - n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS); - - if (i & 1) - mpn_random2 (ap, n); - else - mpn_random (ap, n); - - ap[0] |= 1; - - if (i < 100) - k = 3 + 2*i; - else - { - mpn_random (&k, 1); - if (k < 3) - k = 3; - else - k |= 1; - } - mpn_brootinv (rp, ap, n, k, scratch); - mpn_powlo (pp, rp, &k, 1, n, scratch); - mpn_mullo_n (app, ap, pp, n); - - if (app[0] != 1 || !mpn_zero_p (app+1, n-1)) - { - gmp_fprintf (stderr, - "mpn_brootinv returned bad result: %u limbs\n", - (unsigned) n); - gmp_fprintf (stderr, "k = %Mx\n", k); - gmp_fprintf (stderr, "a = %Nx\n", ap, n); - gmp_fprintf (stderr, "r = %Nx\n", rp, n); - gmp_fprintf (stderr, "r^n = %Nx\n", pp, n); - gmp_fprintf (stderr, "a r^n = %Nx\n", app, n); - abort (); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-div.c b/gmp/tests/mpn/t-div.c deleted file mode 100644 index 9dbe0f8185..0000000000 --- a/gmp/tests/mpn/t-div.c +++ /dev/null @@ -1,505 +0,0 @@ -/* Copyright 2006, 2007, 2009, 2010, 2013, 2014 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> /* for strtol */ -#include <stdio.h> /* for printf */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include "tests/tests.h" - - -static void -dumpy (mp_srcptr p, mp_size_t n) -{ - mp_size_t i; - if (n > 20) - { - for (i = n - 1; i >= n - 4; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" "); - } - printf ("... "); - for (i = 3; i >= 0; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" " + (i == 0)); - } - } - else - { - for (i = n - 1; i >= 0; i--) - { - printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]); - printf (" " + (i == 0)); - } - } - puts (""); -} - -static signed long test; - -static void -check_one (mp_ptr qp, mp_srcptr rp, - mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, - const char *fname, mp_limb_t q_allowed_err) -{ - mp_size_t qn = nn - dn + 1; - mp_ptr tp; - const char *msg; - const char *tvalue; - mp_limb_t i; - TMP_DECL; - TMP_MARK; - - tp = TMP_ALLOC_LIMBS (nn + 1); - if (dn >= qn) - refmpn_mul (tp, dp, dn, qp, qn); - else - refmpn_mul (tp, qp, qn, dp, dn); - - for (i = 0; i < q_allowed_err && (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0); i++) - ASSERT_NOCARRY (refmpn_sub (tp, tp, nn+1, dp, dn)); - - if (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0) - { - msg = "q too large"; - tvalue = "Q*D"; - error: - printf ("\r*******************************************************************************\n"); - printf ("%s failed test %ld: %s\n", fname, test, msg); - printf ("N= "); dumpy (np, nn); - printf ("D= "); dumpy (dp, dn); - printf ("Q= "); dumpy (qp, qn); - if (rp) - { printf ("R= "); dumpy (rp, dn); } - printf ("%5s=", tvalue); dumpy (tp, nn+1); - printf ("nn = %ld, dn = %ld, qn = %ld\n", nn, dn, qn); - abort (); - } - - ASSERT_NOCARRY (refmpn_sub_n (tp, np, tp, nn)); - tvalue = "N-Q*D"; - if (!mpn_zero_p (tp + dn, nn - dn) || mpn_cmp (tp, dp, dn) >= 0) - { - msg = "q too small"; - goto error; - } - - if (rp && mpn_cmp (rp, tp, dn) != 0) - { - msg = "r incorrect"; - goto error; - } - - TMP_FREE; -} - - -/* These are *bit* sizes. */ -#ifndef SIZE_LOG -#define SIZE_LOG 17 -#endif -#define MAX_DN (1L << SIZE_LOG) -#define MAX_NN (1L << (SIZE_LOG + 1)) - -#define COUNT 200 - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - unsigned long maxnbits, maxdbits, nbits, dbits; - mpz_t n, d, q, r, tz, junk; - mp_size_t maxnn, maxdn, nn, dn, clearn, i; - mp_ptr np, dup, dnp, qp, rp, junkp; - mp_limb_t t; - gmp_pi1_t dinv; - long count = COUNT; - mp_ptr scratch; - mp_limb_t ran; - mp_size_t alloc, itch; - mp_limb_t rran0, rran1, qran0, qran1; - TMP_DECL; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - maxdbits = MAX_DN; - maxnbits = MAX_NN; - - tests_start (); - rands = RANDS; - - mpz_init (n); - mpz_init (d); - mpz_init (q); - mpz_init (r); - mpz_init (tz); - mpz_init (junk); - - maxnn = maxnbits / GMP_NUMB_BITS + 1; - maxdn = maxdbits / GMP_NUMB_BITS + 1; - - TMP_MARK; - - qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1; - rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1; - dnp = TMP_ALLOC_LIMBS (maxdn); - - alloc = 1; - scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc); - - for (test = -300; test < count; test++) - { - nbits = urandom () % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS; - - if (test < 0) - dbits = (test + 300) % (nbits - 1) + 1; - else - dbits = urandom () % (nbits - 1) % maxdbits + 1; - -#if RAND_UNIFORM -#define RANDFUNC mpz_urandomb -#else -#define RANDFUNC mpz_rrandomb -#endif - - do - RANDFUNC (d, rands, dbits); - while (mpz_sgn (d) == 0); - dn = SIZ (d); - dup = PTR (d); - MPN_COPY (dnp, dup, dn); - dnp[dn - 1] |= GMP_NUMB_HIGHBIT; - - if (test % 2 == 0) - { - RANDFUNC (n, rands, nbits); - nn = SIZ (n); - ASSERT_ALWAYS (nn >= dn); - } - else - { - do - { - RANDFUNC (q, rands, urandom () % (nbits - dbits + 1)); - RANDFUNC (r, rands, urandom () % mpz_sizeinbase (d, 2)); - mpz_mul (n, q, d); - mpz_add (n, n, r); - nn = SIZ (n); - } - while (nn > maxnn || nn < dn); - } - - ASSERT_ALWAYS (nn <= maxnn); - ASSERT_ALWAYS (dn <= maxdn); - - mpz_urandomb (junk, rands, nbits); - junkp = PTR (junk); - - np = PTR (n); - - mpz_urandomb (tz, rands, 32); - t = mpz_get_ui (tz); - - if (t % 17 == 0) - { - dnp[dn - 1] = GMP_NUMB_MAX; - dup[dn - 1] = GMP_NUMB_MAX; - } - - switch ((int) t % 16) - { - case 0: - clearn = urandom () % nn; - for (i = clearn; i < nn; i++) - np[i] = 0; - break; - case 1: - mpn_sub_1 (np + nn - dn, dnp, dn, urandom ()); - break; - case 2: - mpn_add_1 (np + nn - dn, dnp, dn, urandom ()); - break; - } - - if (dn >= 2) - invert_pi1 (dinv, dnp[dn - 1], dnp[dn - 2]); - - rran0 = urandom (); - rran1 = urandom (); - qran0 = urandom (); - qran1 = urandom (); - - qp[-1] = qran0; - qp[nn - dn + 1] = qran1; - rp[-1] = rran0; - - ran = urandom (); - - if ((double) (nn - dn) * dn < 1e5) - { - /* Test mpn_sbpi1_div_qr */ - if (dn > 2) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_sbpi1_div_qr (qp, rp, nn, dnp, dn, dinv.inv32); - check_one (qp, rp, np, nn, dnp, dn, "mpn_sbpi1_div_qr", 0); - } - - /* Test mpn_sbpi1_divappr_q */ - if (dn > 2) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_sbpi1_divappr_q (qp, rp, nn, dnp, dn, dinv.inv32); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_divappr_q", 1); - } - - /* Test mpn_sbpi1_div_q */ - if (dn > 2) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_sbpi1_div_q (qp, rp, nn, dnp, dn, dinv.inv32); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_div_q", 0); - } - - /* Test mpn_sec_div_qr */ - itch = mpn_sec_div_qr_itch (nn, dn); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_COPY (rp, np, nn); - if (nn >= dn) - MPN_COPY (qp, junkp, nn - dn + 1); - qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dup, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr (unnorm)", 0); - - /* Test mpn_sec_div_r */ - itch = mpn_sec_div_r_itch (nn, dn); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_COPY (rp, np, nn); - mpn_sec_div_r (rp, nn, dup, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - /* Note: Since check_one cannot cope with remainder-only functions, we - pass qp[] from the previous function, mpn_sec_div_qr. */ - check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_r (unnorm)", 0); - - /* Normalised case, mpn_sec_div_qr */ - itch = mpn_sec_div_qr_itch (nn, dn); - scratch[itch] = ran; - - MPN_COPY (rp, np, nn); - if (nn >= dn) - MPN_COPY (qp, junkp, nn - dn + 1); - qp[nn - dn] = mpn_sec_div_qr (qp, rp, nn, dnp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_qr (norm)", 0); - - /* Normalised case, mpn_sec_div_r */ - itch = mpn_sec_div_r_itch (nn, dn); - scratch[itch] = ran; - MPN_COPY (rp, np, nn); - mpn_sec_div_r (rp, nn, dnp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - /* Note: Since check_one cannot cope with remainder-only functions, we - pass qp[] from the previous function, mpn_sec_div_qr. */ - check_one (qp, rp, np, nn, dnp, dn, "mpn_sec_div_r (norm)", 0); - } - - /* Test mpn_dcpi1_div_qr */ - if (dn >= 6 && nn - dn >= 3) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_dcpi1_div_qr (qp, rp, nn, dnp, dn, &dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, rp, np, nn, dnp, dn, "mpn_dcpi1_div_qr", 0); - } - - /* Test mpn_dcpi1_divappr_q */ - if (dn >= 6 && nn - dn >= 3) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_dcpi1_divappr_q (qp, rp, nn, dnp, dn, &dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_divappr_q", 1); - } - - /* Test mpn_dcpi1_div_q */ - if (dn >= 6 && nn - dn >= 3) - { - MPN_COPY (rp, np, nn); - if (nn > dn) - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_dcpi1_div_q (qp, rp, nn, dnp, dn, &dinv); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_div_q", 0); - } - - /* Test mpn_mu_div_qr */ - if (nn - dn > 2 && dn >= 2) - { - itch = mpn_mu_div_qr_itch (nn, dn, 0); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_COPY (qp, junkp, nn - dn); - MPN_ZERO (rp, dn); - rp[dn] = rran1; - qp[nn - dn] = mpn_mu_div_qr (qp, rp, np, nn, dnp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1); - check_one (qp, rp, np, nn, dnp, dn, "mpn_mu_div_qr", 0); - } - - /* Test mpn_mu_divappr_q */ - if (nn - dn > 2 && dn >= 2) - { - itch = mpn_mu_divappr_q_itch (nn, dn, 0); - if (itch + 1 > alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_mu_divappr_q (qp, np, nn, dnp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_divappr_q", 4); - } - - /* Test mpn_mu_div_q */ - if (nn - dn > 2 && dn >= 2) - { - itch = mpn_mu_div_q_itch (nn, dn, 0); - if (itch + 1> alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - MPN_COPY (qp, junkp, nn - dn); - qp[nn - dn] = mpn_mu_div_q (qp, np, nn, dnp, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_div_q", 0); - } - - if (1) - { - itch = nn + 1; - if (itch + 1> alloc) - { - scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1); - alloc = itch + 1; - } - scratch[itch] = ran; - mpn_div_q (qp, np, nn, dup, dn, scratch); - ASSERT_ALWAYS (ran == scratch[itch]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1); - check_one (qp, NULL, np, nn, dup, dn, "mpn_div_q", 0); - } - - if (dn >= 2 && nn >= 2) - { - mp_limb_t qh; - - /* mpn_divrem_2 */ - MPN_COPY (rp, np, nn); - qp[nn - 2] = qp[nn-1] = qran1; - - qh = mpn_divrem_2 (qp, 0, rp, nn, dnp + dn - 2); - ASSERT_ALWAYS (qp[nn - 2] == qran1); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1); - qp[nn - 2] = qh; - check_one (qp, rp, np, nn, dnp + dn - 2, 2, "mpn_divrem_2", 0); - - /* Missing: divrem_2 with fraction limbs. */ - - /* mpn_div_qr_2 */ - qp[nn - 2] = qran1; - - qh = mpn_div_qr_2 (qp, rp, np, nn, dup + dn - 2); - ASSERT_ALWAYS (qp[nn - 2] == qran1); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1); - qp[nn - 2] = qh; - check_one (qp, rp, np, nn, dup + dn - 2, 2, "mpn_div_qr_2", 0); - } - if (dn >= 1 && nn >= 1) - { - /* mpn_div_qr_1 */ - mp_limb_t qh; - qp[nn-1] = qran1; - rp[0] = mpn_div_qr_1 (qp, &qh, np, nn, dnp[dn - 1]); - ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1); - qp[nn - 1] = qh; - check_one (qp, rp, np, nn, dnp + dn - 1, 1, "mpn_div_qr_1", 0); - } - } - - __GMP_FREE_FUNC_LIMBS (scratch, alloc); - - TMP_FREE; - - mpz_clear (n); - mpz_clear (d); - mpz_clear (q); - mpz_clear (r); - mpz_clear (tz); - mpz_clear (junk); - - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-divrem_1.c b/gmp/tests/mpn/t-divrem_1.c index 9ffe90548f..27eba9c0b0 100644 --- a/gmp/tests/mpn/t-divrem_1.c +++ b/gmp/tests/mpn/t-divrem_1.c @@ -2,20 +2,20 @@ Copyright 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -42,11 +42,6 @@ check_data (void) { { 5 }, 1, 2, 0, { 2 }, 1}, - /* Exercises the q update in the nl == constant 0 case of - udiv_qrnnd_preinv3. Test case copied from t-fat.c. */ - { { 287 }, 1, 7, 1, - { 0, 41 }, 0 }, - #if GMP_NUMB_BITS == 32 { { 0x3C }, 1, 0xF2, 1, { 0x3F789854, 0 }, 0x98 }, diff --git a/gmp/tests/mpn/t-fat.c b/gmp/tests/mpn/t-fat.c index abb288e4b0..9e208245fe 100644 --- a/gmp/tests/mpn/t-fat.c +++ b/gmp/tests/mpn/t-fat.c @@ -1,21 +1,21 @@ /* Test fat binary setups. -Copyright 2003, 2012 Free Software Foundation, Inc. +Copyright 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -66,7 +66,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ /* dummies when not a fat binary */ #if ! WANT_FAT_BINARY struct cpuvec_t { - int dummy; + int initialized; }; struct cpuvec_t __gmpn_cpuvec; #define ITERATE_FAT_THRESHOLDS() do { } while (0) @@ -207,15 +207,6 @@ check_functions (void) ASSERT_ALWAYS (wp[1] == 0); } - memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec)); - for (i = 0; i < 2; i++) - { - xp[0] = 5; - yp[0] = 7; - mpn_mullo_basecase (wp, xp, yp, (mp_size_t) 1); - ASSERT_ALWAYS (wp[0] == 35); - } - #if HAVE_NATIVE_mpn_preinv_divrem_1 && GMP_NAIL_BITS == 0 memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec)); for (i = 0; i < 2; i++) @@ -278,18 +269,17 @@ check_functions (void) } } -/* Expect the first use of each fat threshold to invoke the necessary +/* Expect the first use of a each fat threshold to invoke the necessary initialization. */ void check_thresholds (void) { #define ITERATE(name,field) \ do { \ - __gmpn_cpuvec_initialized = 0; \ memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec)); \ ASSERT_ALWAYS (name != 0); \ ASSERT_ALWAYS (name == __gmpn_cpuvec.field); \ - ASSERT_ALWAYS (__gmpn_cpuvec_initialized); \ + ASSERT_ALWAYS (__gmpn_cpuvec.initialized); \ } while (0) ITERATE_FAT_THRESHOLDS (); diff --git a/gmp/tests/mpn/t-get_d.c b/gmp/tests/mpn/t-get_d.c index 1499391e06..c3999e2a7c 100644 --- a/gmp/tests/mpn/t-get_d.c +++ b/gmp/tests/mpn/t-get_d.c @@ -1,21 +1,27 @@ /* Test mpn_get_d. -Copyright 2002-2004 Free Software Foundation, Inc. +Copyright 2002, 2003, 2004 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ + +/* Note that we don't use <limits.h> for LONG_MIN, but instead our own + definition in gmp-impl.h. In gcc 2.95.4 (debian 3.0) under + -mcpu=ultrasparc, limits.h sees __sparc_v9__ defined and assumes that + means long is 64-bit long, but it's only 32-bits, causing fatal compile + errors. */ #include "config.h" @@ -65,7 +71,7 @@ check_onebit (void) }; /* FIXME: It'd be better to base this on the float format. */ -#if defined (__vax) || defined (__vax__) +#ifdef __vax int limit = 127; /* vax fp numbers have limited range */ #else int limit = 511; @@ -90,7 +96,7 @@ check_onebit (void) exp = exp_table[exp_i]; want_bit = bit + exp; - if (want_bit >= limit || want_bit <= -limit) + if (want_bit > limit || want_bit < -limit) continue; want = 1.0; @@ -489,9 +495,7 @@ main (void) check_ieee_denorm (); check_ieee_overflow (); check_0x81c25113 (); -#if ! (defined (__vax) || defined (__vax__)) check_rand (); -#endif tests_end (); exit (0); diff --git a/gmp/tests/mpn/t-hgcd.c b/gmp/tests/mpn/t-hgcd.c index 64d33ef006..f2e3692fff 100644 --- a/gmp/tests/mpn/t-hgcd.c +++ b/gmp/tests/mpn/t-hgcd.c @@ -1,22 +1,22 @@ -/* Test mpn_hgcd. +/* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui. -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation, -Inc. +Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free +Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ #include "gmp-impl.h" #include "tests.h" -static mp_size_t one_test (mpz_t, mpz_t, int); -static void debug_mp (mpz_t, int); +static mp_size_t one_test __GMP_PROTO ((mpz_t, mpz_t, int)); +static void debug_mp __GMP_PROTO ((mpz_t, int)); #define MIN_OPERAND_SIZE 2 @@ -50,10 +50,10 @@ struct hgcd_ref mpz_t m[2][2]; }; -static void hgcd_ref_init (struct hgcd_ref *); -static void hgcd_ref_clear (struct hgcd_ref *); -static int hgcd_ref (struct hgcd_ref *, mpz_t, mpz_t); -static int hgcd_ref_equal (const struct hgcd_matrix *, const struct hgcd_ref *); +static void hgcd_ref_init __GMP_PROTO ((struct hgcd_ref *hgcd)); +static void hgcd_ref_clear __GMP_PROTO ((struct hgcd_ref *hgcd)); +static int hgcd_ref __GMP_PROTO ((struct hgcd_ref *hgcd, mpz_t a, mpz_t b)); +static int hgcd_ref_equal __GMP_PROTO ((const struct hgcd_matrix *hgcd, const struct hgcd_ref *ref)); int main (int argc, char **argv) @@ -97,15 +97,17 @@ main (int argc, char **argv) { /* Generate plain operands with unknown gcd. These types of operands have proven to trigger certain bugs in development versions of the - gcd code. */ + gcd code. The "hgcd->row[3].rsize > M" ASSERT is not triggered by + the division chain code below, but that is most likely just a result + of that other ASSERTs are triggered before it. */ mpz_urandomb (bs, rands, 32); size_range = mpz_get_ui (bs) % 13 + 2; mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); + mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); mpz_urandomb (bs, rands, size_range); - mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); + mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); if (mpz_cmp (op1, op2) < 0) mpz_swap (op1, op2); @@ -160,13 +162,6 @@ main (int argc, char **argv) one_test (op1, op2, i); } - mpz_clear (bs); - mpz_clear (op1); - mpz_clear (op2); - mpz_clear (temp1); - mpz_clear (temp2); - - tests_end (); exit (0); } diff --git a/gmp/tests/mpn/t-hgcd_appr.c b/gmp/tests/mpn/t-hgcd_appr.c deleted file mode 100644 index 23ffbf0b76..0000000000 --- a/gmp/tests/mpn/t-hgcd_appr.c +++ /dev/null @@ -1,564 +0,0 @@ -/* Test mpn_hgcd_appr. - -Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004, 2011 Free Software -Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -static mp_size_t one_test (mpz_t, mpz_t, int); -static void debug_mp (mpz_t, int); - -#define MIN_OPERAND_SIZE 2 - -struct hgcd_ref -{ - mpz_t m[2][2]; -}; - -static void hgcd_ref_init (struct hgcd_ref *hgcd); -static void hgcd_ref_clear (struct hgcd_ref *hgcd); -static int hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b); -static int hgcd_ref_equal (const struct hgcd_ref *, const struct hgcd_ref *); -static int hgcd_appr_valid_p (mpz_t, mpz_t, mp_size_t, struct hgcd_ref *, - mpz_t, mpz_t, mp_size_t, struct hgcd_matrix *); - -static int verbose_flag = 0; - -int -main (int argc, char **argv) -{ - mpz_t op1, op2, temp1, temp2; - int i, j, chain_len; - gmp_randstate_ptr rands; - mpz_t bs; - unsigned long size_range; - - if (argc > 1) - { - if (strcmp (argv[1], "-v") == 0) - verbose_flag = 1; - else - { - fprintf (stderr, "Invalid argument.\n"); - return 1; - } - } - - tests_start (); - rands = RANDS; - - mpz_init (bs); - mpz_init (op1); - mpz_init (op2); - mpz_init (temp1); - mpz_init (temp2); - - for (i = 0; i < 15; i++) - { - /* Generate plain operands with unknown gcd. These types of operands - have proven to trigger certain bugs in development versions of the - gcd code. */ - - mpz_urandomb (bs, rands, 32); - size_range = mpz_get_ui (bs) % 13 + 2; - - mpz_urandomb (bs, rands, size_range); - mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); - mpz_urandomb (bs, rands, size_range); - mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE); - - if (mpz_cmp (op1, op2) < 0) - mpz_swap (op1, op2); - - if (mpz_size (op1) > 0) - one_test (op1, op2, i); - - /* Generate a division chain backwards, allowing otherwise - unlikely huge quotients. */ - - mpz_set_ui (op1, 0); - mpz_urandomb (bs, rands, 32); - mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1); - mpz_rrandomb (op2, rands, mpz_get_ui (bs)); - mpz_add_ui (op2, op2, 1); - -#if 0 - chain_len = 1000000; -#else - mpz_urandomb (bs, rands, 32); - chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * GCD_DC_THRESHOLD / 256); -#endif - - for (j = 0; j < chain_len; j++) - { - mpz_urandomb (bs, rands, 32); - mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1); - mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1); - mpz_add_ui (temp2, temp2, 1); - mpz_mul (temp1, op2, temp2); - mpz_add (op1, op1, temp1); - - /* Don't generate overly huge operands. */ - if (SIZ (op1) > 3 * GCD_DC_THRESHOLD) - break; - - mpz_urandomb (bs, rands, 32); - mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1); - mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1); - mpz_add_ui (temp2, temp2, 1); - mpz_mul (temp1, op1, temp2); - mpz_add (op2, op2, temp1); - - /* Don't generate overly huge operands. */ - if (SIZ (op2) > 3 * GCD_DC_THRESHOLD) - break; - } - if (mpz_cmp (op1, op2) < 0) - mpz_swap (op1, op2); - - if (mpz_size (op1) > 0) - one_test (op1, op2, i); - } - - mpz_clear (bs); - mpz_clear (op1); - mpz_clear (op2); - mpz_clear (temp1); - mpz_clear (temp2); - - tests_end (); - exit (0); -} - -static void -debug_mp (mpz_t x, int base) -{ - mpz_out_str (stderr, base, x); fputc ('\n', stderr); -} - -static mp_size_t -one_test (mpz_t a, mpz_t b, int i) -{ - struct hgcd_matrix hgcd; - struct hgcd_ref ref; - - mpz_t ref_r0; - mpz_t ref_r1; - mpz_t hgcd_r0; - mpz_t hgcd_r1; - - int res[2]; - mp_size_t asize; - mp_size_t bsize; - - mp_size_t hgcd_init_scratch; - mp_size_t hgcd_scratch; - - mp_ptr hgcd_init_tp; - mp_ptr hgcd_tp; - mp_limb_t marker[4]; - - asize = a->_mp_size; - bsize = b->_mp_size; - - ASSERT (asize >= bsize); - - hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (asize); - hgcd_init_tp = refmpn_malloc_limbs (hgcd_init_scratch + 2) + 1; - mpn_hgcd_matrix_init (&hgcd, asize, hgcd_init_tp); - - hgcd_scratch = mpn_hgcd_appr_itch (asize); - hgcd_tp = refmpn_malloc_limbs (hgcd_scratch + 2) + 1; - - mpn_random (marker, 4); - - hgcd_init_tp[-1] = marker[0]; - hgcd_init_tp[hgcd_init_scratch] = marker[1]; - hgcd_tp[-1] = marker[2]; - hgcd_tp[hgcd_scratch] = marker[3]; - -#if 0 - fprintf (stderr, - "one_test: i = %d asize = %d, bsize = %d\n", - i, a->_mp_size, b->_mp_size); - - gmp_fprintf (stderr, - "one_test: i = %d\n" - " a = %Zx\n" - " b = %Zx\n", - i, a, b); -#endif - hgcd_ref_init (&ref); - - mpz_init_set (ref_r0, a); - mpz_init_set (ref_r1, b); - res[0] = hgcd_ref (&ref, ref_r0, ref_r1); - - mpz_init_set (hgcd_r0, a); - mpz_init_set (hgcd_r1, b); - if (bsize < asize) - { - _mpz_realloc (hgcd_r1, asize); - MPN_ZERO (hgcd_r1->_mp_d + bsize, asize - bsize); - } - res[1] = mpn_hgcd_appr (hgcd_r0->_mp_d, - hgcd_r1->_mp_d, - asize, - &hgcd, hgcd_tp); - - if (hgcd_init_tp[-1] != marker[0] - || hgcd_init_tp[hgcd_init_scratch] != marker[1] - || hgcd_tp[-1] != marker[2] - || hgcd_tp[hgcd_scratch] != marker[3]) - { - fprintf (stderr, "ERROR in test %d\n", i); - fprintf (stderr, "scratch space overwritten!\n"); - - if (hgcd_init_tp[-1] != marker[0]) - gmp_fprintf (stderr, - "before init_tp: %Mx\n" - "expected: %Mx\n", - hgcd_init_tp[-1], marker[0]); - if (hgcd_init_tp[hgcd_init_scratch] != marker[1]) - gmp_fprintf (stderr, - "after init_tp: %Mx\n" - "expected: %Mx\n", - hgcd_init_tp[hgcd_init_scratch], marker[1]); - if (hgcd_tp[-1] != marker[2]) - gmp_fprintf (stderr, - "before tp: %Mx\n" - "expected: %Mx\n", - hgcd_tp[-1], marker[2]); - if (hgcd_tp[hgcd_scratch] != marker[3]) - gmp_fprintf (stderr, - "after tp: %Mx\n" - "expected: %Mx\n", - hgcd_tp[hgcd_scratch], marker[3]); - - abort (); - } - - if (!hgcd_appr_valid_p (a, b, res[0], &ref, ref_r0, ref_r1, - res[1], &hgcd)) - { - fprintf (stderr, "ERROR in test %d\n", i); - fprintf (stderr, "Invalid results for hgcd and hgcd_ref\n"); - fprintf (stderr, "op1="); debug_mp (a, -16); - fprintf (stderr, "op2="); debug_mp (b, -16); - fprintf (stderr, "hgcd_ref: %ld\n", (long) res[0]); - fprintf (stderr, "mpn_hgcd_appr: %ld\n", (long) res[1]); - abort (); - } - - refmpn_free_limbs (hgcd_init_tp - 1); - refmpn_free_limbs (hgcd_tp - 1); - hgcd_ref_clear (&ref); - mpz_clear (ref_r0); - mpz_clear (ref_r1); - mpz_clear (hgcd_r0); - mpz_clear (hgcd_r1); - - return res[0]; -} - -static void -hgcd_ref_init (struct hgcd_ref *hgcd) -{ - unsigned i; - for (i = 0; i<2; i++) - { - unsigned j; - for (j = 0; j<2; j++) - mpz_init (hgcd->m[i][j]); - } -} - -static void -hgcd_ref_clear (struct hgcd_ref *hgcd) -{ - unsigned i; - for (i = 0; i<2; i++) - { - unsigned j; - for (j = 0; j<2; j++) - mpz_clear (hgcd->m[i][j]); - } -} - -static int -sdiv_qr (mpz_t q, mpz_t r, mp_size_t s, const mpz_t a, const mpz_t b) -{ - mpz_fdiv_qr (q, r, a, b); - if (mpz_size (r) <= s) - { - mpz_add (r, r, b); - mpz_sub_ui (q, q, 1); - } - - return (mpz_sgn (q) > 0); -} - -static int -hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b) -{ - mp_size_t n = MAX (mpz_size (a), mpz_size (b)); - mp_size_t s = n/2 + 1; - mpz_t q; - int res; - - if (mpz_size (a) <= s || mpz_size (b) <= s) - return 0; - - res = mpz_cmp (a, b); - if (res < 0) - { - mpz_sub (b, b, a); - if (mpz_size (b) <= s) - return 0; - - mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 0); - mpz_set_ui (hgcd->m[1][0], 1); mpz_set_ui (hgcd->m[1][1], 1); - } - else if (res > 0) - { - mpz_sub (a, a, b); - if (mpz_size (a) <= s) - return 0; - - mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 1); - mpz_set_ui (hgcd->m[1][0], 0); mpz_set_ui (hgcd->m[1][1], 1); - } - else - return 0; - - mpz_init (q); - - for (;;) - { - ASSERT (mpz_size (a) > s); - ASSERT (mpz_size (b) > s); - - if (mpz_cmp (a, b) > 0) - { - if (!sdiv_qr (q, a, s, a, b)) - break; - mpz_addmul (hgcd->m[0][1], q, hgcd->m[0][0]); - mpz_addmul (hgcd->m[1][1], q, hgcd->m[1][0]); - } - else - { - if (!sdiv_qr (q, b, s, b, a)) - break; - mpz_addmul (hgcd->m[0][0], q, hgcd->m[0][1]); - mpz_addmul (hgcd->m[1][0], q, hgcd->m[1][1]); - } - } - - mpz_clear (q); - - return 1; -} - -static int -hgcd_ref_equal (const struct hgcd_ref *A, const struct hgcd_ref *B) -{ - unsigned i; - - for (i = 0; i<2; i++) - { - unsigned j; - - for (j = 0; j<2; j++) - if (mpz_cmp (A->m[i][j], B->m[i][j]) != 0) - return 0; - } - - return 1; -} - -static int -hgcd_appr_valid_p (mpz_t a, mpz_t b, mp_size_t res0, - struct hgcd_ref *ref, mpz_t ref_r0, mpz_t ref_r1, - mp_size_t res1, struct hgcd_matrix *hgcd) -{ - mp_size_t n = MAX (mpz_size (a), mpz_size (b)); - mp_size_t s = n/2 + 1; - - mp_bitcnt_t dbits, abits, margin; - mpz_t appr_r0, appr_r1, t, q; - struct hgcd_ref appr; - - if (!res0) - { - if (!res1) - return 1; - - fprintf (stderr, "mpn_hgcd_appr returned 1 when no reduction possible.\n"); - return 0; - } - - /* NOTE: No *_clear calls on error return, since we're going to - abort anyway. */ - mpz_init (t); - mpz_init (q); - hgcd_ref_init (&appr); - mpz_init (appr_r0); - mpz_init (appr_r1); - - if (mpz_size (ref_r0) <= s) - { - fprintf (stderr, "ref_r0 too small!!!: "); debug_mp (ref_r0, 16); - return 0; - } - if (mpz_size (ref_r1) <= s) - { - fprintf (stderr, "ref_r1 too small!!!: "); debug_mp (ref_r1, 16); - return 0; - } - - mpz_sub (t, ref_r0, ref_r1); - dbits = mpz_sizeinbase (t, 2); - if (dbits > s*GMP_NUMB_BITS) - { - fprintf (stderr, "ref |r0 - r1| too large!!!: "); debug_mp (t, 16); - return 0; - } - - if (!res1) - { - mpz_set (appr_r0, a); - mpz_set (appr_r1, b); - } - else - { - unsigned i; - - for (i = 0; i<2; i++) - { - unsigned j; - - for (j = 0; j<2; j++) - { - mp_size_t mn = hgcd->n; - MPN_NORMALIZE (hgcd->p[i][j], mn); - mpz_realloc (appr.m[i][j], mn); - MPN_COPY (PTR (appr.m[i][j]), hgcd->p[i][j], mn); - SIZ (appr.m[i][j]) = mn; - } - } - mpz_mul (appr_r0, appr.m[1][1], a); - mpz_mul (t, appr.m[0][1], b); - mpz_sub (appr_r0, appr_r0, t); - if (mpz_sgn (appr_r0) <= 0 - || mpz_size (appr_r0) <= s) - { - fprintf (stderr, "appr_r0 too small: "); debug_mp (appr_r0, 16); - return 0; - } - - mpz_mul (appr_r1, appr.m[1][0], a); - mpz_mul (t, appr.m[0][0], b); - mpz_sub (appr_r1, t, appr_r1); - if (mpz_sgn (appr_r1) <= 0 - || mpz_size (appr_r1) <= s) - { - fprintf (stderr, "appr_r1 too small: "); debug_mp (appr_r1, 16); - return 0; - } - } - - mpz_sub (t, appr_r0, appr_r1); - abits = mpz_sizeinbase (t, 2); - if (abits < dbits) - { - fprintf (stderr, "|r0 - r1| too small: "); debug_mp (t, 16); - return 0; - } - - /* We lose one bit each time we discard the least significant limbs. - For the lehmer code, that can happen at most s * (GMP_NUMB_BITS) - / (GMP_NUMB_BITS - 1) times. For the dc code, we lose an entire - limb (or more?) for each level of recursion. */ - - margin = (n/2+1) * GMP_NUMB_BITS / (GMP_NUMB_BITS - 1); - { - mp_size_t rn; - for (rn = n; ABOVE_THRESHOLD (rn, HGCD_APPR_THRESHOLD); rn = (rn + 1)/2) - margin += GMP_NUMB_BITS; - } - - if (verbose_flag && abits > dbits) - fprintf (stderr, "n = %u: sbits = %u: ref #(r0-r1): %u, appr #(r0-r1): %u excess: %d, margin: %u\n", - (unsigned) n, (unsigned) s*GMP_NUMB_BITS, - (unsigned) dbits, (unsigned) abits, - (int) (abits - s * GMP_NUMB_BITS), (unsigned) margin); - - if (abits > s*GMP_NUMB_BITS + margin) - { - fprintf (stderr, "appr |r0 - r1| much larger than minimal (by %u bits, margin = %u bits)\n", - (unsigned) (abits - s*GMP_NUMB_BITS), (unsigned) margin); - return 0; - } - - while (mpz_cmp (appr_r0, ref_r0) > 0 || mpz_cmp (appr_r1, ref_r1) > 0) - { - ASSERT (mpz_size (appr_r0) > s); - ASSERT (mpz_size (appr_r1) > s); - - if (mpz_cmp (appr_r0, appr_r1) > 0) - { - if (!sdiv_qr (q, appr_r0, s, appr_r0, appr_r1)) - break; - mpz_addmul (appr.m[0][1], q, appr.m[0][0]); - mpz_addmul (appr.m[1][1], q, appr.m[1][0]); - } - else - { - if (!sdiv_qr (q, appr_r1, s, appr_r1, appr_r0)) - break; - mpz_addmul (appr.m[0][0], q, appr.m[0][1]); - mpz_addmul (appr.m[1][0], q, appr.m[1][1]); - } - } - - if (mpz_cmp (appr_r0, ref_r0) != 0 - || mpz_cmp (appr_r1, ref_r1) != 0 - || !hgcd_ref_equal (ref, &appr)) - { - fprintf (stderr, "appr_r0: "); debug_mp (appr_r0, 16); - fprintf (stderr, "ref_r0: "); debug_mp (ref_r0, 16); - - fprintf (stderr, "appr_r1: "); debug_mp (appr_r1, 16); - fprintf (stderr, "ref_r1: "); debug_mp (ref_r1, 16); - - return 0; - } - mpz_clear (t); - mpz_clear (q); - hgcd_ref_clear (&appr); - mpz_clear (appr_r0); - mpz_clear (appr_r1); - - return 1; -} diff --git a/gmp/tests/mpn/t-instrument.c b/gmp/tests/mpn/t-instrument.c index 338fef1773..98e35fdc14 100644 --- a/gmp/tests/mpn/t-instrument.c +++ b/gmp/tests/mpn/t-instrument.c @@ -2,20 +2,20 @@ Copyright 2002, 2003 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -50,8 +50,8 @@ struct { int ncall; -void __cyg_profile_func_enter (void *, void *) - __attribute__ ((no_instrument_function)); +void __cyg_profile_func_enter __GMP_PROTO ((void *this_fn, void *call_site)) + __attribute__ ((no_instrument_function)); void __cyg_profile_func_enter (void *this_fn, void *call_site) @@ -74,8 +74,8 @@ __cyg_profile_func_enter (void *this_fn, void *call_site) ncall++; } -void __cyg_profile_func_exit (void *, void *) - __attribute__ ((no_instrument_function)); +void __cyg_profile_func_exit __GMP_PROTO ((void *this_fn, void *call_site)) + __attribute__ ((no_instrument_function)); void __cyg_profile_func_exit (void *this_fn, void *call_site) @@ -176,9 +176,9 @@ check (void) post (); #endif -#if HAVE_NATIVE_mpn_com - pre ("mpn_com"); - mpn_com (wp, xp, size); +#if HAVE_NATIVE_mpn_com_n + pre ("mpn_com_n"); + mpn_com_n (wp, xp, size); post (); #endif diff --git a/gmp/tests/mpn/t-invert.c b/gmp/tests/mpn/t-invert.c deleted file mode 100644 index c9b0080b76..0000000000 --- a/gmp/tests/mpn/t-invert.c +++ /dev/null @@ -1,161 +0,0 @@ -/* Test for mpn_invert function. - - Contributed to the GNU project by Marco Bodrato. - -Copyright 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 12 -#endif - -#ifndef COUNT -#define COUNT 1000 -#endif - -#define MAX_N (1L << SIZE_LOG) -#define MIN_N 1 - - -static int -invert_valid (mp_srcptr ip, mp_srcptr dp, mp_size_t n) -{ - mp_ptr tp; - int cy; - TMP_DECL; - - TMP_MARK; - tp = TMP_ALLOC_LIMBS (2*n); - - refmpn_mul (tp, ip, n, dp, n); - cy = refmpn_add_n (tp + n, tp + n, dp, n); /* This must not give a carry. */ - cy -= refmpn_add (tp, tp, 2*n, dp, n); /* This must give a carry. */ - TMP_FREE; - - return (cy == -1); -} - -/* - Check the result of the mpn_invert function in the library. -*/ - -int -main (int argc, char **argv) -{ - mp_ptr ip, dp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - dp = TMP_ALLOC_LIMBS (MAX_N); - ip = 1+TMP_ALLOC_LIMBS (MAX_N + 2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_invert_itch (MAX_N) + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t n; - mp_size_t itch; - mp_limb_t i_before, i_after, s_before, s_after; - - for (size_min = 1; (1L << size_min) < MIN_N; size_min++) - ; - - /* We generate an in the MIN_N <= n <= (1 << size_range). */ - size_range = size_min - + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min); - - n = MIN_N - + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N); - - mpn_random2 (dp, n); - - mpn_random2 (ip-1, n + 2); - i_before = ip[-1]; - i_after = ip[n]; - - itch = mpn_invert_itch (n); - ASSERT_ALWAYS (itch <= mpn_invert_itch (MAX_N)); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - dp[n-1] |= GMP_NUMB_HIGHBIT; - mpn_invert (ip, dp, n, scratch); - if (ip[-1] != i_before || ip[n] != i_after - || scratch[-1] != s_before || scratch[itch] != s_after - || ! invert_valid(ip, dp, n)) - { - printf ("ERROR in test %d, n = %d\n", - test, (int) n); - if (ip[-1] != i_before) - { - printf ("before ip:"); mpn_dump (ip -1, 1); - printf ("keep: "); mpn_dump (&i_before, 1); - } - if (ip[n] != i_after) - { - printf ("after ip:"); mpn_dump (ip + n, 1); - printf ("keep: "); mpn_dump (&i_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (dp, n); - mpn_dump (ip, n); - - abort(); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-iord_u.c b/gmp/tests/mpn/t-iord_u.c index 93e68c5c3f..3b472fd616 100644 --- a/gmp/tests/mpn/t-iord_u.c +++ b/gmp/tests/mpn/t-iord_u.c @@ -2,20 +2,20 @@ Copyright 2001, 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> diff --git a/gmp/tests/mpn/t-matrix22.c b/gmp/tests/mpn/t-matrix22.c index e63cbe27bb..87c357b659 100644 --- a/gmp/tests/mpn/t-matrix22.c +++ b/gmp/tests/mpn/t-matrix22.c @@ -2,20 +2,20 @@ Copyright 2008 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> @@ -185,7 +185,7 @@ main (int argc, char **argv) matrix_init (&B, MAX_SIZE); mpz_init (bs); - for (i = 0; i < 1000; i++) + for (i = 0; i < 17; i++) { mp_size_t an, bn; mpz_urandomb (bs, rands, 32); @@ -202,6 +202,5 @@ main (int argc, char **argv) matrix_clear (&A); matrix_clear (&B); - tests_end (); return 0; } diff --git a/gmp/tests/mpn/t-minvert.c b/gmp/tests/mpn/t-minvert.c deleted file mode 100644 index ade61a1523..0000000000 --- a/gmp/tests/mpn/t-minvert.c +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright 2013, 2014 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> /* for strtol */ - -#include "gmp.h" -#include "gmp-impl.h" -#include "longlong.h" -#include "tests/tests.h" - -#define MAX_SIZE 50 - -#define COUNT 200 - -static void -mpz_to_mpn (mp_ptr ap, mp_size_t an, const mpz_t b) -{ - mp_size_t bn = mpz_size (b); - ASSERT_ALWAYS (bn <= an); - MPN_COPY_INCR (ap, mpz_limbs_read (b), bn); - MPN_ZERO (ap + bn, an - bn); -} - -int -mpz_eq_mpn (mp_ptr ap, mp_size_t an, const mpz_t b) -{ - mp_size_t bn = mpz_size (b); - - return (bn >= 0 && bn <= an - && mpn_cmp (ap, mpz_limbs_read (b), bn) == 0 - && mpn_zero_p (ap + bn, an - bn)); -} - -static mp_bitcnt_t -bit_size (mp_srcptr xp, mp_size_t n) -{ - MPN_NORMALIZE (xp, n); - return n > 0 ? mpn_sizeinbase (xp, n, 2) : 0; -} - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - long count = COUNT; - mp_ptr mp; - mp_ptr ap; - mp_ptr vp; - mp_ptr tp; - mp_ptr scratch; - mpz_t m, a, r, g; - int test; - mp_limb_t ran; - mp_size_t itch; - TMP_DECL; - - tests_start (); - rands = RANDS; - - - TMP_MARK; - mpz_init (m); - mpz_init (a); - mpz_init (r); - mpz_init (g); - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - mp = TMP_ALLOC_LIMBS (MAX_SIZE); - ap = TMP_ALLOC_LIMBS (MAX_SIZE); - vp = TMP_ALLOC_LIMBS (MAX_SIZE); - tp = TMP_ALLOC_LIMBS (MAX_SIZE); - scratch = TMP_ALLOC_LIMBS (mpn_sec_invert_itch (MAX_SIZE) + 1); - - for (test = 0; test < count; test++) - { - mp_bitcnt_t bits; - int rres, tres; - mp_size_t n; - - bits = urandom () % (GMP_NUMB_BITS * MAX_SIZE) + 1; - - if (test & 1) - mpz_rrandomb (m, rands, bits); - else - mpz_urandomb (m, rands, bits); - if (test & 2) - mpz_rrandomb (a, rands, bits); - else - mpz_urandomb (a, rands, bits); - - mpz_setbit (m, 0); - if (test & 4) - { - /* Ensure it really is invertible */ - if (mpz_sgn (a) == 0) - mpz_set_ui (a, 1); - else - for (;;) - { - mpz_gcd (g, a, m); - if (mpz_cmp_ui (g, 1) == 0) - break; - mpz_remove (a, a, g); - } - } - - rres = mpz_invert (r, a, m); - if ( (test & 4) && !rres) - { - gmp_fprintf (stderr, "test %d: Not invertible!\n" - "m = %Zd\n" - "a = %Zd\n", test, m, a); - abort (); - } - ASSERT_ALWAYS (! (test & 4) || rres); - - n = (bits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS; - ASSERT_ALWAYS (n <= MAX_SIZE); - itch = mpn_sec_invert_itch (n); - scratch[itch] = ran = urandom (); - - mpz_to_mpn (ap, n, a); - mpz_to_mpn (mp, n, m); - tres = mpn_sec_invert (tp, ap, mp, n, - bit_size (ap, n) + bit_size (mp, n), - scratch); - - if (rres != tres || (rres == 1 && !mpz_eq_mpn (tp, n, r)) || ran != scratch[itch]) - { - gmp_fprintf (stderr, "Test %d failed.\n" - "m = %Zd\n" - "a = %Zd\n", test, m, a); - fprintf (stderr, "ref ret: %d\n" - "got ret: %d\n", rres, tres); - if (rres) - gmp_fprintf (stderr, "ref: %Zd\n", r); - if (tres) - gmp_fprintf (stderr, "got: %Nd\n", tp, n); - if (ran != scratch[itch]) - fprintf (stderr, "scratch[itch] changed.\n"); - abort (); - } - } - - TMP_FREE; - - mpz_clear (m); - mpz_clear (a); - mpz_clear (r); - mpz_clear (g); - - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-mod_1.c b/gmp/tests/mpn/t-mod_1.c deleted file mode 100644 index 3d08a9018f..0000000000 --- a/gmp/tests/mpn/t-mod_1.c +++ /dev/null @@ -1,129 +0,0 @@ -/* Test mpn_mod_1 variants. - -Copyright 2010, 2013 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - -#include <stdio.h> -#include <stdlib.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -static void -check_one (mp_srcptr ap, mp_size_t n, mp_limb_t b) -{ - mp_limb_t r_ref = refmpn_mod_1 (ap, n, b); - mp_limb_t r; - - if (n >= 2) - { - mp_limb_t pre[4]; - mpn_mod_1_1p_cps (pre, b); - r = mpn_mod_1_1p (ap, n, b << pre[1], pre); - if (r != r_ref) - { - printf ("mpn_mod_1_1p failed\n"); - goto fail; - } - } - if ((b & GMP_NUMB_HIGHBIT) == 0) - { - mp_limb_t pre[5]; - mpn_mod_1s_2p_cps (pre, b); - r = mpn_mod_1s_2p (ap, n, b << pre[1], pre); - if (r != r_ref) - { - printf ("mpn_mod_1s_2p failed\n"); - goto fail; - } - } - if (b <= GMP_NUMB_MASK / 3) - { - mp_limb_t pre[6]; - mpn_mod_1s_3p_cps (pre, b); - r = mpn_mod_1s_3p (ap, n, b << pre[1], pre); - if (r != r_ref) - { - printf ("mpn_mod_1s_3p failed\n"); - goto fail; - } - } - if (b <= GMP_NUMB_MASK / 4) - { - mp_limb_t pre[7]; - mpn_mod_1s_4p_cps (pre, b); - r = mpn_mod_1s_4p (ap, n, b << pre[1], pre); - if (r != r_ref) - { - printf ("mpn_mod_1s_4p failed\n"); - goto fail; - } - } - r = mpn_mod_1 (ap, n, b); - if (r != r_ref) - { - printf ("mpn_mod_1 failed\n"); - fail: - printf ("an = %d, a: ", (int) n); mpn_dump (ap, n); - printf ("b : "); mpn_dump (&b, 1); - printf ("r (expected): "); mpn_dump (&r_ref, 1); - printf ("r (bad) : "); mpn_dump (&r, 1); - abort(); - } -} - -int -main (int argc, char **argv) -{ - gmp_randstate_ptr rands; - int i; - unsigned a_bits; - unsigned b_bits; - mpz_t a; - mpz_t b; - - tests_start (); - rands = RANDS; - mpz_init (a); - mpz_init (b); - - for (i = 0; i < 300; i++) - { - mp_size_t asize; - a_bits = 1 + gmp_urandomm_ui (rands, 1000); - b_bits = 1 + gmp_urandomm_ui (rands, GMP_NUMB_BITS); - - mpz_rrandomb (a, rands, a_bits); - mpz_rrandomb (b, rands, b_bits); - - asize = SIZ(a); - if (!asize) - asize = 1; - if (mpz_sgn (b) == 0) - mpz_set_ui (b, 1); - - check_one (PTR(a), asize, PTR(b)[0]); - } - - mpz_clear (a); - mpz_clear (b); - - tests_end (); - return 0; -} - diff --git a/gmp/tests/mpn/t-mp_bases.c b/gmp/tests/mpn/t-mp_bases.c index c0b228825a..17950ecb4e 100644 --- a/gmp/tests/mpn/t-mp_bases.c +++ b/gmp/tests/mpn/t-mp_bases.c @@ -2,20 +2,20 @@ Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> diff --git a/gmp/tests/mpn/t-mul.c b/gmp/tests/mpn/t-mul.c deleted file mode 100644 index 26e4227334..0000000000 --- a/gmp/tests/mpn/t-mul.c +++ /dev/null @@ -1,101 +0,0 @@ -/* Test mpn_mul function for all sizes up to a selected limit. - -Copyright 2011, 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -static unsigned -isqrt (unsigned t) -{ - unsigned s, b; - - for (b = 0, s = t; b++, s >>= 1; ) - ; - - s = 1 << (b >> 1); - if (b & 1) - s += s >> 1; - - do - { - b = t / s; - s = (s + b) >> 1; - } - while (b < s); - - return s; -} - -int -main (int argc, char **argv) -{ - mp_ptr ap, bp, rp, refp; - mp_size_t max_n, an, bn, rn; - gmp_randstate_ptr rands; - int reps; - TMP_DECL; - TMP_MARK; - - reps = 1; - - tests_start (); - TESTS_REPS (reps, argv, argc); - - rands = RANDS; - - /* Re-interpret reps argument as a size argument. */ - max_n = isqrt (reps * 25000); - - ap = TMP_ALLOC_LIMBS (max_n + 1); - bp = TMP_ALLOC_LIMBS (max_n + 1); - rp = TMP_ALLOC_LIMBS (2 * max_n); - refp = TMP_ALLOC_LIMBS (2 * max_n); - - for (an = 1; an <= max_n; an += 1) - { - for (bn = 1; bn <= an; bn += 1) - { - mpn_random2 (ap, an + 1); - mpn_random2 (bp, bn + 1); - - refmpn_mul (refp, ap, an, bp, bn); - mpn_mul (rp, ap, an, bp, bn); - - rn = an + bn; - if (mpn_cmp (refp, rp, rn)) - { - printf ("ERROR, an = %d, bn = %d, rn = %d\n", - (int) an, (int) bn, (int) rn); - printf ("a: "); mpn_dump (ap, an); - printf ("b: "); mpn_dump (bp, bn); - printf ("r: "); mpn_dump (rp, rn); - printf ("ref: "); mpn_dump (refp, rn); - abort(); - } - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-mullo.c b/gmp/tests/mpn/t-mullo.c deleted file mode 100644 index d4789976ac..0000000000 --- a/gmp/tests/mpn/t-mullo.c +++ /dev/null @@ -1,142 +0,0 @@ -/* Test for mullo function. - -Copyright 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 10 -#endif - -#ifndef COUNT -#define COUNT 10000 -#endif - -#define MAX_N (1L << SIZE_LOG) -#define MIN_N (1) - -int -main (int argc, char **argv) -{ - mp_ptr ap, bp, refp, pp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - -#define mpn_mullo_itch(n) (0) - - ap = TMP_ALLOC_LIMBS (MAX_N); - bp = TMP_ALLOC_LIMBS (MAX_N); - refp = TMP_ALLOC_LIMBS (MAX_N * 2); - pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_mullo_itch (MAX_N) + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t n; - mp_size_t itch; - mp_limb_t p_before, p_after, s_before, s_after; - - for (size_min = 1; (1L << size_min) < MIN_N; size_min++) - ; - - /* We generate an in the MIN_N <= n <= (1 << size_range). */ - size_range = size_min - + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min); - - n = MIN_N - + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N); - - mpn_random2 (ap, n); - mpn_random2 (bp, n); - mpn_random2 (pp-1, n + 2); - p_before = pp[-1]; - p_after = pp[n]; - - itch = mpn_mullo_itch (n); - ASSERT_ALWAYS (itch <= mpn_mullo_itch (MAX_N)); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - mpn_mullo_n (pp, ap, bp, n); - mpn_mul_n (refp, ap, bp, n); - if (pp[-1] != p_before || pp[n] != p_after - || scratch[-1] != s_before || scratch[itch] != s_after - || mpn_cmp (refp, pp, n) != 0) - { - printf ("ERROR in test %d, n = %d", - test, (int) n); - if (pp[-1] != p_before) - { - printf ("before pp:"); mpn_dump (pp -1, 1); - printf ("keep: "); mpn_dump (&p_before, 1); - } - if (pp[n] != p_after) - { - printf ("after pp:"); mpn_dump (pp + n, 1); - printf ("keep: "); mpn_dump (&p_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (ap, n); - mpn_dump (bp, n); - mpn_dump (pp, n); - mpn_dump (refp, n); - - abort(); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-mulmid.c b/gmp/tests/mpn/t-mulmid.c deleted file mode 100644 index 8978c4c1fd..0000000000 --- a/gmp/tests/mpn/t-mulmid.c +++ /dev/null @@ -1,93 +0,0 @@ -/* Test for mulmid function. - -Copyright 2011 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 9 -#endif - -#ifndef COUNT -#define COUNT 5000 -#endif - -#define MAX_N (1L << SIZE_LOG) - -int -main (int argc, char **argv) -{ - mp_ptr ap, bp, rp, refp; - gmp_randstate_ptr rands; - int test; - TMP_DECL; - TMP_MARK; - - tests_start (); - rands = RANDS; - - ap = TMP_ALLOC_LIMBS (MAX_N); - bp = TMP_ALLOC_LIMBS (MAX_N); - rp = TMP_ALLOC_LIMBS (MAX_N + 2); - refp = TMP_ALLOC_LIMBS (MAX_N + 2); - - for (test = 0; test < COUNT; test++) - { - mp_size_t an, bn, rn; - unsigned size_log; - - size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG); - an = 1 + gmp_urandomm_ui(rands, 1L << size_log); - - size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG); - bn = 1 + gmp_urandomm_ui(rands, 1L << size_log); - - /* Make sure an >= bn */ - if (an < bn) - MP_SIZE_T_SWAP (an, bn); - - mpn_random2 (ap, an); - mpn_random2 (bp, bn); - - refmpn_mulmid (refp, ap, an, bp, bn); - mpn_mulmid (rp, ap, an, bp, bn); - - rn = an + 3 - bn; - if (mpn_cmp (refp, rp, rn)) - { - printf ("ERROR in test %d, an = %d, bn = %d, rn = %d\n", - test, (int) an, (int) bn, (int) rn); - printf("a: "); mpn_dump (ap, an); - printf("b: "); mpn_dump (bp, bn); - printf("r: "); mpn_dump (rp, rn); - printf("ref: "); mpn_dump (refp, rn); - - abort(); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-mulmod_bnm1.c b/gmp/tests/mpn/t-mulmod_bnm1.c deleted file mode 100644 index 374b722c6b..0000000000 --- a/gmp/tests/mpn/t-mulmod_bnm1.c +++ /dev/null @@ -1,218 +0,0 @@ -/* Test for mulmod_bnm1 function. - - Contributed to the GNU project by Marco Bodrato. - -Copyright 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 11 -#endif - -#ifndef COUNT -#define COUNT 5000 -#endif - -#define MAX_N (1L << SIZE_LOG) -#define MIN_N 1 - -/* - Reference function for multiplication modulo B^rn-1. - - The result is expected to be ZERO if and only if one of the operand - already is. Otherwise the class [0] Mod(B^rn-1) is represented by - B^rn-1. This should not be a problem if mulmod_bnm1 is used to - combine results and obtain a natural number when one knows in - advance that the final value is less than (B^rn-1). -*/ - -static void -ref_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn) -{ - mp_limb_t cy; - - ASSERT (0 < an && an <= rn); - ASSERT (0 < bn && bn <= rn); - - if (an >= bn) - refmpn_mul (rp, ap, an, bp, bn); - else - refmpn_mul (rp, bp, bn, ap, an); - an += bn; - if (an > rn) { - cy = mpn_add (rp, rp, rn, rp + rn, an - rn); - /* If cy == 1, then the value of rp is at most B^rn - 2, so there can - * be no overflow when adding in the carry. */ - MPN_INCR_U (rp, rn, cy); - } -} - -/* - Compare the result of the mpn_mulmod_bnm1 function in the library - with the reference function above. -*/ - -int -main (int argc, char **argv) -{ - mp_ptr ap, bp, refp, pp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - ASSERT_ALWAYS (mpn_mulmod_bnm1_next_size (MAX_N) == MAX_N); - - ap = TMP_ALLOC_LIMBS (MAX_N); - bp = TMP_ALLOC_LIMBS (MAX_N); - refp = TMP_ALLOC_LIMBS (MAX_N * 4); - pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N) + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t an,bn,rn,n; - mp_size_t itch; - mp_limb_t p_before, p_after, s_before, s_after; - - for (size_min = 1; (1L << size_min) < MIN_N; size_min++) - ; - - /* We generate an in the MIN_N <= n <= (1 << size_range). */ - size_range = size_min - + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min); - - n = MIN_N - + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N); - n = mpn_mulmod_bnm1_next_size (n); - - if ( (test & 1) || n == 1) { - /* Half of the tests are done with the main scenario in mind: - both an and bn >= rn/2 */ - an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1); - bn = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1); - } else { - /* Second half of the tests are done using mulmod to compute a - full product with n/2 < an+bn <= n. */ - an = 1 + gmp_urandomm_ui (rands, n - 1); - if (an >= n/2) - bn = 1 + gmp_urandomm_ui (rands, n - an); - else - bn = n/2 + 1 - an + gmp_urandomm_ui (rands, (n+1)/2); - } - - /* Make sure an >= bn */ - if (an < bn) - MP_SIZE_T_SWAP (an, bn); - - mpn_random2 (ap, an); - mpn_random2 (bp, bn); - - /* Sometime trigger the borderline conditions - A = -1,0,+1 or B = -1,0,+1 or A*B == -1,0,1 Mod(B^{n/2}+1). - This only makes sense if there is at least a split, i.e. n is even. */ - if ((test & 0x1f) == 1 && (n & 1) == 0) { - mp_size_t x; - MPN_COPY (ap, ap + (n >> 1), an - (n >> 1)); - MPN_ZERO (ap + an - (n >> 1) , n - an); - MPN_COPY (bp, bp + (n >> 1), bn - (n >> 1)); - MPN_ZERO (bp + bn - (n >> 1) , n - bn); - x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an); - ap[x] += gmp_urandomm_ui (rands, 3) - 1; - x = (n >> 1) - x % (n >> 1); - bp[x] += gmp_urandomm_ui (rands, 3) - 1; - /* We don't propagate carry, this means that the desired condition - is not triggered all the times. A few times are enough anyway. */ - } - rn = MIN(n, an + bn); - mpn_random2 (pp-1, rn + 2); - p_before = pp[-1]; - p_after = pp[rn]; - - itch = mpn_mulmod_bnm1_itch (n, an, bn); - ASSERT_ALWAYS (itch <= mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N)); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - mpn_mulmod_bnm1 ( pp, n, ap, an, bp, bn, scratch); - ref_mulmod_bnm1 (refp, n, ap, an, bp, bn); - if (pp[-1] != p_before || pp[rn] != p_after - || scratch[-1] != s_before || scratch[itch] != s_after - || mpn_cmp (refp, pp, rn) != 0) - { - printf ("ERROR in test %d, an = %d, bn = %d, n = %d\n", - test, (int) an, (int) bn, (int) n); - if (pp[-1] != p_before) - { - printf ("before pp:"); mpn_dump (pp -1, 1); - printf ("keep: "); mpn_dump (&p_before, 1); - } - if (pp[rn] != p_after) - { - printf ("after pp:"); mpn_dump (pp + rn, 1); - printf ("keep: "); mpn_dump (&p_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (ap, an); - mpn_dump (bp, bn); - mpn_dump (pp, rn); - mpn_dump (refp, rn); - - abort(); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-perfsqr.c b/gmp/tests/mpn/t-perfsqr.c index 322ab6c3a4..6afe708deb 100644 --- a/gmp/tests/mpn/t-perfsqr.c +++ b/gmp/tests/mpn/t-perfsqr.c @@ -2,20 +2,20 @@ Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> diff --git a/gmp/tests/mpn/t-scan.c b/gmp/tests/mpn/t-scan.c index f4478af335..fc8d3cc650 100644 --- a/gmp/tests/mpn/t-scan.c +++ b/gmp/tests/mpn/t-scan.c @@ -2,20 +2,20 @@ Copyright 2002 Free Software Foundation, Inc. -This file is part of the GNU MP Library test suite. +This file is part of the GNU MP Library. -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 3 of the License, or (at your +option) any later version. -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public +License for more details. -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ +You should have received a copy of the GNU Lesser General Public License +along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */ #include <stdio.h> #include <stdlib.h> diff --git a/gmp/tests/mpn/t-sizeinbase.c b/gmp/tests/mpn/t-sizeinbase.c deleted file mode 100644 index 0887815d8b..0000000000 --- a/gmp/tests/mpn/t-sizeinbase.c +++ /dev/null @@ -1,108 +0,0 @@ -/* Test for sizeinbase function. - -Copyright 2014 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Exponents up to 2^SIZE_LOG */ -#ifndef SIZE_LOG -#define SIZE_LOG 13 -#endif - -#ifndef COUNT -#define COUNT 30 -#endif - -#define MAX_N (1<<SIZE_LOG) - -int -main (int argc, char **argv) -{ - mp_limb_t a; - mp_ptr pp, scratch; - mp_limb_t max_b; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - TMP_MARK; - rands = RANDS; - - pp = TMP_ALLOC_LIMBS (MAX_N); - scratch = TMP_ALLOC_LIMBS (MAX_N); - max_b = numberof (mp_bases); - - ASSERT_ALWAYS (max_b > 62); - ASSERT_ALWAYS (max_b < GMP_NUMB_MAX); - - for (a = 2; a < max_b; ++a) - for (test = 0; test < count; ++test) - { - mp_size_t pn; - mp_limb_t exp; - mp_bitcnt_t res; - - exp = gmp_urandomm_ui (rands, MAX_N); - - pn = mpn_pow_1 (pp, &a, 1, exp, scratch); - - res = mpn_sizeinbase (pp, pn, a) - 1; - - if ((res < exp) || (res > exp + 1)) - { - printf ("ERROR in test %d, base = %d, exp = %d, res = %d\n", - test, (int) a, (int) exp, (int) res); - abort(); - } - - mpn_sub_1 (pp, pp, pn, CNST_LIMB(1)); - pn -= pp[pn-1] == 0; - - res = mpn_sizeinbase (pp, pn, a); - - if ((res < exp) || (res - 1 > exp)) - { - printf ("ERROR in -1 test %d, base = %d, exp = %d, res = %d\n", - test, (int) a, (int) exp, (int) res); - abort(); - } - } - - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-sqrmod_bnm1.c b/gmp/tests/mpn/t-sqrmod_bnm1.c deleted file mode 100644 index 47ccf81083..0000000000 --- a/gmp/tests/mpn/t-sqrmod_bnm1.c +++ /dev/null @@ -1,191 +0,0 @@ -/* Test for sqrmod_bnm1 function. - - Contributed to the GNU project by Marco Bodrato. - -Copyright 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 12 -#endif - -#ifndef COUNT -#define COUNT 3000 -#endif - -#define MAX_N (1L << SIZE_LOG) -#define MIN_N 1 - -/* - Reference function for squaring modulo B^rn-1. - - The result is expected to be ZERO if and only if one of the operand - already is. Otherwise the class [0] Mod(B^rn-1) is represented by - B^rn-1. This should not be a problem if sqrmod_bnm1 is used to - combine results and obtain a natural number when one knows in - advance that the final value is less than (B^rn-1). -*/ - -static void -ref_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an) -{ - mp_limb_t cy; - - ASSERT (0 < an && an <= rn); - - refmpn_mul (rp, ap, an, ap, an); - an *= 2; - if (an > rn) { - cy = mpn_add (rp, rp, rn, rp + rn, an - rn); - /* If cy == 1, then the value of rp is at most B^rn - 2, so there can - * be no overflow when adding in the carry. */ - MPN_INCR_U (rp, rn, cy); - } -} - -/* - Compare the result of the mpn_sqrmod_bnm1 function in the library - with the reference function above. -*/ - -int -main (int argc, char **argv) -{ - mp_ptr ap, refp, pp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - ASSERT_ALWAYS (mpn_sqrmod_bnm1_next_size (MAX_N) == MAX_N); - - ap = TMP_ALLOC_LIMBS (MAX_N); - refp = TMP_ALLOC_LIMBS (MAX_N * 4); - pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (MAX_N, MAX_N) + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t an,rn,n; - mp_size_t itch; - mp_limb_t p_before, p_after, s_before, s_after; - - for (size_min = 1; (1L << size_min) < MIN_N; size_min++) - ; - - /* We generate an in the MIN_N <= n <= (1 << size_range). */ - size_range = size_min - + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min); - - n = MIN_N - + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N); - n = mpn_sqrmod_bnm1_next_size (n); - - if (n == 1) - an = 1; - else - an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1); - - mpn_random2 (ap, an); - - /* Sometime trigger the borderline conditions - A = -1,0,+1 Mod(B^{n/2}+1). - This only makes sense if there is at least a split, i.e. n is even. */ - if ((test & 0x1f) == 1 && (n & 1) == 0) { - mp_size_t x; - MPN_COPY (ap, ap + (n >> 1), an - (n >> 1)); - MPN_ZERO (ap + an - (n >> 1) , n - an); - x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an); - ap[x] += gmp_urandomm_ui (rands, 3) - 1; - } - rn = MIN(n, 2*an); - mpn_random2 (pp-1, rn + 2); - p_before = pp[-1]; - p_after = pp[rn]; - - itch = mpn_sqrmod_bnm1_itch (n, an); - ASSERT_ALWAYS (itch <= mpn_sqrmod_bnm1_itch (MAX_N, MAX_N)); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - mpn_sqrmod_bnm1 ( pp, n, ap, an, scratch); - ref_sqrmod_bnm1 (refp, n, ap, an); - if (pp[-1] != p_before || pp[rn] != p_after - || scratch[-1] != s_before || scratch[itch] != s_after - || mpn_cmp (refp, pp, rn) != 0) - { - printf ("ERROR in test %d, an = %d, n = %d\n", - test, (int) an, (int) n); - if (pp[-1] != p_before) - { - printf ("before pp:"); mpn_dump (pp -1, 1); - printf ("keep: "); mpn_dump (&p_before, 1); - } - if (pp[rn] != p_after) - { - printf ("after pp:"); mpn_dump (pp + rn, 1); - printf ("keep: "); mpn_dump (&p_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (ap, an); - mpn_dump (pp, rn); - mpn_dump (refp, rn); - - abort(); - } - } - TMP_FREE; - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/t-toom2-sqr.c b/gmp/tests/mpn/t-toom2-sqr.c deleted file mode 100644 index a5cdcb5778..0000000000 --- a/gmp/tests/mpn/t-toom2-sqr.c +++ /dev/null @@ -1,6 +0,0 @@ -#define mpn_toomN_sqr mpn_toom2_sqr -#define mpn_toomN_sqr_itch mpn_toom2_sqr_itch -#define MIN_AN MPN_TOOM2_SQR_MINSIZE -#define MAX_AN SQR_TOOM3_THRESHOLD - -#include "toom-sqr-shared.h" diff --git a/gmp/tests/mpn/t-toom22.c b/gmp/tests/mpn/t-toom22.c deleted file mode 100644 index 939a88e9d8..0000000000 --- a/gmp/tests/mpn/t-toom22.c +++ /dev/null @@ -1,10 +0,0 @@ -#define mpn_toomMN_mul mpn_toom22_mul -#define mpn_toomMN_mul_itch mpn_toom22_mul_itch -#define MIN_AN 2 - -#define MIN_BN(an) \ - ((an) >= 2*MUL_TOOM22_THRESHOLD \ - ? (an) + 2 - MUL_TOOM22_THRESHOLD \ - : ((an)+1)/2 + 1) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom3-sqr.c b/gmp/tests/mpn/t-toom3-sqr.c deleted file mode 100644 index ccc3b99504..0000000000 --- a/gmp/tests/mpn/t-toom3-sqr.c +++ /dev/null @@ -1,6 +0,0 @@ -#define mpn_toomN_sqr mpn_toom3_sqr -#define mpn_toomN_sqr_itch mpn_toom3_sqr_itch -#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MPN_TOOM3_SQR_MINSIZE) -#define MAX_AN SQR_TOOM4_THRESHOLD - -#include "toom-sqr-shared.h" diff --git a/gmp/tests/mpn/t-toom32.c b/gmp/tests/mpn/t-toom32.c deleted file mode 100644 index e42745da96..0000000000 --- a/gmp/tests/mpn/t-toom32.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom32_mul -#define mpn_toomMN_mul_itch mpn_toom32_mul_itch - -#define MIN_AN 6 -#define MIN_BN(an) (((an) + 8) / (size_t) 3) -#define MAX_BN(an) ((an) - 2) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom33.c b/gmp/tests/mpn/t-toom33.c deleted file mode 100644 index 7de82b20c9..0000000000 --- a/gmp/tests/mpn/t-toom33.c +++ /dev/null @@ -1,11 +0,0 @@ -#define mpn_toomMN_mul mpn_toom33_mul -#define mpn_toomMN_mul_itch mpn_toom33_mul_itch - -/* Smaller sizes not supported; may lead to recursive calls to - toom22_mul with invalid input size. */ -#define MIN_AN MUL_TOOM33_THRESHOLD -#define MIN_BN(an) (1 + 2*(((an)+2)/(size_t) 3)) - -#define COUNT 1000 - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom4-sqr.c b/gmp/tests/mpn/t-toom4-sqr.c deleted file mode 100644 index ca14ab1482..0000000000 --- a/gmp/tests/mpn/t-toom4-sqr.c +++ /dev/null @@ -1,6 +0,0 @@ -#define mpn_toomN_sqr mpn_toom4_sqr -#define mpn_toomN_sqr_itch mpn_toom4_sqr_itch -#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MPN_TOOM4_SQR_MINSIZE)) -#define MAX_AN SQR_TOOM6_THRESHOLD - -#include "toom-sqr-shared.h" diff --git a/gmp/tests/mpn/t-toom42.c b/gmp/tests/mpn/t-toom42.c deleted file mode 100644 index 09a4a0c115..0000000000 --- a/gmp/tests/mpn/t-toom42.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom42_mul -#define mpn_toomMN_mul_itch mpn_toom42_mul_itch - -#define MIN_AN 10 -#define MIN_BN(an) (((an) + 7) >> 2) -#define MAX_BN(an) ((2*(an)-5) / (size_t) 3) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom43.c b/gmp/tests/mpn/t-toom43.c deleted file mode 100644 index 224a45bc38..0000000000 --- a/gmp/tests/mpn/t-toom43.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom43_mul -#define mpn_toomMN_mul_itch mpn_toom43_mul_itch - -#define MIN_AN 25 -#define MIN_BN(an) (1 + 2*(((an)+3) >> 2)) -#define MAX_BN(an) ((an)-3) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom44.c b/gmp/tests/mpn/t-toom44.c deleted file mode 100644 index 6c627e3428..0000000000 --- a/gmp/tests/mpn/t-toom44.c +++ /dev/null @@ -1,11 +0,0 @@ -#define mpn_toomMN_mul mpn_toom44_mul -#define mpn_toomMN_mul_itch mpn_toom44_mul_itch - -/* Smaller sizes not supported; may lead to recursive calls to - toom22_mul or toom33_mul with invalid input size. */ -#define MIN_AN MUL_TOOM44_THRESHOLD -#define MIN_BN(an) (1 + 3*(((an)+3)>>2)) - -#define COUNT 1000 - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom52.c b/gmp/tests/mpn/t-toom52.c deleted file mode 100644 index d3fb134f2e..0000000000 --- a/gmp/tests/mpn/t-toom52.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom52_mul -#define mpn_toomMN_mul_itch mpn_toom52_mul_itch - -#define MIN_AN 32 -#define MIN_BN(an) (((an) + 9) / (size_t) 5) -#define MAX_BN(an) (((an) - 3) >> 1) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom53.c b/gmp/tests/mpn/t-toom53.c deleted file mode 100644 index ddbf177aec..0000000000 --- a/gmp/tests/mpn/t-toom53.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom53_mul -#define mpn_toomMN_mul_itch mpn_toom53_mul_itch - -#define MIN_AN 17 -#define MIN_BN(an) (1 + 2*(((an) + 4) / (size_t) 5)) -#define MAX_BN(an) ((3*(an) - 11) >> 2) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom54.c b/gmp/tests/mpn/t-toom54.c deleted file mode 100644 index 52a2bee7b3..0000000000 --- a/gmp/tests/mpn/t-toom54.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom54_mul -#define mpn_toomMN_mul_itch mpn_toom54_mul_itch - -#define MIN_AN 31 -#define MIN_BN(an) ((3*(an) + 32) / (size_t) 5) /* 3/5 */ -#define MAX_BN(an) ((an) - 6) /* 1/1 */ - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom6-sqr.c b/gmp/tests/mpn/t-toom6-sqr.c deleted file mode 100644 index 67d7a63d32..0000000000 --- a/gmp/tests/mpn/t-toom6-sqr.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomN_sqr mpn_toom6_sqr -#define mpn_toomN_sqr_itch mpn_toom6_sqr_itch -#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MPN_TOOM6_SQR_MINSIZE))) -#define MAX_AN SQR_TOOM8_THRESHOLD - -#define COUNT 250 - -#include "toom-sqr-shared.h" diff --git a/gmp/tests/mpn/t-toom62.c b/gmp/tests/mpn/t-toom62.c deleted file mode 100644 index 1cb2aab26c..0000000000 --- a/gmp/tests/mpn/t-toom62.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom62_mul -#define mpn_toomMN_mul_itch mpn_toom62_mul_itch - -#define MIN_AN 31 -#define MIN_BN(an) (((an) + 11) / (size_t) 6) -#define MAX_BN(an) ((2*(an) - 7) / (size_t) 5) - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom63.c b/gmp/tests/mpn/t-toom63.c deleted file mode 100644 index d79165dcbe..0000000000 --- a/gmp/tests/mpn/t-toom63.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomMN_mul mpn_toom63_mul -#define mpn_toomMN_mul_itch mpn_toom63_mul_itch - -#define MIN_AN 49 -#define MIN_BN(an) (2*(((an) + 23) / (size_t) 6)) /* 2/6 */ -#define MAX_BN(an) ((3*(an) - 23) / (size_t) 5) /* 3/5 */ - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom6h.c b/gmp/tests/mpn/t-toom6h.c deleted file mode 100644 index 5cca9fc90e..0000000000 --- a/gmp/tests/mpn/t-toom6h.c +++ /dev/null @@ -1,13 +0,0 @@ -#define mpn_toomMN_mul mpn_toom6h_mul -#define mpn_toomMN_mul_itch mpn_toom6h_mul_itch - -#define SIZE_LOG 11 - -/* Smaller sizes not supported; may lead to recursive calls to - toom22_mul, toom33_mul, or toom44_mul with invalid input size. */ -#define MIN_AN MUL_TOOM6H_MIN -#define MIN_BN(an) (MAX ((an*3)>>3, 46)) - -#define COUNT 1000 - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/t-toom8-sqr.c b/gmp/tests/mpn/t-toom8-sqr.c deleted file mode 100644 index 0eee605928..0000000000 --- a/gmp/tests/mpn/t-toom8-sqr.c +++ /dev/null @@ -1,8 +0,0 @@ -#define mpn_toomN_sqr mpn_toom8_sqr -#define mpn_toomN_sqr_itch mpn_toom8_sqr_itch -#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MAX(SQR_TOOM6_THRESHOLD,MAX(SQR_TOOM8_THRESHOLD,MPN_TOOM8_SQR_MINSIZE)))) -#define MAX_AN SQR_FFT_THRESHOLD - -#define COUNT 250 - -#include "toom-sqr-shared.h" diff --git a/gmp/tests/mpn/t-toom8h.c b/gmp/tests/mpn/t-toom8h.c deleted file mode 100644 index aeeabb274b..0000000000 --- a/gmp/tests/mpn/t-toom8h.c +++ /dev/null @@ -1,18 +0,0 @@ -#define mpn_toomMN_mul mpn_toom8h_mul -#define mpn_toomMN_mul_itch mpn_toom8h_mul_itch - -#define SIZE_LOG 11 - -/* Smaller sizes not supported; may lead to recursive calls to - toom{22,33,44,6h}_mul with invalid input size. */ -#define MIN_AN MUL_TOOM8H_MIN - -#define MIN_BN(an) \ -(MAX(GMP_NUMB_BITS <= 10*3 ? (an*6)/10 : \ - GMP_NUMB_BITS <= 11*3 ? (an*5)/11 : \ - GMP_NUMB_BITS <= 12*3 ? (an*4)/12 : \ - (an*4)/13, 86) ) - -#define COUNT 1000 - -#include "toom-shared.h" diff --git a/gmp/tests/mpn/toom-shared.h b/gmp/tests/mpn/toom-shared.h deleted file mode 100644 index 7479e7efd9..0000000000 --- a/gmp/tests/mpn/toom-shared.h +++ /dev/null @@ -1,158 +0,0 @@ -/* Test for various Toom functions. - -Copyright 2009 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Main file is expected to define mpn_toomMN_mul, - * mpn_toomMN_mul_itch, MIN_AN, MIN_BN(an), MAX_BN(an) and then - * include this file. */ - -/* Sizes are up to 2^SIZE_LOG limbs */ -#ifndef SIZE_LOG -#define SIZE_LOG 10 -#endif - -#ifndef COUNT -#define COUNT 2000 -#endif - -#define MAX_AN (1L << SIZE_LOG) - -#ifndef MAX_BN -#define MAX_BN(an) (an) -#endif - -/* For general toomMN_mul, we need - * - * MIN_BN(an) = N + floor(((N-1)*an + M - N)/M) - * - * MAX_BN(an) = floor(N*(an-1)/(M-1)) - N + 1 - */ - -int -main (int argc, char **argv) -{ - mp_ptr ap, bp, refp, pp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - rands = RANDS; - - ap = TMP_ALLOC_LIMBS (MAX_AN); - bp = TMP_ALLOC_LIMBS (MAX_BN(MAX_AN)); - refp = TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN)); - pp = 1+TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN)+2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN)) - + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t an, bn; - mp_size_t itch; - mp_limb_t p_before, p_after, s_before, s_after; - - for (size_min = 1; (1L << size_min) < MIN_AN; size_min++) - ; - - /* We generate an in the MIN_AN <= an <= (1 << size_range). */ - size_range = size_min - + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min); - - an = MIN_AN - + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_AN); - bn = MIN_BN(an) - + gmp_urandomm_ui (rands, MAX_BN(an) + 1 - MIN_BN(an)); - - mpn_random2 (ap, an); - mpn_random2 (bp, bn); - mpn_random2 (pp-1, an + bn + 2); - p_before = pp[-1]; - p_after = pp[an + bn]; - - itch = mpn_toomMN_mul_itch (an, bn); - ASSERT_ALWAYS (itch <= mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN))); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - mpn_toomMN_mul (pp, ap, an, bp, bn, scratch); - refmpn_mul (refp, ap, an, bp, bn); - if (pp[-1] != p_before || pp[an + bn] != p_after - || scratch[-1] != s_before || scratch[itch] != s_after - || mpn_cmp (refp, pp, an + bn) != 0) - { - printf ("ERROR in test %d, an = %d, bn = %d\n", - test, (int) an, (int) bn); - if (pp[-1] != p_before) - { - printf ("before pp:"); mpn_dump (pp -1, 1); - printf ("keep: "); mpn_dump (&p_before, 1); - } - if (pp[an + bn] != p_after) - { - printf ("after pp:"); mpn_dump (pp + an + bn, 1); - printf ("keep: "); mpn_dump (&p_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (ap, an); - mpn_dump (bp, bn); - mpn_dump (pp, an + bn); - mpn_dump (refp, an + bn); - - abort(); - } - } - TMP_FREE; - - tests_end (); - return 0; -} diff --git a/gmp/tests/mpn/toom-sqr-shared.h b/gmp/tests/mpn/toom-sqr-shared.h deleted file mode 100644 index 944cfab000..0000000000 --- a/gmp/tests/mpn/toom-sqr-shared.h +++ /dev/null @@ -1,129 +0,0 @@ -/* Test for various Toom squaring functions. - -Copyright 2009, 2012 Free Software Foundation, Inc. - -This file is part of the GNU MP Library test suite. - -The GNU MP Library test suite is free software; you can redistribute it -and/or modify it under the terms of the GNU General Public License as -published by the Free Software Foundation; either version 3 of the License, -or (at your option) any later version. - -The GNU MP Library test suite is distributed in the hope that it will be -useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License along with -the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */ - - -#include <stdlib.h> -#include <stdio.h> - -#include "gmp.h" -#include "gmp-impl.h" -#include "tests.h" - -/* Main file is expected to define mpn_toomN_mul, mpn_toomN_sqr_itch, - * MIN_AN, MAX_AN and then include this file. */ - -#ifndef COUNT -#define COUNT 2000 -#endif - -int -main (int argc, char **argv) -{ - mp_ptr ap, refp, pp, scratch; - int count = COUNT; - int test; - gmp_randstate_ptr rands; - TMP_DECL; - TMP_MARK; - - if (argc > 1) - { - char *end; - count = strtol (argv[1], &end, 0); - if (*end || count <= 0) - { - fprintf (stderr, "Invalid test count: %s.\n", argv[1]); - return 1; - } - } - - tests_start (); - - if (MAX_AN > MIN_AN) { - rands = RANDS; - - ap = TMP_ALLOC_LIMBS (MAX_AN); - refp = TMP_ALLOC_LIMBS (MAX_AN * 2); - pp = 1 + TMP_ALLOC_LIMBS (MAX_AN * 2 + 2); - scratch - = 1+TMP_ALLOC_LIMBS (mpn_toomN_sqr_itch (MAX_AN) + 2); - - for (test = 0; test < count; test++) - { - unsigned size_min; - unsigned size_range; - mp_size_t an; - mp_size_t itch; - mp_limb_t p_before, p_after, s_before, s_after; - - an = MIN_AN - + gmp_urandomm_ui (rands, MAX_AN - MIN_AN); - - mpn_random2 (ap, an); - mpn_random2 (pp-1, an * 2 + 2); - p_before = pp[-1]; - p_after = pp[an * 2]; - - itch = mpn_toomN_sqr_itch (an); - ASSERT_ALWAYS (itch <= mpn_toomN_sqr_itch (MAX_AN)); - mpn_random2 (scratch-1, itch+2); - s_before = scratch[-1]; - s_after = scratch[itch]; - - mpn_toomN_sqr (pp, ap, an, scratch); - refmpn_mul (refp, ap, an, ap, an); - if (pp[-1] != p_before || pp[an * 2] != p_after - || scratch[-1] != s_before || scratch[itch] != s_after - || mpn_cmp (refp, pp, an * 2) != 0) - { - printf ("ERROR in test %d, an = %d\n", - test, (int) an); - if (pp[-1] != p_before) - { - printf ("before pp:"); mpn_dump (pp -1, 1); - printf ("keep: "); mpn_dump (&p_before, 1); - } - if (pp[an * 2] != p_after) - { - printf ("after pp:"); mpn_dump (pp + an * 2, 1); - printf ("keep: "); mpn_dump (&p_after, 1); - } - if (scratch[-1] != s_before) - { - printf ("before scratch:"); mpn_dump (scratch-1, 1); - printf ("keep: "); mpn_dump (&s_before, 1); - } - if (scratch[itch] != s_after) - { - printf ("after scratch:"); mpn_dump (scratch + itch, 1); - printf ("keep: "); mpn_dump (&s_after, 1); - } - mpn_dump (ap, an); - mpn_dump (pp, an * 2); - mpn_dump (refp, an * 2); - - abort(); - } - } - TMP_FREE; - } - - tests_end (); - return 0; -} |