merge GMP 6.1.2.

This commit is contained in:
mrg 2017-08-22 09:55:44 +00:00
parent ce54336801
commit d7b1414aad
103 changed files with 5565 additions and 14451 deletions

View File

@ -1,165 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
License, supplemented by the additional permissions listed below.
0. Additional Definitions.
As used herein, "this License" refers to version 3 of the GNU Lesser
General Public License, and the "GNU GPL" refers to version 3 of the GNU
General Public License.
"The Library" refers to a covered work governed by this License,
other than an Application or a Combined Work as defined below.
An "Application" is any work that makes use of an interface provided
by the Library, but which is not otherwise based on the Library.
Defining a subclass of a class defined by the Library is deemed a mode
of using an interface provided by the Library.
A "Combined Work" is a work produced by combining or linking an
Application with the Library. The particular version of the Library
with which the Combined Work was made is also called the "Linked
Version".
The "Minimal Corresponding Source" for a Combined Work means the
Corresponding Source for the Combined Work, excluding any source code
for portions of the Combined Work that, considered in isolation, are
based on the Application, and not on the Linked Version.
The "Corresponding Application Code" for a Combined Work means the
object code and/or source code for the Application, including any data
and utility programs needed for reproducing the Combined Work from the
Application, but excluding the System Libraries of the Combined Work.
1. Exception to Section 3 of the GNU GPL.
You may convey a covered work under sections 3 and 4 of this License
without being bound by section 3 of the GNU GPL.
2. Conveying Modified Versions.
If you modify a copy of the Library, and, in your modifications, a
facility refers to a function or data to be supplied by an Application
that uses the facility (other than as an argument passed when the
facility is invoked), then you may convey a copy of the modified
version:
a) under this License, provided that you make a good faith effort to
ensure that, in the event an Application does not supply the
function or data, the facility still operates, and performs
whatever part of its purpose remains meaningful, or
b) under the GNU GPL, with none of the additional permissions of
this License applicable to that copy.
3. Object Code Incorporating Material from Library Header Files.
The object code form of an Application may incorporate material from
a header file that is part of the Library. You may convey such object
code under terms of your choice, provided that, if the incorporated
material is not limited to numerical parameters, data structure
layouts and accessors, or small macros, inline functions and templates
(ten or fewer lines in length), you do both of the following:
a) Give prominent notice with each copy of the object code that the
Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the object code with a copy of the GNU GPL and this license
document.
4. Combined Works.
You may convey a Combined Work under terms of your choice that,
taken together, effectively do not restrict modification of the
portions of the Library contained in the Combined Work and reverse
engineering for debugging such modifications, if you also do each of
the following:
a) Give prominent notice with each copy of the Combined Work that
the Library is used in it and that the Library and its use are
covered by this License.
b) Accompany the Combined Work with a copy of the GNU GPL and this license
document.
c) For a Combined Work that displays copyright notices during
execution, include the copyright notice for the Library among
these notices, as well as a reference directing the user to the
copies of the GNU GPL and this license document.
d) Do one of the following:
0) Convey the Minimal Corresponding Source under the terms of this
License, and the Corresponding Application Code in a form
suitable for, and under terms that permit, the user to
recombine or relink the Application with a modified version of
the Linked Version to produce a modified Combined Work, in the
manner specified by section 6 of the GNU GPL for conveying
Corresponding Source.
1) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (a) uses at run time
a copy of the Library already present on the user's computer
system, and (b) will operate properly with a modified version
of the Library that is interface-compatible with the Linked
Version.
e) Provide Installation Information, but only if you would otherwise
be required to provide such information under section 6 of the
GNU GPL, and only to the extent that such information is
necessary to install and execute a modified version of the
Combined Work produced by recombining or relinking the
Application with a modified version of the Linked Version. (If
you use option 4d0, the Installation Information must accompany
the Minimal Corresponding Source and Corresponding Application
Code. If you use option 4d1, you must provide the Installation
Information in the manner specified by section 6 of the GNU GPL
for conveying Corresponding Source.)
5. Combined Libraries.
You may place library facilities that are a work based on the
Library side by side in a single library together with other library
facilities that are not Applications and are not covered by this
License, and convey such a combined library under terms of your
choice, if you do both of the following:
a) Accompany the combined library with a copy of the same work based
on the Library, uncombined with any other library facilities,
conveyed under the terms of this License.
b) Give prominent notice with the combined library that part of it
is a work based on the Library, and explaining where to find the
accompanying uncombined form of the same work.
6. Revised Versions of the GNU Lesser General Public License.
The Free Software Foundation may publish revised and/or new versions
of the GNU Lesser General Public License from time to time. Such new
versions will be similar in spirit to the present version, but may
differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the
Library as you received it specifies that a certain numbered version
of the GNU Lesser General Public License "or any later version"
applies to it, you have the option of following the terms and
conditions either of that published version or of any later version
published by the Free Software Foundation. If the Library as you
received it does not specify a version number of the GNU Lesser
General Public License, you may choose any version of the GNU Lesser
General Public License ever published by the Free Software Foundation.
If the Library as you received it specifies that a proxy can decide
whether future versions of the GNU Lesser General Public License shall
apply, that proxy's public statement of acceptance of any version is
permanent authorization for you to choose that version for the
Library.

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# Makefile.in generated by automake 1.15 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.
# Copyright (C) 1994-2014 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,23 +14,34 @@
@SET_MAKE@
# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
# 2006, 2007, 2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2016 Free
# Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
# This file is part of the GNU MP Library.
#
# 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 is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# 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.
# * 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.
#
# 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/.
# or
#
# * the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# or both in parallel, as here.
#
# 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 General Public License
# for more details.
#
# You should have received copies of the GNU General Public License and the
# GNU Lesser General Public License along with the GNU MP Library. If not,
# see https://www.gnu.org/licenses/.
# The following options are the same as AM_INIT_AUTOMAKE in configure.in,
# except no $(top_builddir) on ansi2knr. That directory is wanted for the
@ -86,7 +96,10 @@
# 5.1.0 11:0:1 7:0:3 -
# 5.1.1 11:1:1 7:1:3 -
# 5.1.2 11:2:1 7:2:3 -
# 5.1.3 11:3:1 7:3:3 -
# 6.0.0 12:0:2 8:0:4 -
# 6.1.0 13:0:3 9:0:5 -
# 6.1.1 13:1:3 9:1:5 -
# 6.1.2 13:2:3 9:2:5 -
#
# Starting at 3:0:0 is a slight abuse of the versioning system, but it
# ensures we're past soname libgmp.so.2, which was used on Debian GNU/Linux
@ -101,23 +114,61 @@
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
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;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -137,16 +188,14 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
subdir = .
DIST_COMMON = README $(am__configure_deps) $(am__include_HEADERS_DIST) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.in $(srcdir)/gmp-h.in $(top_srcdir)/configure \
AUTHORS COPYING COPYING.LIB ChangeLog INSTALL NEWS \
config.guess config.sub install-sh ltmain.sh missing ylwrap
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(am__include_HEADERS_DIST) \
$(am__DIST_COMMON)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(install_sh) -d
@ -191,47 +240,82 @@ am_libgmp_la_OBJECTS = assert.lo compat.lo errno.lo extract-dbl.lo \
mp_minv_tab.lo mp_get_fns.lo mp_set_fns.lo version.lo \
nextprime.lo primesieve.lo
libgmp_la_OBJECTS = $(am_libgmp_la_OBJECTS)
libgmp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
libgmp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libgmp_la_LDFLAGS) $(LDFLAGS) -o $@
am_libgmpxx_la_OBJECTS = dummy.lo
libgmpxx_la_OBJECTS = $(am_libgmpxx_la_OBJECTS)
libgmpxx_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
libgmpxx_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(libgmpxx_la_LDFLAGS) $(LDFLAGS) -o $@
@WANT_CXX_TRUE@am_libgmpxx_la_rpath = -rpath $(libdir)
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@
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) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CXXFLAGS) $(CXXFLAGS)
AM_V_CXX = $(am__v_CXX_@AM_V@)
am__v_CXX_ = $(am__v_CXX_@AM_DEFAULT_V@)
am__v_CXX_0 = @echo " CXX " $@;
am__v_CXX_1 =
CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CXXLD = $(am__v_CXXLD_@AM_V@)
am__v_CXXLD_ = $(am__v_CXXLD_@AM_DEFAULT_V@)
am__v_CXXLD_0 = @echo " CXXLD " $@;
am__v_CXXLD_1 =
SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \
$(libgmpxx_la_SOURCES)
DIST_SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \
$(libgmpxx_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
install-dvi-recursive install-exec-recursive \
install-html-recursive install-info-recursive \
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
install-exec-recursive install-html-recursive \
install-info-recursive install-pdf-recursive \
install-ps-recursive install-recursive installcheck-recursive \
installdirs-recursive pdf-recursive ps-recursive \
tags-recursive uninstall-recursive
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@ -241,12 +325,38 @@ am__include_HEADERS_DIST = gmpxx.h
HEADERS = $(include_HEADERS) $(nodist_includeexec_HEADERS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
distdir dist dist-all distcheck
am__recursive_targets = \
$(RECURSIVE_TARGETS) \
$(RECURSIVE_CLEAN_TARGETS) \
$(am__extra_recursive_targets)
AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \
cscope distdir dist dist-all distcheck
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) \
$(LISP)config.in
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
CSCOPE = cscope
DIST_SUBDIRS = $(SUBDIRS)
am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.in \
$(srcdir)/gmp-h.in AUTHORS COPYING ChangeLog INSTALL NEWS \
README compile config.guess config.sub install-sh ltmain.sh \
missing
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@ -256,6 +366,7 @@ am__remove_distdir = \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
am__post_remove_distdir = $(am__remove_distdir)
am__relativize = \
dir0=`pwd`; \
sed_first='s,^\([^/]*\)/.*$$,\1,'; \
@ -283,6 +394,7 @@ am__relativize = \
reldir="$$dir2"
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
DIST_TARGETS = dist-gzip
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
@ -290,6 +402,7 @@ distcleancheck_listfiles = find . -type f -print
ABI = @ABI@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASMFLAGS = @ASMFLAGS@
@ -359,6 +472,7 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
@ -446,12 +560,12 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
LIBGMP_LT_CURRENT = 11
LIBGMP_LT_REVISION = 3
LIBGMP_LT_AGE = 1
LIBGMPXX_LT_CURRENT = 7
LIBGMPXX_LT_REVISION = 3
LIBGMPXX_LT_AGE = 3
LIBGMP_LT_CURRENT = 13
LIBGMP_LT_REVISION = 2
LIBGMP_LT_AGE = 3
LIBGMPXX_LT_CURRENT = 9
LIBGMPXX_LT_REVISION = 2
LIBGMPXX_LT_AGE = 5
SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
# The "test -f" support for srcdir!=builddir is similar to the automake .c.o
@ -472,10 +586,11 @@ SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
# Distribute mini-gmp. Test sources copied by dist-hook.
EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
gmpxx.h bootstrap.c gen-fac.c gen-fib.c gen-bases.c \
gen-trialdivtab.c gen-jacobitab.c gen-psqr.c mini-gmp/README \
mini-gmp/mini-gmp.c mini-gmp/mini-gmp.h \
mini-gmp/tests/Makefile mini-gmp/tests/run-tests
COPYING.LESSERv3 COPYINGv2 COPYINGv3 gmpxx.h bootstrap.c \
gen-fac.c gen-fib.c gen-bases.c gen-trialdivtab.c \
gen-jacobitab.c gen-psqr.c mini-gmp/README mini-gmp/mini-gmp.c \
mini-gmp/mini-gmp.h mini-gmp/tests/Makefile \
mini-gmp/tests/run-tests
@WANT_CXX_TRUE@GMPXX_HEADERS_OPTION = gmpxx.h
# gmp.h and mp.h are architecture dependent, mainly since they encode the
@ -501,7 +616,7 @@ DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@ \
gen-jacobitab$(EXEEXT_FOR_BUILD) gen-psqr$(EXEEXT_FOR_BUILD)
# Tell gmp.h it's building gmp, not an application, used by windows DLL stuff.
INCLUDES = -D__GMP_WITHIN_GMP
AM_CPPFLAGS = -D__GMP_WITHIN_GMP
MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/inits$U.lo mpf/set$U.lo \
mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo \
mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo \
@ -509,7 +624,7 @@ MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/inits$U.lo mpf/set$U.lo \
mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo \
mpf/sqrt$U.lo mpf/random2$U.lo mpf/inp_str$U.lo mpf/out_str$U.lo \
mpf/add$U.lo mpf/add_ui$U.lo mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo \
mpf/mul$U.lo mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo \
mpf/mul$U.lo mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo mpf/cmp_z$U.lo \
mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \
mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \
mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \
@ -551,7 +666,9 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/ior$U.lo mpz/iset$U.lo mpz/iset_d$U.lo mpz/iset_si$U.lo \
mpz/iset_str$U.lo mpz/iset_ui$U.lo mpz/jacobi$U.lo mpz/kronsz$U.lo \
mpz/kronuz$U.lo mpz/kronzs$U.lo mpz/kronzu$U.lo \
mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \
mpz/lcm$U.lo mpz/lcm_ui$U.lo mpz/limbs_finish$U.lo \
mpz/limbs_modify$U.lo mpz/limbs_read$U.lo mpz/limbs_write$U.lo \
mpz/lucnum_ui$U.lo mpz/lucnum2_ui$U.lo \
mpz/millerrabin$U.lo mpz/mod$U.lo mpz/mul$U.lo mpz/mul_2exp$U.lo \
mpz/mul_si$U.lo mpz/mul_ui$U.lo \
mpz/n_pow_ui$U.lo mpz/neg$U.lo mpz/nextprime$U.lo \
@ -559,7 +676,7 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_sec$U.lo \
mpz/powm_ui$U.lo mpz/primorial_ui$U.lo \
mpz/pprime_p$U.lo mpz/random$U.lo mpz/random2$U.lo \
mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo \
mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$U.lo mpz/roinit_n$U.lo \
mpz/root$U.lo mpz/rootrem$U.lo mpz/rrandomb$U.lo mpz/scan0$U.lo \
mpz/scan1$U.lo mpz/set$U.lo mpz/set_d$U.lo mpz/set_f$U.lo \
mpz/set_q$U.lo mpz/set_si$U.lo mpz/set_str$U.lo mpz/set_ui$U.lo \
@ -674,7 +791,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu --ignore-deps Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -695,8 +811,8 @@ $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
@test -f $@ || rm -f stamp-h1
@test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1
stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status
@rm -f stamp-h1
@ -710,6 +826,7 @@ distclean-hdr:
-rm -f config.h stamp-h1
gmp.h: $(top_builddir)/config.status $(srcdir)/gmp-h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
@ -736,16 +853,20 @@ uninstall-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@list='$(lib_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libgmp.la: $(libgmp_la_OBJECTS) $(libgmp_la_DEPENDENCIES) $(EXTRA_libgmp_la_DEPENDENCIES)
$(libgmp_la_LINK) -rpath $(libdir) $(libgmp_la_OBJECTS) $(libgmp_la_LIBADD) $(LIBS)
$(AM_V_CCLD)$(libgmp_la_LINK) -rpath $(libdir) $(libgmp_la_OBJECTS) $(libgmp_la_LIBADD) $(LIBS)
libgmpxx.la: $(libgmpxx_la_OBJECTS) $(libgmpxx_la_DEPENDENCIES) $(EXTRA_libgmpxx_la_DEPENDENCIES)
$(libgmpxx_la_LINK) $(am_libgmpxx_la_rpath) $(libgmpxx_la_OBJECTS) $(libgmpxx_la_LIBADD) $(LIBS)
$(AM_V_CXXLD)$(libgmpxx_la_LINK) $(am_libgmpxx_la_rpath) $(libgmpxx_la_OBJECTS) $(libgmpxx_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -754,25 +875,25 @@ distclean-compile:
-rm -f *.tab.c
.c.o:
$(COMPILE) -c $<
$(AM_V_CC)$(COMPILE) -c -o $@ $<
.c.obj:
$(COMPILE) -c `$(CYGPATH_W) '$<'`
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
$(LTCOMPILE) -c -o $@ $<
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
.cc.o:
$(CXXCOMPILE) -c -o $@ $<
$(AM_V_CXX)$(CXXCOMPILE) -c -o $@ $<
.cc.obj:
$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
$(AM_V_CXX)$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.cc.lo:
$(LTCXXCOMPILE) -c -o $@ $<
$(AM_V_CXX)$(LTCXXCOMPILE) -c -o $@ $<
dummy.lo: cxx/dummy.cc
$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.lo `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc
$(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.lo `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc
mostlyclean-libtool:
-rm -f *.lo
@ -826,22 +947,25 @@ uninstall-nodist_includeexecHEADERS:
dir='$(DESTDIR)$(includeexecdir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
# (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
@fail=; \
if $(am__make_keepgoing); then \
failcom='fail=yes'; \
else \
failcom='exit 1'; \
fi; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
for subdir in $$list; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
dot_seen=yes; \
@ -856,57 +980,12 @@ $(RECURSIVE_TARGETS):
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
@fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
*k*) failcom='fail=yes';; \
esac; \
done; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
*) list='$(SUBDIRS)' ;; \
esac; \
rev=''; for subdir in $$list; do \
if test "$$subdir" = "."; then :; else \
rev="$$subdir $$rev"; \
fi; \
done; \
rev="$$rev ."; \
target=`echo $@ | sed s/-recursive//`; \
for subdir in $$rev; do \
echo "Making $$target in $$subdir"; \
if test "$$subdir" = "."; then \
local_target="$$target-am"; \
else \
local_target="$$target"; \
fi; \
($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-recursive
TAGS: tags
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; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
@ -922,12 +1001,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.in $(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; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@ -939,15 +1013,11 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
list='$(SOURCES) $(HEADERS) config.in $(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; }; }'`; \
ctags: ctags-recursive
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@ -956,9 +1026,31 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscope: cscope.files
test ! -s cscope.files \
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
clean-cscope:
-rm -f cscope.files
cscope.files: clean-cscope cscopelist
cscopelist: cscopelist-recursive
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
distdir: $(DISTFILES)
$(am__remove_distdir)
@ -1029,40 +1121,42 @@ distdir: $(DISTFILES)
|| chmod -R a+r "$(distdir)"
dist-gzip: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
$(am__remove_distdir)
dist-lzma: distdir
tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-tarZ: distdir
@echo WARNING: "Support for distribution archives compressed with" \
"legacy program 'compress' is deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-shar: distdir
@echo WARNING: "Support for shar distribution archives is" \
"deprecated." >&2
@echo WARNING: "It will be removed altogether in Automake 2.0" >&2
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
$(am__remove_distdir)
$(am__post_remove_distdir)
dist-zip: distdir
-rm -f $(distdir).zip
zip -rq $(distdir).zip $(distdir)
$(am__remove_distdir)
$(am__post_remove_distdir)
dist dist-all: distdir
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist dist-all:
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
$(am__post_remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
@ -1073,8 +1167,6 @@ distcheck: dist
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
*.tar.bz2*) \
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
@ -1086,18 +1178,19 @@ distcheck: dist
*.zip*) \
unzip $(distdir).zip ;;\
esac
chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod -R a-w $(distdir)
chmod u+w $(distdir)
mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst
chmod a-w $(distdir)
test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
&& $(am__cd) $(distdir)/_build/sub \
&& ../../configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
--srcdir=../.. --prefix="$$dc_install_base" \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
&& $(MAKE) $(AM_MAKEFLAGS) check \
@ -1120,7 +1213,7 @@ distcheck: dist
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
&& cd "$$am__cwd" \
|| exit 1
$(am__remove_distdir)
$(am__post_remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
@ -1268,21 +1361,21 @@ ps-am:
uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
uninstall-nodist_includeexecHEADERS
.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
ctags-recursive install install-am install-data-am \
install-strip tags-recursive
.MAKE: $(am__recursive_targets) all check install install-am \
install-data-am install-strip
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am am--refresh check check-am clean clean-generic \
clean-libLTLIBRARIES clean-libtool clean-local ctags \
ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
distcheck distclean distclean-compile distclean-generic \
distclean-hdr distclean-libtool distclean-local distclean-tags \
distcleancheck distdir distuninstallcheck dvi dvi-am html \
html-am info info-am install install-am install-data \
install-data-am install-data-hook install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \
am--refresh check check-am clean clean-cscope clean-generic \
clean-libLTLIBRARIES clean-libtool clean-local cscope \
cscopelist-am ctags ctags-am dist dist-all dist-bzip2 \
dist-gzip dist-hook dist-lzip dist-shar dist-tarZ dist-xz \
dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-local distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
install-data-hook install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am \
install-includeHEADERS install-info install-info-am \
install-libLTLIBRARIES install-man \
install-nodist_includeexecHEADERS install-pdf install-pdf-am \
@ -1290,9 +1383,10 @@ uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
installcheck-am installdirs installdirs-am maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-recursive uninstall uninstall-am \
uninstall-includeHEADERS uninstall-libLTLIBRARIES \
uninstall-nodist_includeexecHEADERS
tags tags-am uninstall uninstall-am uninstall-includeHEADERS \
uninstall-libLTLIBRARIES uninstall-nodist_includeexecHEADERS
.PRECIOUS: Makefile
install-data-hook:
@ -1374,15 +1468,14 @@ check-mini-gmp:
abs_srcdir="`cd $(srcdir) && pwd`" ; \
$(MKDIR_P) mini-gmp/tests \
&& cd mini-gmp/tests \
&& LD_LIBRARY_PATH="../../.libs:$$LD_LIBRARY_PATH" \
DYLD_LIBRARY_PATH="../../.libs:$$DYLD_LIBRARY_PATH" \
&& TEST_LIBRARY_PATH="../../.libs" \
$(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \
VPATH="$$abs_srcdir/mini-gmp/tests" \
srcdir="$$abs_srcdir/mini-gmp/tests" \
MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \
LDFLAGS="-L../../.libs" \
LIBS="-lgmp -lm" \
CC="$(CC_FOR_BUILD)" EXTRA_CFLAGS="-g -I../.." check
CC="$(CC)" CFLAGS="$(CFLAGS)" CPPFLAGS="-I../.." check
clean-mini-gmp:
if [ -d mini-gmp/tests ] ; then \

View File

@ -1,23 +1,33 @@
dnl GMP specific autoconf macros
dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, 2011 Free
dnl Software Foundation, Inc.
dnl Copyright 2000-2006, 2009, 2011, 2013-2015 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
dnl Some tests use, or must delete, the default compiler output. The
@ -56,7 +66,7 @@ define(X86_PATTERN,
[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
define(X86_64_PATTERN,
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | bulldozer-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*]])
[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar*-*-* | bulldozer*-*-* | piledriver*-*-* | steamroller*-*-* | excavator*-*-* | pentium4-*-* | atom-*-* | silvermont-*-* | goldmont-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-* | nehalem*-*-* | westmere*-*-* | sandybridge*-*-* | ivybridge*-*-* | haswell*-*-* | broadwell*-*-* | skylake*-*-* | kabylake*-*-*]])
dnl GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
dnl ---------------------------------
@ -313,7 +323,9 @@ dnl macros.
``bad: $][# not supported (SunOS /usr/bin/m4)
'')ifelse(eval(89),89,`define(t2,Y)',
`bad: eval() doesnt support 8 or 9 in a constant (OpenBSD 2.6 m4)
')ifelse(t1`'t2,YY,`good
')ifelse(eval(9,9),10,`define(t3,Y)',
`bad: eval() doesnt support radix in eval (FreeBSD 8.x,9.0,9.1,9.2 m4)
')ifelse(t1`'t2`'t3,YYY,`good
')]
EOF
dnl ' <- balance the quotes for emacs sh-mode
@ -600,11 +612,12 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 1],
#if defined (__GNUC__) && ! defined (__cplusplus)
typedef unsigned long long t1;typedef t1*t2;
void g(){}
void h(){}
static __inline__ t1 e(t2 rp,t2 up,int n,t1 v0)
{t1 c,x,r;int i;if(v0){c=1;for(i=1;i<n;i++){x=up[i];r=x+1;rp[i]=r;}}return c;}
f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
void f(){static const struct{t1 n;t1 src[9];t1 want[9];}d[]={{1,{0},{1}},};t1 got[9];int i;
for(i=0;i<1;i++){if(e(got,got,9,d[i].n)==0)h();g(i,d[i].src,d[i].n,got,d[i].want,9);if(d[i].n)h();}}
h(){}g(){}
#else
int dummy;
#endif
@ -616,8 +629,23 @@ GMP_PROG_CC_WORKS_PART([$1], [long long reliability test 2],
1666 to get an ICE with -O1 -mpowerpc64. */
#if defined (__GNUC__) && ! defined (__cplusplus)
f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
g(){}
int g();
void f(int u){int i;long long x;x=u?~0:0;if(x)for(i=0;i<9;i++);x&=g();if(x)g();}
int g(){return 0;}
#else
int dummy;
#endif
])
GMP_PROG_CC_WORKS_PART([$1], [freebsd hacked gcc],
[/* Provokes an ICE on i386-freebsd with the FreeBSD-hacked gcc, under
-O2 -march=amdfam10. We call helper functions here "open" and "close" in
order for linking to succeed. */
#if defined (__GNUC__) && ! defined (__cplusplus)
int open(int*,int*,int);void*close(int);void g(int*rp,int*up,int un){
__builtin_expect(un<=0x7f00,1)?__builtin_alloca(un):close(un);if(__builtin_clzl
(up[un])){open(rp,up,un);while(1){if(rp[un-1]!=0)break;un--;}}}
#else
int dummy;
#endif
@ -678,7 +706,7 @@ main ()
GMP_PROG_CC_WORKS_PART_MAIN([$1], [mpn_lshift_com optimization 2],
[/* The following is mis-compiled by Intel ia-64 icc version 1.8 under
"icc -O3", After several calls, the function writes parial garbage to
"icc -O3", After several calls, the function writes partial garbage to
the result vector. Perhaps relates to the chk.a.nc insn. This code needs
to be run to show the problem, but that's fine, the offending cc is a
native-only compiler so we don't have to worry about cross compiling. */
@ -718,7 +746,7 @@ main ()
a[i] = ~0L;
r = malloc (10000 * sizeof (unsigned long));
r2 = r;
for (i = 0; i < 528; i += 22)
for (i = 0; i < 528; i += 23)
{
lshift_com (r2, a,
i / (8 * sizeof (unsigned long)) + 1,
@ -728,6 +756,7 @@ main ()
if (r[2048] != 0 || r[2049] != 0 || r[2050] != 0 || r[2051] != 0 ||
r[2052] != 0 || r[2053] != 0 || r[2054] != 0)
abort ();
free (r);
return 0;
}
#else
@ -1638,8 +1667,11 @@ rm -f conftest*
dnl Checks whether the stack can be marked nonexecutable by passing an option
dnl to the C-compiler when acting on .s files. Appends that option to ASFLAGS.
dnl to the C-compiler when acting on .s files. Appends that option to ASMFLAGS.
dnl This macro is adapted from one found in GLIBC-2.3.5.
dnl FIXME: This test looks broken. It tests that a file with .note.GNU-stack...
dnl can be compiled/assembled with -Wa,--noexecstack. It does not determine
dnl if that command-line option has any effect on general asm code.
AC_DEFUN([CL_AS_NOEXECSTACK],[
dnl AC_REQUIRE([AC_PROG_CC]) GMP uses something else
AC_CACHE_CHECK([whether assembler supports --noexecstack option],
@ -1726,9 +1758,9 @@ EOF
gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&AC_FD_CC"
if AC_TRY_EVAL(gmp_compile); then
$NM conftest.$OBJEXT >conftest.out
if grep _gurkmacka conftest.out >/dev/null; then
if grep "[[ ]]_gurkmacka" conftest.out >/dev/null; then
gmp_cv_asm_underscore=yes
elif grep gurkmacka conftest.out >/dev/null; then
elif grep "[[ ]]gurkmacka" conftest.out >/dev/null; then
gmp_cv_asm_underscore=no
else
echo "configure: $NM doesn't have gurkmacka:" >&AC_FD_CC
@ -1834,7 +1866,7 @@ AC_CACHE_CHECK([if the .align directive accepts an 0x90 fill in .text],
.byte 0
.align 4, 0x90],
[if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then
echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC
echo "Suppressing this warning by omitting 0x90" 1>&AC_FD_CC
gmp_cv_asm_align_fill_0x90=no
else
gmp_cv_asm_align_fill_0x90=yes
@ -2609,6 +2641,83 @@ esac
])
dnl GMP_ASM_X86_MULX([ACTION-IF-YES][,ACTION-IF-NO])
dnl ------------------------------------------------
dnl Determine whether the assembler supports the mulx instruction which debut
dnl with Haswell.
dnl
dnl This macro is wanted before GMP_ASM_TEXT, so ".text" is hard coded
dnl here. ".text" is believed to be correct on all x86 systems, certainly
dnl it's all GMP_ASM_TEXT gives currently. Actually ".text" probably isn't
dnl needed at all, at least for just checking instruction syntax.
AC_DEFUN([GMP_ASM_X86_MULX],
[AC_CACHE_CHECK([if the assembler knows about the mulx instruction],
gmp_cv_asm_x86_mulx,
[GMP_TRY_ASSEMBLE(
[ .text
mulx %r8, %r9, %r10],
[gmp_cv_asm_x86_mulx=yes],
[gmp_cv_asm_x86_mulx=no])
])
case $gmp_cv_asm_x86_mulx in
yes)
ifelse([$1],,:,[$1])
;;
*)
AC_MSG_WARN([+----------------------------------------------------------])
AC_MSG_WARN([| WARNING WARNING WARNING])
AC_MSG_WARN([| Host CPU has the mulx instruction, but it can't be])
AC_MSG_WARN([| assembled by])
AC_MSG_WARN([| $CCAS $CFLAGS $CPPFLAGS])
AC_MSG_WARN([| Older x86 instructions will be used.])
AC_MSG_WARN([| This will be an inferior build.])
AC_MSG_WARN([+----------------------------------------------------------])
ifelse([$2],,:,[$2])
;;
esac
])
dnl GMP_ASM_X86_ADX([ACTION-IF-YES][,ACTION-IF-NO])
dnl ------------------------------------------------
dnl Determine whether the assembler supports the adcx and adox instructions
dnl which debut with the Haswell shrink Broadwell.
dnl
dnl This macro is wanted before GMP_ASM_TEXT, so ".text" is hard coded
dnl here. ".text" is believed to be correct on all x86 systems, certainly
dnl it's all GMP_ASM_TEXT gives currently. Actually ".text" probably isn't
dnl needed at all, at least for just checking instruction syntax.
AC_DEFUN([GMP_ASM_X86_ADX],
[AC_CACHE_CHECK([if the assembler knows about the adox instruction],
gmp_cv_asm_x86_adx,
[GMP_TRY_ASSEMBLE(
[ .text
adox %r8, %r9
adcx %r8, %r9],
[gmp_cv_asm_x86_adx=yes],
[gmp_cv_asm_x86_adx=no])
])
case $gmp_cv_asm_x86_adx in
yes)
ifelse([$1],,:,[$1])
;;
*)
AC_MSG_WARN([+----------------------------------------------------------])
AC_MSG_WARN([| WARNING WARNING WARNING])
AC_MSG_WARN([| Host CPU has the adcx and adox instructions, but they])
AC_MSG_WARN([| can't be assembled by])
AC_MSG_WARN([| $CCAS $CFLAGS $CPPFLAGS])
AC_MSG_WARN([| Older x86 instructions will be used.])
AC_MSG_WARN([| This will be an inferior build.])
AC_MSG_WARN([+----------------------------------------------------------])
ifelse([$2],,:,[$2])
;;
esac
])
dnl GMP_ASM_X86_MCOUNT
dnl ------------------
dnl Find out how to call mcount for profiling on an x86 system.
@ -3016,6 +3125,57 @@ GMP_DEFINE_RAW(["define(<HAVE_REGISTER>,<$gmp_cv_asm_sparc_register>)"])
])
dnl GMP_ASM_SPARC_GOTDATA
dnl ----------------------
dnl Determine whether the assembler accepts gotdata relocations.
dnl
dnl See also mpn/sparc32/sparc-defs.m4 which uses the result of this test.
AC_DEFUN([GMP_ASM_SPARC_GOTDATA],
[AC_REQUIRE([GMP_ASM_TEXT])
AC_CACHE_CHECK([if the assembler accepts gotdata relocations],
gmp_cv_asm_sparc_gotdata,
[GMP_TRY_ASSEMBLE(
[ $gmp_cv_asm_text
.text
sethi %gdop_hix22(symbol), %g1
or %g1, %gdop_lox10(symbol), %g1
],
[gmp_cv_asm_sparc_gotdata=yes],
[gmp_cv_asm_sparc_gotdata=no])])
GMP_DEFINE_RAW(["define(<HAVE_GOTDATA>,<$gmp_cv_asm_sparc_gotdata>)"])
])
dnl GMP_ASM_SPARC_SHARED_THUNKS
dnl ----------------------
dnl Determine whether the assembler supports all of the features
dnl necessary in order to emit shared PIC thunks on sparc.
dnl
dnl See also mpn/sparc32/sparc-defs.m4 which uses the result of this test.
AC_DEFUN([GMP_ASM_SPARC_SHARED_THUNKS],
[AC_REQUIRE([GMP_ASM_TEXT])
AC_CACHE_CHECK([if the assembler can support shared PIC thunks],
gmp_cv_asm_sparc_shared_thunks,
[GMP_TRY_ASSEMBLE(
[ $gmp_cv_asm_text
.section .text.__sparc_get_pc_thunk.l7,"axG",@progbits,__sparc_get_pc_thunk.l7,comdat
.weak __sparc_get_pc_thunk.l7
.hidden __sparc_get_pc_thunk.l7
.type __sparc_get_pc_thunk.l7, #function
__sparc_get_pc_thunk.l7:
jmp %o7+8
add %o7, %l7, %l7
],
[gmp_cv_asm_sparc_shared_thunks=yes],
[gmp_cv_asm_sparc_shared_thunks=no])])
GMP_DEFINE_RAW(["define(<HAVE_SHARED_THUNKS>,<$gmp_cv_asm_sparc_shared_thunks>)"])
])
dnl GMP_C_ATTRIBUTE_CONST
dnl ---------------------
@ -3096,6 +3256,24 @@ if test $gmp_cv_c_attribute_noreturn = yes; then
fi
])
dnl GMP_C_HIDDEN_ALIAS
dnl ------------------------
AC_DEFUN([GMP_C_HIDDEN_ALIAS],
[AC_CACHE_CHECK([whether gcc hidden aliases work],
gmp_cv_c_hidden_alias,
[AC_TRY_COMPILE(
[void hid() __attribute__ ((visibility("hidden")));
void hid() {}
void pub() __attribute__ ((alias("hid")));],
, gmp_cv_c_hidden_alias=yes, gmp_cv_c_hidden_alias=no)
])
if test $gmp_cv_c_hidden_alias = yes; then
AC_DEFINE(HAVE_HIDDEN_ALIAS, 1,
[Define to 1 if the compiler accepts gcc style __attribute__ ((visibility))
and __attribute__ ((alias))])
fi
])
dnl GMP_C_DOUBLE_FORMAT
dnl -------------------
@ -3344,7 +3522,7 @@ esac
dnl GMP_C_STDARG
dnl ------------
dnl Test whether to use <stdarg.h> or <varargs.h>.
dnl Test whether to use <stdarg.h>.
dnl
dnl Notice the AC_DEFINE here is HAVE_STDARG to avoid clashing with
dnl HAVE_STDARG_H which could arise from AC_CHECK_HEADERS.
@ -3354,26 +3532,26 @@ dnl to be ANSI or K&R and the two can be differentiated by AC_PROG_CC_STDC
dnl or very likely by the setups for _PROTO in gmp.h. On the other hand
dnl this test is nice and direct, being what we're going to actually use.
AC_DEFUN([GMP_C_STDARG],
[AC_CACHE_CHECK([whether <stdarg.h> exists and works],
gmp_cv_c_stdarg,
[AC_TRY_COMPILE(
[#include <stdarg.h>
int foo (int x, ...)
{
va_list ap;
int y;
va_start (ap, x);
y = va_arg (ap, int);
va_end (ap);
return y;
}],,
gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
])
if test $gmp_cv_c_stdarg = yes; then
AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
fi
])
dnl AC_DEFUN([GMP_C_STDARG],
dnl [AC_CACHE_CHECK([whether <stdarg.h> exists and works],
dnl gmp_cv_c_stdarg,
dnl [AC_TRY_COMPILE(
dnl [#include <stdarg.h>
dnl int foo (int x, ...)
dnl {
dnl va_list ap;
dnl int y;
dnl va_start (ap, x);
dnl y = va_arg (ap, int);
dnl va_end (ap);
dnl return y;
dnl }],,
dnl gmp_cv_c_stdarg=yes, gmp_cv_c_stdarg=no)
dnl ])
dnl if test $gmp_cv_c_stdarg = yes; then
dnl AC_DEFINE(HAVE_STDARG, 1, [Define to 1 if <stdarg.h> exists and works])
dnl fi
dnl ])
dnl GMP_FUNC_ALLOCA
@ -3527,8 +3705,7 @@ dnl not sure which 2.0.x does which), but still puts the correct null
dnl terminated result into the buffer.
AC_DEFUN([GMP_FUNC_VSNPRINTF],
[AC_REQUIRE([GMP_C_STDARG])
AC_CHECK_FUNC(vsnprintf,
[AC_CHECK_FUNC(vsnprintf,
[gmp_vsnprintf_exists=yes],
[gmp_vsnprintf_exists=no])
if test "$gmp_vsnprintf_exists" = no; then
@ -3542,31 +3719,16 @@ else
#include <string.h> /* for strcmp */
#include <stdio.h> /* for vsnprintf */
#if HAVE_STDARG
#include <stdarg.h>
#else
#include <varargs.h>
#endif
int
#if HAVE_STDARG
check (const char *fmt, ...)
#else
check (va_alist)
va_dcl
#endif
{
static char buf[128];
va_list ap;
int ret;
#if HAVE_STDARG
va_start (ap, fmt);
#else
char *fmt;
va_start (ap);
fmt = va_arg (ap, char *);
#endif
ret = vsnprintf (buf, 4, fmt, ap);
@ -3694,7 +3856,7 @@ cat >conftest.c <<EOF
int
main ()
{
exit(0);
return 0;
}
EOF
gmp_compile="$1 conftest.c"
@ -3768,7 +3930,7 @@ AC_CACHE_CHECK([for build system executable suffix],
int
main ()
{
exit (0);
return 0;
}
EOF
for i in .exe ,ff8 ""; do
@ -3804,7 +3966,7 @@ AC_CACHE_CHECK([whether build system compiler is ANSI],
int
main (int argc, char **argv)
{
exit(0);
return 0;
}
EOF
gmp_compile="$CC_FOR_BUILD conftest.c"
@ -3835,10 +3997,11 @@ AC_DEFUN([GMP_CHECK_LIBM_FOR_BUILD],
AC_CACHE_CHECK([for build system compiler math library],
gmp_cv_check_libm_for_build,
[cat >conftest.c <<EOF
#include <math.h>
int
main ()
{
exit(0);
return 0;
}
double d;
double

View File

@ -1,14 +1,12 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
# Copyright 1992-2015 Free Software Foundation, Inc.
timestamp='2012-09-25'
timestamp='2015-10-21'
# This file 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 2 of the License, or
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@ -17,24 +15,22 @@ timestamp='2012-09-25'
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
#
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
#
# Please send patches to <config-patches@gnu.org>.
me=`echo "$0" | sed -e 's,.*/,,'`
@ -54,9 +50,7 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
case "${UNAME_SYSTEM}" in
Linux|GNU|GNU/*)
# If the system lacks a compiler, then just pick glibc.
# We could probably try harder.
LIBC=gnu
eval $set_cc_for_build
cat <<-EOF > $dummy.c
#include <features.h>
#if defined(__UCLIBC__)
LIBC=uclibc
#elif defined(__dietlibc__)
LIBC=dietlibc
#else
LIBC=gnu
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
;;
esac
# Note: order is significant - the case branches are not exclusive.
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
@ -153,8 +168,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# Note: NetBSD doesn't particularly care about the vendor
# portion of the name. We always set it to "unknown".
sysctl="sysctl -n hw.machine_arch"
UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || echo unknown)`
UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \
/sbin/$sysctl 2>/dev/null || \
/usr/sbin/$sysctl 2>/dev/null || \
echo unknown)`
case "${UNAME_MACHINE_ARCH}" in
armeb) machine=armeb-unknown ;;
arm*) machine=arm-unknown ;;
@ -164,6 +181,11 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sh3el) machine=shl-unknown ;;
sh3eb) machine=sh-unknown ;;
sh5el) machine=sh5le-unknown ;;
earmv*)
arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'`
endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'`
machine=${arch}${endian}-unknown
;;
*) machine=${UNAME_MACHINE_ARCH}-unknown ;;
esac
# The Operating System including object format, if it has switched
@ -196,6 +218,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
os=netbsd
;;
esac
# Determine ABI tags.
case "${UNAME_MACHINE_ARCH}" in
earm*)
expr='s/^earmv[0-9]/-eabi/;s/eb$//'
abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"`
;;
esac
# The OS release
# Debian GNU/NetBSD machines have a different userland, and
# thus, need a distinct triplet. However, they do not need
@ -206,13 +235,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
release='-gnu'
;;
*)
release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2`
;;
esac
# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
# contains redundant information, the shorter form:
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
echo "${machine}-${os}${release}${abi}"
exit ;;
*:Bitrig:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
@ -234,6 +263,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
*:MirBSD:*:*)
echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
exit ;;
*:Sortix:*:*)
echo ${UNAME_MACHINE}-unknown-sortix
exit ;;
alpha:OSF1:*:*)
case $UNAME_RELEASE in
*4.0)
@ -578,8 +610,9 @@ EOF
else
IBM_ARCH=powerpc
fi
if [ -x /usr/bin/oslevel ] ; then
IBM_REV=`/usr/bin/oslevel`
if [ -x /usr/bin/lslpp ] ; then
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
else
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
fi
@ -825,7 +858,7 @@ EOF
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
i*:MSYS*:*)
*:MSYS*:*)
echo ${UNAME_MACHINE}-pc-msys
exit ;;
i*:windows32*:*)
@ -873,21 +906,21 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
exit ;;
*:GNU/*:*:*)
# other systems with GNU libc and userland
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
aarch64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
aarch64_be:Linux:*:*)
UNAME_MACHINE=aarch64_be
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
@ -900,59 +933,60 @@ EOF
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arc:Linux:*:* | arceb:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
else
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_PCS_VFP
then
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
else
echo ${UNAME_MACHINE}-unknown-linux-gnueabihf
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
fi
fi
exit ;;
avr32*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
cris:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
crisv32:Linux:*:*)
echo ${UNAME_MACHINE}-axis-linux-gnu
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
exit ;;
e2k:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
frv:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
hexagon:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
k1om:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m32r*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
@ -971,54 +1005,63 @@ EOF
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
;;
or32:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
openrisc*:Linux:*:*)
echo or1k-unknown-linux-${LIBC}
exit ;;
or32:Linux:*:* | or1k*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
echo sparc-unknown-linux-${LIBC}
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
echo hppa64-unknown-linux-${LIBC}
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
PA7*) echo hppa1.1-unknown-linux-gnu ;;
PA8*) echo hppa2.0-unknown-linux-gnu ;;
*) echo hppa-unknown-linux-gnu ;;
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
*) echo hppa-unknown-linux-${LIBC} ;;
esac
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
echo powerpc64-unknown-linux-${LIBC}
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
echo powerpc-unknown-linux-${LIBC}
exit ;;
ppc64le:Linux:*:*)
echo powerpc64le-unknown-linux-${LIBC}
exit ;;
ppcle:Linux:*:*)
echo powerpcle-unknown-linux-${LIBC}
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
exit ;;
sh64*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sh*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
tile*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
exit ;;
x86_64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
exit ;;
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
exit ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
@ -1094,7 +1137,7 @@ EOF
# uname -m prints for DJGPP always 'pc', but it prints nothing about
# the processor, so we play safe by assuming i586.
# Note: whatever this is, it MUST be the same as what config.sub
# prints for the "djgpp" host, or else GDB configury will decide that
# prints for the "djgpp" host, or else GDB configure will decide that
# this is a cross-build.
echo i586-pc-msdosdjgpp
exit ;;
@ -1251,19 +1294,31 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
eval $set_cc_for_build
if test "$UNAME_PROCESSOR" = unknown ; then
UNAME_PROCESSOR=powerpc
fi
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
case $UNAME_PROCESSOR in
i386) UNAME_PROCESSOR=x86_64 ;;
powerpc) UNAME_PROCESSOR=powerpc64 ;;
esac
fi
fi
elif test "$UNAME_PROCESSOR" = i386 ; then
# Avoid executing cc on OS X 10.9, as it ships with a stub
# that puts up a graphical alert prompting to install
# developer tools. Any system running Mac OS X 10.7 or
# later (Darwin 11 and later) is required to have a 64-bit
# processor. This is not true of the ARM version of Darwin
# that Apple uses in portable devices.
UNAME_PROCESSOR=x86_64
fi
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@ -1354,154 +1409,6 @@ EOF
exit ;;
esac
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
# include <sys/types.h>
# include <sys/utsname.h>
#endif
main ()
{
#if defined (sony)
#if defined (MIPSEB)
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
I don't know.... */
printf ("mips-sony-bsd\n"); exit (0);
#else
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
"4"
#else
""
#endif
); exit (0);
#endif
#endif
#if defined (__arm) && defined (__acorn) && defined (__unix)
printf ("arm-acorn-riscix\n"); exit (0);
#endif
#if defined (hp300) && !defined (hpux)
printf ("m68k-hp-bsd\n"); exit (0);
#endif
#if defined (NeXT)
#if !defined (__ARCHITECTURE__)
#define __ARCHITECTURE__ "m68k"
#endif
int version;
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
if (version < 4)
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
else
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
exit (0);
#endif
#if defined (MULTIMAX) || defined (n16)
#if defined (UMAXV)
printf ("ns32k-encore-sysv\n"); exit (0);
#else
#if defined (CMU)
printf ("ns32k-encore-mach\n"); exit (0);
#else
printf ("ns32k-encore-bsd\n"); exit (0);
#endif
#endif
#endif
#if defined (__386BSD__)
printf ("i386-pc-bsd\n"); exit (0);
#endif
#if defined (sequent)
#if defined (i386)
printf ("i386-sequent-dynix\n"); exit (0);
#endif
#if defined (ns32000)
printf ("ns32k-sequent-dynix\n"); exit (0);
#endif
#endif
#if defined (_SEQUENT_)
struct utsname un;
uname(&un);
if (strncmp(un.version, "V2", 2) == 0) {
printf ("i386-sequent-ptx2\n"); exit (0);
}
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
printf ("i386-sequent-ptx1\n"); exit (0);
}
printf ("i386-sequent-ptx\n"); exit (0);
#endif
#if defined (vax)
# if !defined (ultrix)
# include <sys/param.h>
# if defined (BSD)
# if BSD == 43
printf ("vax-dec-bsd4.3\n"); exit (0);
# else
# if BSD == 199006
printf ("vax-dec-bsd4.3reno\n"); exit (0);
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# endif
# else
printf ("vax-dec-bsd\n"); exit (0);
# endif
# else
printf ("vax-dec-ultrix\n"); exit (0);
# endif
#endif
#if defined (alliant) && defined (i860)
printf ("i860-alliant-bsd\n"); exit (0);
#endif
exit (1);
}
EOF
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
{ echo "$SYSTEM_NAME"; exit; }
# Apollos put the system type in the environment.
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
# Convex versions that predate uname can use getsysinfo(1)
if [ -x /usr/convex/getsysinfo ]
then
case `getsysinfo -f cpu_type` in
c1*)
echo c1-convex-bsd
exit ;;
c2*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
exit ;;
c34*)
echo c34-convex-bsd
exit ;;
c38*)
echo c38-convex-bsd
exit ;;
c4*)
echo c4-convex-bsd
exit ;;
esac
fi
cat >&2 <<EOF
$0: unable to guess system type

View File

@ -1,36 +1,31 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
# Copyright 1992-2015 Free Software Foundation, Inc.
timestamp='2012-12-06'
timestamp='2015-08-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
# can handle that machine. It does not imply ALL GNU software can.
#
# This file 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 2 of the License, or
# This file 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.
#
# This program 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.
# This program 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 this program; if not, see <http://www.gnu.org/licenses/>.
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted GNU ChangeLog entry.
# Please send patches to <config-patches@gnu.org>.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
@ -73,9 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
Free Software Foundation, Inc.
Copyright 1992-2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@ -259,19 +252,21 @@ case $basic_machine in
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
| arc \
| arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| ba \
| be32 | be64 \
| bfin \
| c4x | clipper \
| c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \
| e2k | epiphany \
| fido | fr30 | frv | ft32 \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
@ -289,26 +284,29 @@ case $basic_machine in
| mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
| moxie \
| mt \
| msp430 \
| nds32 | nds32le | nds32be \
| nios | nios2 \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \
| open8 \
| or32 \
| open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
@ -316,6 +314,7 @@ case $basic_machine in
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
@ -330,7 +329,10 @@ case $basic_machine in
c6x)
basic_machine=tic6x-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@ -373,21 +375,23 @@ case $basic_machine in
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
| ba-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \
| c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| e2k-* | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
@ -408,28 +412,33 @@ case $basic_machine in
| mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
| nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \
| riscv32-* | riscv64-* \
| rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \
| tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
@ -437,6 +446,7 @@ case $basic_machine in
| ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \
@ -513,6 +523,9 @@ case $basic_machine in
basic_machine=i386-pc
os=-aros
;;
asmjs)
basic_machine=asmjs-unknown
;;
aux)
basic_machine=m68k-apple
os=-aux
@ -774,6 +787,9 @@ case $basic_machine in
basic_machine=m68k-isi
os=-sysv
;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu)
basic_machine=m68k-unknown
os=-linux
@ -801,7 +817,7 @@ case $basic_machine in
os=-mingw64
;;
mingw32)
basic_machine=i386-pc
basic_machine=i686-pc
os=-mingw32
;;
mingw32ce)
@ -829,6 +845,10 @@ case $basic_machine in
basic_machine=powerpc-unknown
os=-morphos
;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos)
basic_machine=i386-pc
os=-msdos
@ -837,7 +857,7 @@ case $basic_machine in
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
msys)
basic_machine=i386-pc
basic_machine=i686-pc
os=-msys
;;
mvs)
@ -1359,9 +1379,9 @@ case $os in
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -aos* | -aros* | -cloudabi* | -sortix* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@ -1374,14 +1394,14 @@ case $os in
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@ -1505,9 +1525,6 @@ case $os in
-aros*)
os=-aros
;;
-kaos*)
os=-kaos
;;
-zvmoe)
os=-zvmoe
;;
@ -1556,6 +1573,9 @@ case $basic_machine in
c4x-* | tic4x-*)
os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,32 @@
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002,
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free
Software Foundation, Inc.
Copyright 1991, 1993-1997, 1999-2016 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#ifndef __GMP_H__
@ -40,19 +49,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define GMP_NAIL_MASK (~ GMP_NUMB_MASK)
/* The following (everything under ifndef __GNU_MP__) must be identical in
gmp.h and mp.h to allow both to be included in an application or during
the library build. */
#ifndef __GNU_MP__
#define __GNU_MP__ 5
#define __GNU_MP__ 6
#define __need_size_t /* tell gcc stddef.h we only want size_t */
#if defined (__cplusplus)
#include <cstddef> /* for size_t */
#else
#include <stddef.h> /* for size_t */
#endif
#undef __need_size_t
#include <limits.h>
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
@ -228,8 +229,6 @@ typedef const __mpq_struct *mpq_srcptr;
typedef __mpq_struct *mpq_ptr;
/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
section. */
#if __GMP_LIBGMP_DLL
#ifdef __GMP_WITHIN_GMPXX
/* compiling to go into a DLL libgmpxx */
@ -264,7 +263,8 @@ typedef __mpq_struct *mpq_ptr;
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
|| defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
|| defined (__STDIO_LOADED) /* VMS */
|| defined (__STDIO_LOADED) /* VMS */ \
|| defined (__DEFINED_FILE) /* musl */
#define _GMP_H_HAVE_FILE 1
#endif
@ -276,16 +276,14 @@ typedef __mpq_struct *mpq_ptr;
#define _GMP_H_HAVE_OBSTACK 1
#endif
/* The prototypes for gmp_vprintf etc are provided only if va_list is
available, via an application having included <stdarg.h> or <varargs.h>.
Usually va_list is a typedef so can't be tested directly, but C99
specifies that va_start is a macro (and it was normally a macro on past
systems too), so look for that.
/* The prototypes for gmp_vprintf etc are provided only if va_list is defined,
via an application having included <stdarg.h>. Usually va_list is a typedef
so can't be tested directly, but C99 specifies that va_start is a macro.
<stdio.h> will define some sort of va_list for vprintf and vfprintf, but
let's not bother trying to use that since it's not standard and since
application uses for gmp_vprintf etc will almost certainly require the
whole <stdarg.h> or <varargs.h> anyway. */
whole <stdarg.h> anyway. */
#ifdef va_start
#define _GMP_H_HAVE_VA_LIST 1
@ -442,12 +440,6 @@ typedef __mpq_struct *mpq_ptr;
#define __GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
#define __GMP_MAX(h,i) ((h) > (i) ? (h) : (i))
/* __GMP_USHRT_MAX is not "~ (unsigned short) 0" because short is promoted
to int by "~". */
#define __GMP_UINT_MAX (~ (unsigned) 0)
#define __GMP_ULONG_MAX (~ (unsigned long) 0)
#define __GMP_USHRT_MAX ((unsigned short) ~0)
/* __builtin_expect is in gcc 3.0, and not in 2.95. */
#if __GMP_GNUC_PREREQ (3,0)
@ -465,7 +457,7 @@ typedef __mpq_struct *mpq_ptr;
#endif
/* Allow direct user access to numerator and denominator of a mpq_t object. */
/* Allow direct user access to numerator and denominator of an mpq_t object. */
#define mpq_numref(Q) (&((Q)->_mp_num))
#define mpq_denref(Q) (&((Q)->_mp_den))
@ -482,8 +474,8 @@ __GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
#define mp_get_memory_functions __gmp_get_memory_functions
__GMP_DECLSPEC void mp_get_memory_functions (void *(**) (size_t),
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t)) __GMP_NOTHROW;
void *(**) (void *, size_t, size_t),
void (**) (void *, size_t)) __GMP_NOTHROW;
#define mp_bits_per_limb __gmp_bits_per_limb
__GMP_DECLSPEC extern const int mp_bits_per_limb;
@ -1115,6 +1107,22 @@ __GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
#define mpz_eor __gmpz_xor
__GMP_DECLSPEC void mpz_xor (mpz_ptr, mpz_srcptr, mpz_srcptr);
#define mpz_limbs_read __gmpz_limbs_read
__GMP_DECLSPEC mp_srcptr mpz_limbs_read (mpz_srcptr);
#define mpz_limbs_write __gmpz_limbs_write
__GMP_DECLSPEC mp_ptr mpz_limbs_write (mpz_ptr, mp_size_t);
#define mpz_limbs_modify __gmpz_limbs_modify
__GMP_DECLSPEC mp_ptr mpz_limbs_modify (mpz_ptr, mp_size_t);
#define mpz_limbs_finish __gmpz_limbs_finish
__GMP_DECLSPEC void mpz_limbs_finish (mpz_ptr, mp_size_t);
#define mpz_roinit_n __gmpz_roinit_n
__GMP_DECLSPEC mpz_srcptr mpz_roinit_n (mpz_ptr, mp_srcptr, mp_size_t);
#define MPZ_ROINIT_N(xp, xs) {{0, (xs),(xp) }}
/**************** Rational (i.e. Q) routines. ****************/
@ -1144,6 +1152,9 @@ __GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE
#define _mpq_cmp_ui __gmpq_cmp_ui
__GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
#define mpq_cmp_z __gmpq_cmp_z
__GMP_DECLSPEC int mpq_cmp_z (mpq_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
#define mpq_div __gmpq_div
__GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
@ -1251,6 +1262,9 @@ __GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
#define mpf_cmp __gmpf_cmp
__GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_cmp_z __gmpf_cmp_z
__GMP_DECLSPEC int mpf_cmp_z (mpf_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_cmp_d __gmpf_cmp_d
__GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
@ -1461,6 +1475,14 @@ __GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
__GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpn_zero_p __MPN(zero_p)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_zero_p)
__GMP_DECLSPEC int mpn_zero_p (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpn_divexact_1 __MPN(divexact_1)
__GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_divexact_by3(dst,src,size) \
mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
@ -1479,6 +1501,9 @@ __GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
#define mpn_divrem_2 __MPN(divrem_2)
__GMP_DECLSPEC mp_limb_t mpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
#define mpn_div_qr_1 __MPN(div_qr_1)
__GMP_DECLSPEC mp_limb_t mpn_div_qr_1 (mp_ptr, mp_limb_t *, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_div_qr_2 __MPN(div_qr_2)
__GMP_DECLSPEC mp_limb_t mpn_div_qr_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
@ -1524,9 +1549,7 @@ __GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
#endif
#define mpn_com __MPN(com)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_com)
__GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
#endif
#define mpn_perfect_square_p __MPN(perfect_square_p)
__GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
@ -1562,6 +1585,9 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PU
#define mpn_set_str __MPN(set_str)
__GMP_DECLSPEC mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
#define mpn_sizeinbase __MPN(sizeinbase)
__GMP_DECLSPEC size_t mpn_sizeinbase (mp_srcptr, mp_size_t, int);
#define mpn_sqrtrem __MPN(sqrtrem)
__GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
@ -1608,6 +1634,56 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
#define mpn_zero __MPN(zero)
__GMP_DECLSPEC void mpn_zero (mp_ptr, mp_size_t);
#define mpn_cnd_add_n __MPN(cnd_add_n)
__GMP_DECLSPEC mp_limb_t mpn_cnd_add_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#define mpn_cnd_sub_n __MPN(cnd_sub_n)
__GMP_DECLSPEC mp_limb_t mpn_cnd_sub_n (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#define mpn_sec_add_1 __MPN(sec_add_1)
__GMP_DECLSPEC mp_limb_t mpn_sec_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_sec_add_1_itch __MPN(sec_add_1_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_add_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_sub_1 __MPN(sec_sub_1)
__GMP_DECLSPEC mp_limb_t mpn_sec_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_sec_sub_1_itch __MPN(sec_sub_1_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_sub_1_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_cnd_swap __MPN(cnd_swap)
__GMP_DECLSPEC void mpn_cnd_swap (mp_limb_t, volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t);
#define mpn_sec_mul __MPN(sec_mul)
__GMP_DECLSPEC void mpn_sec_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sec_mul_itch __MPN(sec_mul_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_mul_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_sqr __MPN(sec_sqr)
__GMP_DECLSPEC void mpn_sec_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sec_sqr_itch __MPN(sec_sqr_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_sqr_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_powm __MPN(sec_powm)
__GMP_DECLSPEC void mpn_sec_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_bitcnt_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sec_powm_itch __MPN(sec_powm_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_powm_itch (mp_size_t, mp_bitcnt_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_tabselect __MPN(sec_tabselect)
__GMP_DECLSPEC void mpn_sec_tabselect (volatile mp_limb_t *, volatile const mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
#define mpn_sec_div_qr __MPN(sec_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_sec_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sec_div_qr_itch __MPN(sec_div_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_div_qr_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_div_r __MPN(sec_div_r)
__GMP_DECLSPEC void mpn_sec_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sec_div_r_itch __MPN(sec_div_r_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_div_r_itch (mp_size_t, mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_sec_invert __MPN(sec_invert)
__GMP_DECLSPEC int mpn_sec_invert (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_bitcnt_t, mp_ptr);
#define mpn_sec_invert_itch __MPN(sec_invert_itch)
__GMP_DECLSPEC mp_size_t mpn_sec_invert_itch (mp_size_t) __GMP_ATTRIBUTE_PURE;
#define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv)
__GMP_DECLSPEC mp_limb_t mpn_udiv_w_sdiv (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t);
@ -1658,7 +1734,7 @@ __GMP_EXTERN_INLINE
int
mpz_fits_uint_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
{
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_UINT_MAX);
__GMPZ_FITS_UTYPE_P (__gmp_z, UINT_MAX);
}
#endif
@ -1669,7 +1745,7 @@ __GMP_EXTERN_INLINE
int
mpz_fits_ulong_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
{
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_ULONG_MAX);
__GMPZ_FITS_UTYPE_P (__gmp_z, ULONG_MAX);
}
#endif
@ -1680,7 +1756,7 @@ __GMP_EXTERN_INLINE
int
mpz_fits_ushort_p (mpz_srcptr __gmp_z) __GMP_NOTHROW
{
__GMPZ_FITS_UTYPE_P (__gmp_z, __GMP_USHRT_MAX);
__GMPZ_FITS_UTYPE_P (__gmp_z, USHRT_MAX);
}
#endif
@ -1697,7 +1773,7 @@ mpz_get_ui (mpz_srcptr __gmp_z) __GMP_NOTHROW
/* This is a "#if" rather than a plain "if" so as to avoid gcc warnings
about "<< GMP_NUMB_BITS" exceeding the type size, and to avoid Borland
C++ 6.0 warnings about condition always true for something like
"__GMP_ULONG_MAX < GMP_NUMB_MASK". */
"ULONG_MAX < GMP_NUMB_MASK". */
#if GMP_NAIL_BITS == 0 || defined (_LONG_LONG_LIMB)
/* limb==long and no nails, or limb==longlong, one limb is enough */
return (__gmp_n != 0 ? __gmp_l : 0);
@ -1765,7 +1841,7 @@ mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
mp_bitcnt_t __gmp_result;
__gmp_usize = __gmp_u->_mp_size;
__gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0);
__gmp_result = (__gmp_usize < 0 ? ULONG_MAX : 0);
if (__GMP_LIKELY (__gmp_usize > 0))
__gmp_result = mpn_popcount (__gmp_u->_mp_d, __gmp_usize);
return __gmp_result;
@ -2088,6 +2164,22 @@ mpn_cmp (mp_srcptr __gmp_xp, mp_srcptr __gmp_yp, mp_size_t __gmp_size) __GMP_NOT
}
#endif
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_zero_p)
#if ! defined (__GMP_FORCE_mpn_zero_p)
__GMP_EXTERN_INLINE
#endif
int
mpn_zero_p (mp_srcptr __gmp_p, mp_size_t __gmp_n) __GMP_NOTHROW
{
/* if (__GMP_LIKELY (__gmp_n > 0)) */
do {
if (__gmp_p[--__gmp_n] != 0)
return 0;
} while (__gmp_n != 0);
return 1;
}
#endif
#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_sub)
#if ! defined (__GMP_FORCE_mpn_sub)
__GMP_EXTERN_INLINE
@ -2121,14 +2213,20 @@ __GMP_EXTERN_INLINE
mp_limb_t
mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
{
mp_limb_t __gmp_ul, __gmp_cy;
__gmp_cy = 0;
do {
__gmp_ul = *__gmp_up++;
*__gmp_rp++ = -__gmp_ul - __gmp_cy;
__gmp_cy |= __gmp_ul != 0;
} while (--__gmp_n != 0);
return __gmp_cy;
while (*__gmp_up == 0) /* Low zero limbs are unchanged by negation. */
{
*__gmp_rp = 0;
if (!--__gmp_n) /* All zero */
return 0;
++__gmp_up; ++__gmp_rp;
}
*__gmp_rp = (- *__gmp_up) & GMP_NUMB_MASK;
if (--__gmp_n) /* Higher limbs get complemented. */
mpn_com (++__gmp_rp, ++__gmp_up, __gmp_n);
return 1;
}
#endif
@ -2147,17 +2245,18 @@ mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
#define mpz_cmp_ui(Z,UI) \
(__builtin_constant_p (UI) && (UI) == 0 \
? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
#define mpz_cmp_si(Z,SI) \
(__builtin_constant_p (SI) && (SI) == 0 ? mpz_sgn (Z) \
: __builtin_constant_p (SI) && (SI) > 0 \
? _mpz_cmp_ui (Z, __GMP_CAST (unsigned long int, SI)) \
#define mpz_cmp_si(Z,SI) \
(__builtin_constant_p ((SI) >= 0) && (SI) >= 0 \
? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI)) \
: _mpz_cmp_si (Z,SI))
#define mpq_cmp_ui(Q,NUI,DUI) \
(__builtin_constant_p (NUI) && (NUI) == 0 \
? mpq_sgn (Q) : _mpq_cmp_ui (Q,NUI,DUI))
#define mpq_cmp_si(q,n,d) \
(__builtin_constant_p ((n) >= 0) && (n) >= 0 \
? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
#define mpq_cmp_ui(Q,NUI,DUI) \
(__builtin_constant_p (NUI) && (NUI) == 0 ? mpq_sgn (Q) \
: __builtin_constant_p ((NUI) == (DUI)) && (NUI) == (DUI) \
? mpz_cmp (mpq_numref (Q), mpq_denref (Q)) \
: _mpq_cmp_ui (Q,NUI,DUI))
#define mpq_cmp_si(q,n,d) \
(__builtin_constant_p ((n) >= 0) && (n) >= 0 \
? mpq_cmp_ui (q, __GMP_CAST (unsigned long, n), d) \
: _mpq_cmp_si (q, n, d))
#else
#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
@ -2221,10 +2320,10 @@ enum
#define __GMP_CC "@CC@"
#define __GMP_CFLAGS "@CFLAGS@"
/* Major version number is the value of __GNU_MP__ too, above and in mp.h. */
#define __GNU_MP_VERSION 5
/* Major version number is the value of __GNU_MP__ too, above. */
#define __GNU_MP_VERSION 6
#define __GNU_MP_VERSION_MINOR 1
#define __GNU_MP_VERSION_PATCHLEVEL 3
#define __GNU_MP_VERSION_PATCHLEVEL 2
#define __GNU_MP_RELEASE (__GNU_MP_VERSION * 10000 + __GNU_MP_VERSION_MINOR * 100 + __GNU_MP_VERSION_PATCHLEVEL)
#define __GMP_H__

View File

@ -3,24 +3,33 @@
THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND ARE ALMOST CERTAIN TO
BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES.
Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Free Software
Foundation, Inc.
Copyright 1991, 1993-1997, 1999-2015 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
/* __GMP_DECLSPEC must be given on any global data that will be accessed
@ -38,9 +47,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include <intrinsics.h> /* for _popcnt */
#endif
/* limits.h is not used in general, since it's an ANSI-ism, and since on
solaris gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
values (the ABI=64 values).
/* For INT_MAX, etc. We used to avoid it because of a bug (on solaris,
gcc 2.95 under -mcpu=ultrasparc in ABI=32 ends up getting wrong
values (the ABI=64 values)), but it should be safe now.
On Cray vector systems, however, we need the system limits.h since sizes
of signed and unsigned types can differ there, depending on compiler
@ -48,9 +57,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
reference, int can be 46 or 64 bits, whereas uint is always 64 bits; and
short can be 24, 32, 46 or 64 bits, and different for ushort. */
#if defined _CRAY
#include <limits.h>
#endif
/* For fat.h and other fat binary stuff.
No need for __GMP_ATTRIBUTE_PURE or __GMP_NOTHROW, since functions
@ -68,6 +75,10 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)
#define DECL_bdiv_dbm1c(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)
#define DECL_cnd_add_n(name) \
__GMP_DECLSPEC mp_limb_t name (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
#define DECL_cnd_sub_n(name) \
__GMP_DECLSPEC mp_limb_t name (mp_limb_t, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
#define DECL_com(name) \
__GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t)
#define DECL_copyd(name) \
@ -89,7 +100,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define DECL_mod_1(name) \
__GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t)
#define DECL_mod_1_1p(name) \
__GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [])
__GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [])
#define DECL_mod_1_1p_cps(name) \
__GMP_DECLSPEC void name (mp_limb_t cps[], mp_limb_t b)
#define DECL_mod_1s_2p(name) \
@ -208,10 +219,9 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* if not provided by gmp-mparam.h */
#ifndef BYTES_PER_MP_LIMB
#define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T
#ifndef GMP_LIMB_BYTES
#define GMP_LIMB_BYTES SIZEOF_MP_LIMB_T
#endif
#define GMP_LIMB_BYTES BYTES_PER_MP_LIMB
#ifndef GMP_LIMB_BITS
#define GMP_LIMB_BITS (8 * SIZEOF_MP_LIMB_T)
#endif
@ -366,8 +376,9 @@ __GMP_DECLSPEC void __gmp_tmp_reentrant_free (struct tmp_reentrant_t *);
#define TMP_MARK __tmp_marker = 0
#define TMP_SALLOC(n) alloca(n)
#define TMP_BALLOC(n) __gmp_tmp_reentrant_alloc (&__tmp_marker, n)
/* The peculiar stack allocation limit here is chosen for efficient asm. */
#define TMP_ALLOC(n) \
(LIKELY ((n) < 65536) ? TMP_SALLOC(n) : TMP_BALLOC(n))
(LIKELY ((n) <= 0x7f00) ? TMP_SALLOC(n) : TMP_BALLOC(n))
#define TMP_SFREE
#define TMP_FREE \
do { \
@ -418,7 +429,7 @@ struct tmp_debug_t {
};
struct tmp_debug_entry_t {
struct tmp_debug_entry_t *next;
char *block;
void *block;
size_t size;
};
__GMP_DECLSPEC void __gmp_tmp_debug_mark (const char *, int, struct tmp_debug_t **,
@ -481,7 +492,7 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
#define TMP_SALLOC_MP_PTRS(n) TMP_SALLOC_TYPE(n,mp_ptr)
#define TMP_BALLOC_MP_PTRS(n) TMP_BALLOC_TYPE(n,mp_ptr)
/* It's more efficient to allocate one block than two. This is certainly
/* It's more efficient to allocate one block than many. This is certainly
true of the malloc methods, but it can even be true of alloca if that
involves copying a chunk of stack (various RISCs), or a call to a stack
bounds check (mingw). In any case, when debugging keep separate blocks
@ -499,7 +510,21 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
(yp) = (xp) + (xsize); \
} \
} while (0)
#define TMP_ALLOC_LIMBS_3(xp,xsize, yp,ysize, zp,zsize) \
do { \
if (WANT_TMP_DEBUG) \
{ \
(xp) = TMP_ALLOC_LIMBS (xsize); \
(yp) = TMP_ALLOC_LIMBS (ysize); \
(zp) = TMP_ALLOC_LIMBS (zsize); \
} \
else \
{ \
(xp) = TMP_ALLOC_LIMBS ((xsize) + (ysize) + (zsize)); \
(yp) = (xp) + (xsize); \
(zp) = (yp) + (ysize); \
} \
} while (0)
/* From gmp.h, nicer names for internal use. */
#define CRAY_Pragma(str) __GMP_CRAY_Pragma(str)
@ -508,7 +533,8 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
#define UNLIKELY(cond) __GMP_UNLIKELY(cond)
#define ABS(x) ((x) >= 0 ? (x) : -(x))
#define ABS_CAST(T,x) ((x) >= 0 ? (T)(x) : -((T)((x) + 1) - 1))
#define NEG_CAST(T,x) (- (__GMP_CAST (T, (x) + 1) - 1))
#define ABS_CAST(T,x) ((x) >= 0 ? __GMP_CAST (T, x) : NEG_CAST (T,x))
#undef MIN
#define MIN(l,o) ((l) < (o) ? (l) : (o))
#undef MAX
@ -538,22 +564,6 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
((n) >= 0x100) + ((n) >= 0x200) + ((n) >= 0x400) + ((n) >= 0x800) + \
((n) >= 0x1000) + ((n) >= 0x2000) + ((n) >= 0x4000) + ((n) >= 0x8000))
/* The "short" defines are a bit different because shorts are promoted to
ints by ~ or >> etc.
#ifndef's are used since on some systems (HP?) header files other than
limits.h setup these defines. We could forcibly #undef in that case, but
there seems no need to worry about that. */
#ifndef ULONG_MAX
#define ULONG_MAX __GMP_ULONG_MAX
#endif
#ifndef UINT_MAX
#define UINT_MAX __GMP_UINT_MAX
#endif
#ifndef USHRT_MAX
#define USHRT_MAX __GMP_USHRT_MAX
#endif
#define MP_LIMB_T_MAX (~ (mp_limb_t) 0)
/* Must cast ULONG_MAX etc to unsigned long etc, since they might not be
@ -561,30 +571,9 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
treats the plain decimal values in <limits.h> as signed. */
#define ULONG_HIGHBIT (ULONG_MAX ^ ((unsigned long) ULONG_MAX >> 1))
#define UINT_HIGHBIT (UINT_MAX ^ ((unsigned) UINT_MAX >> 1))
#define USHRT_HIGHBIT ((unsigned short) (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1)))
#define USHRT_HIGHBIT (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1))
#define GMP_LIMB_HIGHBIT (MP_LIMB_T_MAX ^ (MP_LIMB_T_MAX >> 1))
#ifndef LONG_MIN
#define LONG_MIN ((long) ULONG_HIGHBIT)
#endif
#ifndef LONG_MAX
#define LONG_MAX (-(LONG_MIN+1))
#endif
#ifndef INT_MIN
#define INT_MIN ((int) UINT_HIGHBIT)
#endif
#ifndef INT_MAX
#define INT_MAX (-(INT_MIN+1))
#endif
#ifndef SHRT_MIN
#define SHRT_MIN ((short) USHRT_HIGHBIT)
#endif
#ifndef SHRT_MAX
#define SHRT_MAX ((short) (-(SHRT_MIN+1)))
#endif
#if __GMP_MP_SIZE_T_INT
#define MP_SIZE_T_MAX INT_MAX
#define MP_SIZE_T_MIN INT_MIN
@ -690,6 +679,19 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
(y) = __mpz_srcptr_swap__tmp; \
} while (0)
#define MPQ_PTR_SWAP(x, y) \
do { \
mpq_ptr __mpq_ptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mpq_ptr_swap__tmp; \
} while (0)
#define MPQ_SRCPTR_SWAP(x, y) \
do { \
mpq_srcptr __mpq_srcptr_swap__tmp = (x); \
(x) = (y); \
(y) = __mpq_srcptr_swap__tmp; \
} while (0)
/* Enhancement: __gmp_allocate_func could have "__attribute__ ((malloc))",
but current gcc (3.0) doesn't seem to support that. */
@ -1092,14 +1094,17 @@ __GMP_DECLSPEC void mpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
__GMP_DECLSPEC void mpn_mullo_basecase (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
#endif
#define mpn_sqr __MPN(sqr)
__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
#ifndef mpn_sqr_basecase /* if not done with cpuvec in a fat binary */
#define mpn_sqr_basecase __MPN(sqr_basecase)
__GMP_DECLSPEC void mpn_sqr_basecase (mp_ptr, mp_srcptr, mp_size_t);
#endif
#define mpn_sqrlo __MPN(sqrlo)
__GMP_DECLSPEC void mpn_sqrlo (mp_ptr, mp_srcptr, mp_size_t);
#define mpn_sqrlo_basecase __MPN(sqrlo_basecase)
__GMP_DECLSPEC void mpn_sqrlo_basecase (mp_ptr, mp_srcptr, mp_size_t);
#define mpn_mulmid_basecase __MPN(mulmid_basecase)
__GMP_DECLSPEC void mpn_mulmid_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
@ -1132,7 +1137,7 @@ __GMP_DECLSPEC void mpn_mod_1_1p_cps (mp_limb_t [4], mp_limb_t);
#endif
#ifndef mpn_mod_1_1p /* if not done with cpuvec in a fat binary */
#define mpn_mod_1_1p __MPN(mod_1_1p)
__GMP_DECLSPEC mp_limb_t mpn_mod_1_1p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4]) __GMP_ATTRIBUTE_PURE;
__GMP_DECLSPEC mp_limb_t mpn_mod_1_1p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [4]) __GMP_ATTRIBUTE_PURE;
#endif
#ifndef mpn_mod_1s_2p_cps /* if not done with cpuvec in a fat binary */
@ -1141,7 +1146,7 @@ __GMP_DECLSPEC void mpn_mod_1s_2p_cps (mp_limb_t [5], mp_limb_t);
#endif
#ifndef mpn_mod_1s_2p /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_2p __MPN(mod_1s_2p)
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [5]) __GMP_ATTRIBUTE_PURE;
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [5]) __GMP_ATTRIBUTE_PURE;
#endif
#ifndef mpn_mod_1s_3p_cps /* if not done with cpuvec in a fat binary */
@ -1150,7 +1155,7 @@ __GMP_DECLSPEC void mpn_mod_1s_3p_cps (mp_limb_t [6], mp_limb_t);
#endif
#ifndef mpn_mod_1s_3p /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_3p __MPN(mod_1s_3p)
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [6]) __GMP_ATTRIBUTE_PURE;
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [6]) __GMP_ATTRIBUTE_PURE;
#endif
#ifndef mpn_mod_1s_4p_cps /* if not done with cpuvec in a fat binary */
@ -1159,7 +1164,7 @@ __GMP_DECLSPEC void mpn_mod_1s_4p_cps (mp_limb_t [7], mp_limb_t);
#endif
#ifndef mpn_mod_1s_4p /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_4p __MPN(mod_1s_4p)
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [7]) __GMP_ATTRIBUTE_PURE;
__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p (mp_srcptr, mp_size_t, mp_limb_t, const mp_limb_t [7]) __GMP_ATTRIBUTE_PURE;
#endif
#define mpn_bc_mulmod_bnm1 __MPN(bc_mulmod_bnm1)
@ -1270,7 +1275,9 @@ __GMP_DECLSPEC extern gmp_randstate_t __gmp_rands;
#endif
#define BELOW_THRESHOLD(size,thresh) (! ABOVE_THRESHOLD (size, thresh))
#define MPN_TOOM22_MUL_MINSIZE 4
/* The minimal supported value for Toom22 depends also on Toom32 and
Toom42 implementations. */
#define MPN_TOOM22_MUL_MINSIZE 6
#define MPN_TOOM2_SQR_MINSIZE 4
#define MPN_TOOM33_MUL_MINSIZE 17
@ -1413,6 +1420,9 @@ __GMP_DECLSPEC void mpn_nussbaumer_mul (mp_ptr, mp_srcptr, mp_size_t, mp_sr
#define mpn_fft_next_size __MPN(fft_next_size)
__GMP_DECLSPEC mp_size_t mpn_fft_next_size (mp_size_t, int) ATTRIBUTE_CONST;
#define mpn_div_qr_1n_pi1 __MPN(div_qr_1n_pi1)
__GMP_DECLSPEC mp_limb_t mpn_div_qr_1n_pi1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
#define mpn_div_qr_2n_pi1 __MPN(div_qr_2n_pi1)
__GMP_DECLSPEC mp_limb_t mpn_div_qr_2n_pi1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, mp_limb_t);
@ -1444,19 +1454,19 @@ __GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_si
#define mpn_mu_div_qr __MPN(mu_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_mu_div_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_div_qr_itch __MPN(mu_div_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_itch (mp_size_t, mp_size_t, int);
__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
#define mpn_mu_div_qr_choose_in __MPN(mu_div_qr_choose_in)
__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_choose_in (mp_size_t, mp_size_t, int);
#define mpn_preinv_mu_div_qr __MPN(preinv_mu_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_div_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_preinv_mu_div_qr_itch __MPN(preinv_mu_div_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch (mp_size_t, mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_preinv_mu_div_qr_itch (mp_size_t, mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_mu_divappr_q __MPN(mu_divappr_q)
__GMP_DECLSPEC mp_limb_t mpn_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_divappr_q_itch __MPN(mu_divappr_q_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_itch (mp_size_t, mp_size_t, int);
__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
#define mpn_mu_divappr_q_choose_in __MPN(mu_divappr_q_choose_in)
__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_choose_in (mp_size_t, mp_size_t, int);
@ -1466,7 +1476,7 @@ __GMP_DECLSPEC mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t,
#define mpn_mu_div_q __MPN(mu_div_q)
__GMP_DECLSPEC mp_limb_t mpn_mu_div_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_div_q_itch __MPN(mu_div_q_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_div_q_itch (mp_size_t, mp_size_t, int);
__GMP_DECLSPEC mp_size_t mpn_mu_div_q_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
#define mpn_div_q __MPN(div_q)
__GMP_DECLSPEC void mpn_div_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
@ -1479,12 +1489,12 @@ __GMP_DECLSPEC void mpn_invert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
__GMP_DECLSPEC mp_limb_t mpn_ni_invertappr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_invertappr __MPN(invertappr)
__GMP_DECLSPEC mp_limb_t mpn_invertappr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_invertappr_itch(n) (3 * (n) + 2)
#define mpn_invertappr_itch(n) (2 * (n))
#define mpn_binvert __MPN(binvert)
__GMP_DECLSPEC void mpn_binvert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_binvert_itch __MPN(binvert_itch)
__GMP_DECLSPEC mp_size_t mpn_binvert_itch (mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_binvert_itch (mp_size_t) ATTRIBUTE_CONST;
#define mpn_bdiv_q_1 __MPN(bdiv_q_1)
__GMP_DECLSPEC mp_limb_t mpn_bdiv_q_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
@ -1501,42 +1511,42 @@ __GMP_DECLSPEC void mpn_sbpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr,
#define mpn_dcpi1_bdiv_qr __MPN(dcpi1_bdiv_qr)
__GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_dcpi1_bdiv_qr_n_itch __MPN(dcpi1_bdiv_qr_n_itch)
__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_qr_n_itch (mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_qr_n_itch (mp_size_t) ATTRIBUTE_CONST;
#define mpn_dcpi1_bdiv_qr_n __MPN(dcpi1_bdiv_qr_n)
__GMP_DECLSPEC mp_limb_t mpn_dcpi1_bdiv_qr_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_dcpi1_bdiv_q __MPN(dcpi1_bdiv_q)
__GMP_DECLSPEC void mpn_dcpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_dcpi1_bdiv_q_n_itch __MPN(dcpi1_bdiv_q_n_itch)
__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_q_n_itch (mp_size_t);
#define mpn_dcpi1_bdiv_q_n __MPN(dcpi1_bdiv_q_n)
__GMP_DECLSPEC void mpn_dcpi1_bdiv_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_dcpi1_bdiv_q_n_itch __MPN(dcpi1_bdiv_q_n_itch)
__GMP_DECLSPEC mp_size_t mpn_dcpi1_bdiv_q_n_itch (mp_size_t) ATTRIBUTE_CONST;
#define mpn_mu_bdiv_qr __MPN(mu_bdiv_qr)
__GMP_DECLSPEC mp_limb_t mpn_mu_bdiv_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_bdiv_qr_itch __MPN(mu_bdiv_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_qr_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_qr_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_mu_bdiv_q __MPN(mu_bdiv_q)
__GMP_DECLSPEC void mpn_mu_bdiv_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_mu_bdiv_q_itch __MPN(mu_bdiv_q_itch)
__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_q_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_mu_bdiv_q_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_bdiv_qr __MPN(bdiv_qr)
__GMP_DECLSPEC mp_limb_t mpn_bdiv_qr (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_bdiv_qr_itch __MPN(bdiv_qr_itch)
__GMP_DECLSPEC mp_size_t mpn_bdiv_qr_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_bdiv_qr_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_bdiv_q __MPN(bdiv_q)
__GMP_DECLSPEC void mpn_bdiv_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_bdiv_q_itch __MPN(bdiv_q_itch)
__GMP_DECLSPEC mp_size_t mpn_bdiv_q_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_bdiv_q_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_divexact __MPN(divexact)
__GMP_DECLSPEC void mpn_divexact (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
#define mpn_divexact_itch __MPN(divexact_itch)
__GMP_DECLSPEC mp_size_t mpn_divexact_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_divexact_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#ifndef mpn_bdiv_dbm1c /* if not done with cpuvec in a fat binary */
#define mpn_bdiv_dbm1c __MPN(bdiv_dbm1c)
@ -1550,25 +1560,53 @@ __GMP_DECLSPEC mp_limb_t mpn_bdiv_dbm1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t
__GMP_DECLSPEC void mpn_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_powlo __MPN(powlo)
__GMP_DECLSPEC void mpn_powlo (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
#define mpn_powm_sec __MPN(powm_sec)
__GMP_DECLSPEC void mpn_powm_sec (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_powm_sec_itch __MPN(powm_sec_itch)
__GMP_DECLSPEC mp_size_t mpn_powm_sec_itch (mp_size_t, mp_size_t, mp_size_t);
#define mpn_tabselect __MPN(tabselect)
__GMP_DECLSPEC void mpn_tabselect (volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t, mp_size_t, mp_size_t);
#define mpn_addcnd_n __MPN(addcnd_n)
__GMP_DECLSPEC mp_limb_t mpn_addcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_subcnd_n __MPN(subcnd_n)
__GMP_DECLSPEC mp_limb_t mpn_subcnd_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
#define mpn_sb_div_qr_sec __MPN(sb_div_qr_sec)
__GMP_DECLSPEC void mpn_sb_div_qr_sec (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sbpi1_div_qr_sec __MPN(sbpi1_div_qr_sec)
__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_qr_sec (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_sb_div_r_sec __MPN(sb_div_r_sec)
__GMP_DECLSPEC void mpn_sb_div_r_sec (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_sbpi1_div_r_sec __MPN(sbpi1_div_r_sec)
__GMP_DECLSPEC void mpn_sbpi1_div_r_sec (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_sec_pi1_div_qr __MPN(sec_pi1_div_qr)
__GMP_DECLSPEC mp_limb_t mpn_sec_pi1_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
#define mpn_sec_pi1_div_r __MPN(sec_pi1_div_r)
__GMP_DECLSPEC void mpn_sec_pi1_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
/* Override mpn_addlsh1_n, mpn_addlsh2_n, mpn_sublsh1_n, etc with mpn_addlsh_n,
etc when !HAVE_NATIVE the former but HAVE_NATIVE_ the latter. We then lie
and say these macros represent native functions, but leave a trace by using
the value 2 rather than 1. */
#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh1_n
#undef mpn_addlsh1_n
#define mpn_addlsh1_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,1)
#define HAVE_NATIVE_mpn_addlsh1_n 2
#endif
#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh2_n
#undef mpn_addlsh2_n
#define mpn_addlsh2_n(a,b,c,d) mpn_addlsh_n(a,b,c,d,2)
#define HAVE_NATIVE_mpn_addlsh2_n 2
#endif
#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh1_n
#undef mpn_sublsh1_n
#define mpn_sublsh1_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,1)
#define HAVE_NATIVE_mpn_sublsh1_n 2
#endif
#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh2_n
#undef mpn_sublsh2_n
#define mpn_sublsh2_n(a,b,c,d) mpn_sublsh_n(a,b,c,d,2)
#define HAVE_NATIVE_mpn_sublsh2_n 2
#endif
#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh1_n
#undef mpn_rsblsh1_n
#define mpn_rsblsh1_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,1)
#define HAVE_NATIVE_mpn_rsblsh1_n 2
#endif
#if HAVE_NATIVE_mpn_rsblsh_n && ! HAVE_NATIVE_mpn_rsblsh2_n
#undef mpn_rsblsh2_n
#define mpn_rsblsh2_n(a,b,c,d) mpn_rsblsh_n(a,b,c,d,2)
#define HAVE_NATIVE_mpn_rsblsh2_n 2
#endif
#ifndef DIVEXACT_BY3_METHOD
@ -1810,35 +1848,35 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
would be good when on a GNU system. */
#if HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc
#define MPN_FILL(dst, n, f) \
do { \
mp_ptr __dst = (dst) - 1; \
mp_size_t __n = (n); \
ASSERT (__n > 0); \
do \
*++__dst = (f); \
while (--__n); \
} while (0)
#endif
#ifndef MPN_FILL
#define MPN_FILL(dst, n, f) \
do { \
mp_ptr __dst = (dst); \
mp_size_t __n = (n); \
ASSERT (__n > 0); \
do \
*__dst++ = (f); \
while (--__n); \
} while (0)
#endif
#define MPN_ZERO(dst, n) \
do { \
ASSERT ((n) >= 0); \
if ((n) != 0) \
{ \
mp_ptr __dst = (dst) - 1; \
mp_size_t __n = (n); \
do \
*++__dst = 0; \
while (--__n); \
} \
MPN_FILL (dst, n, CNST_LIMB (0)); \
} while (0)
#endif
#ifndef MPN_ZERO
#define MPN_ZERO(dst, n) \
do { \
ASSERT ((n) >= 0); \
if ((n) != 0) \
{ \
mp_ptr __dst = (dst); \
mp_size_t __n = (n); \
do \
*__dst++ = 0; \
while (--__n); \
} \
} while (0)
#endif
/* On the x86s repe/scasl doesn't seem useful, since it takes many cycles to
start up and would need to strip a lot of zeros before it'd be faster
@ -2056,6 +2094,12 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
#ifndef MULLO_BASECASE_THRESHOLD_LIMIT
#define MULLO_BASECASE_THRESHOLD_LIMIT MULLO_BASECASE_THRESHOLD
#endif
#ifndef SQRLO_BASECASE_THRESHOLD_LIMIT
#define SQRLO_BASECASE_THRESHOLD_LIMIT SQRLO_BASECASE_THRESHOLD
#endif
#ifndef SQRLO_DC_THRESHOLD_LIMIT
#define SQRLO_DC_THRESHOLD_LIMIT SQRLO_DC_THRESHOLD
#endif
/* SQR_BASECASE_THRESHOLD is where mpn_sqr_basecase should take over from
mpn_mul_basecase. Default is to use mpn_sqr_basecase from 0. (Note that we
@ -2068,7 +2112,7 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
should be used, and that may be never. */
#ifndef SQR_BASECASE_THRESHOLD
#define SQR_BASECASE_THRESHOLD 0
#define SQR_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */
#endif
#ifndef SQR_TOOM2_THRESHOLD
@ -2092,8 +2136,32 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
#define MULMID_TOOM42_THRESHOLD MUL_TOOM22_THRESHOLD
#endif
#ifndef MULLO_BASECASE_THRESHOLD
#define MULLO_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */
#endif
#ifndef MULLO_DC_THRESHOLD
#define MULLO_DC_THRESHOLD (2*MUL_TOOM22_THRESHOLD)
#endif
#ifndef MULLO_MUL_N_THRESHOLD
#define MULLO_MUL_N_THRESHOLD (2*MUL_FFT_THRESHOLD)
#endif
#ifndef SQRLO_BASECASE_THRESHOLD
#define SQRLO_BASECASE_THRESHOLD 0 /* never use mpn_sqr_basecase */
#endif
#ifndef SQRLO_DC_THRESHOLD
#define SQRLO_DC_THRESHOLD (MULLO_DC_THRESHOLD)
#endif
#ifndef SQRLO_SQR_THRESHOLD
#define SQRLO_SQR_THRESHOLD (MULLO_MUL_N_THRESHOLD)
#endif
#ifndef DC_DIV_QR_THRESHOLD
#define DC_DIV_QR_THRESHOLD 50
#define DC_DIV_QR_THRESHOLD (2*MUL_TOOM22_THRESHOLD)
#endif
#ifndef DC_DIVAPPR_Q_THRESHOLD
@ -2101,7 +2169,7 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
#endif
#ifndef DC_BDIV_QR_THRESHOLD
#define DC_BDIV_QR_THRESHOLD 50
#define DC_BDIV_QR_THRESHOLD (2*MUL_TOOM22_THRESHOLD)
#endif
#ifndef DC_BDIV_Q_THRESHOLD
@ -2113,7 +2181,7 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
#endif
#ifndef INV_MULMOD_BNM1_THRESHOLD
#define INV_MULMOD_BNM1_THRESHOLD (5*MULMOD_BNM1_THRESHOLD)
#define INV_MULMOD_BNM1_THRESHOLD (4*MULMOD_BNM1_THRESHOLD)
#endif
#ifndef INV_APPR_THRESHOLD
@ -2229,8 +2297,8 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
struct fft_table_nk
{
unsigned int n:27;
unsigned int k:5;
gmp_uint_least32_t n:27;
gmp_uint_least32_t k:5;
};
#ifndef FFT_TABLE_ATTRS
@ -2300,11 +2368,7 @@ struct fft_table_nk
/* ASSERT() is a private assertion checking scheme, similar to <assert.h>.
ASSERT() does the check only if WANT_ASSERT is selected, ASSERT_ALWAYS()
does it always. Generally assertions are meant for development, but
might help when looking for a problem later too.
Note that strings shouldn't be used within the ASSERT expression,
eg. ASSERT(strcmp(s,"notgood")!=0), since the quotes upset the "expr"
used in the !HAVE_STRINGIZE case (ie. K&R). */
might help when looking for a problem later too. */
#ifdef __LINE__
#define ASSERT_LINE __LINE__
@ -2321,11 +2385,7 @@ struct fft_table_nk
__GMP_DECLSPEC void __gmp_assert_header (const char *, int);
__GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUTE_NORETURN;
#if HAVE_STRINGIZE
#define ASSERT_FAIL(expr) __gmp_assert_fail (ASSERT_FILE, ASSERT_LINE, #expr)
#else
#define ASSERT_FAIL(expr) __gmp_assert_fail (ASSERT_FILE, ASSERT_LINE, "expr")
#endif
#define ASSERT_ALWAYS(expr) \
do { \
@ -2533,7 +2593,7 @@ __GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUT
__GMP_DECLSPEC mp_limb_t mpn_trialdiv (mp_srcptr, mp_size_t, mp_size_t, int *);
#define mpn_remove __MPN(remove)
__GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_bitcnt_t);
__GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_bitcnt_t);
/* ADDC_LIMB sets w=x+y and cout to 0 or 1 for a carry from that addition. */
@ -2629,7 +2689,7 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, m
ASM_L(done) ":\n" \
: "=r" (__ptr_dummy) \
: "0" (ptr), \
"ri" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t)) \
"re" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t)) \
: "memory"); \
} \
} while (0)
@ -2781,8 +2841,8 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, m
struct bases
{
/* Number of digits in the conversion base that always fits in an mp_limb_t.
For example, for base 10 on a machine where a mp_limb_t has 32 bits this
is 9, since 10**9 is the largest number that fits into a mp_limb_t. */
For example, for base 10 on a machine where an mp_limb_t has 32 bits this
is 9, since 10**9 is the largest number that fits into an mp_limb_t. */
int chars_per_limb;
/* log(2)/log(conversion_base) */
@ -2985,7 +3045,7 @@ __GMP_DECLSPEC mp_limb_t mpn_invert_limb (mp_limb_t) ATTRIBUTE_CONST;
} while (0)
/* udiv_qrnnd_preinv -- Based on work by Niels Möller and Torbjörn Granlund.
/* udiv_qrnnd_preinv -- Based on work by Niels Möller and Torbjörn Granlund.
We write things strangely below, to help gcc. A more straightforward
version:
_r = (nl) - _qh * (d);
@ -3146,11 +3206,6 @@ __GMP_DECLSPEC mp_limb_t mpn_mod_34lsub1 (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_
#define BMOD_1_TO_MOD_1_THRESHOLD 10
#endif
#ifndef mpn_divexact_1 /* if not done with cpuvec in a fat binary */
#define mpn_divexact_1 __MPN(divexact_1)
__GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
#define MPN_DIVREM_OR_DIVEXACT_1(rp, up, n, d) \
do { \
if (BELOW_THRESHOLD (n, DIVEXACT_1_THRESHOLD)) \
@ -3452,7 +3507,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
mp_limb_t __bswapl_src = (src); \
mp_limb_t __dstl = 0; \
int __i; \
for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++) \
for (__i = 0; __i < GMP_LIMB_BYTES; __i++) \
{ \
__dstl = (__dstl << 8) | (__bswapl_src & 0xFF); \
__bswapl_src >>= 8; \
@ -4085,7 +4140,7 @@ __GMP_DECLSPEC void mpn_matrix22_mul (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_si
#define mpn_matrix22_mul_strassen __MPN(matrix22_mul_strassen)
__GMP_DECLSPEC void mpn_matrix22_mul_strassen (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
#define mpn_matrix22_mul_itch __MPN(matrix22_mul_itch)
__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#ifndef MATRIX22_STRASSEN_THRESHOLD
#define MATRIX22_STRASSEN_THRESHOLD 30
@ -4165,16 +4220,16 @@ __GMP_DECLSPEC mp_size_t mpn_hgcd_step (mp_size_t, mp_ptr, mp_ptr, mp_size_t, st
__GMP_DECLSPEC mp_size_t mpn_hgcd_reduce (struct hgcd_matrix *, mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_ptr);
#define mpn_hgcd_reduce_itch __MPN(hgcd_reduce_itch)
__GMP_DECLSPEC mp_size_t mpn_hgcd_reduce_itch (mp_size_t, mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_hgcd_reduce_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
#define mpn_hgcd_itch __MPN (hgcd_itch)
__GMP_DECLSPEC mp_size_t mpn_hgcd_itch (mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_hgcd_itch (mp_size_t) ATTRIBUTE_CONST;
#define mpn_hgcd __MPN (hgcd)
__GMP_DECLSPEC mp_size_t mpn_hgcd (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
#define mpn_hgcd_appr_itch __MPN (hgcd_appr_itch)
__GMP_DECLSPEC mp_size_t mpn_hgcd_appr_itch (mp_size_t);
__GMP_DECLSPEC mp_size_t mpn_hgcd_appr_itch (mp_size_t) ATTRIBUTE_CONST;
#define mpn_hgcd_appr __MPN (hgcd_appr)
__GMP_DECLSPEC int mpn_hgcd_appr (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
@ -4272,8 +4327,8 @@ __GMP_DECLSPEC extern mp_size_t __gmp_default_fp_limb_precision;
down. */
#define DIGITS_IN_BASE_PER_LIMB(res, nlimbs, b) \
do { \
mp_limb_t _ph, _pl; \
umul_ppmm (_ph, _pl, \
mp_limb_t _ph, _dummy; \
umul_ppmm (_ph, _dummy, \
mp_bases[b].logb2, GMP_NUMB_BITS * (mp_limb_t) (nlimbs));\
res = _ph; \
} while (0)
@ -4538,10 +4593,6 @@ __GMP_DECLSPEC int __gmp_doscan (const struct gmp_doscan_funs_t *, void *, const
} while (0)
#define MPZ_PROVOKE_REALLOC(z) \
do { ALLOC(z) = ABSIZ(z); } while (0)
/* Enhancement: The "mod" and "gcd_1" functions below could have
__GMP_ATTRIBUTE_PURE, but currently (gcc 3.3) that's not supported on
function pointers, only actual functions. It probably doesn't make much
@ -4550,7 +4601,8 @@ __GMP_DECLSPEC int __gmp_doscan (const struct gmp_doscan_funs_t *, void *, const
#if WANT_FAT_BINARY && (HAVE_HOST_CPU_FAMILY_x86 || HAVE_HOST_CPU_FAMILY_x86_64)
/* NOTE: The function pointers in this struct are also in CPUVEC_FUNCS_LIST
in mpn/x86/x86-defs.m4. Be sure to update that when changing here. */
in mpn/x86/x86-defs.m4 and mpn/x86_64/x86_64-defs.m4. Be sure to update
those when changing here. */
struct cpuvec_t {
DECL_add_n ((*add_n));
DECL_addlsh1_n ((*addlsh1_n));
@ -4558,6 +4610,8 @@ struct cpuvec_t {
DECL_addmul_1 ((*addmul_1));
DECL_addmul_2 ((*addmul_2));
DECL_bdiv_dbm1c ((*bdiv_dbm1c));
DECL_cnd_add_n ((*cnd_add_n));
DECL_cnd_sub_n ((*cnd_sub_n));
DECL_com ((*com));
DECL_copyd ((*copyd));
DECL_copyi ((*copyi));
@ -4635,18 +4689,6 @@ mpn_sub_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t ci)
}
#endif
static inline int
mpn_zero_p (mp_srcptr ap, mp_size_t n)
{
mp_size_t i;
for (i = n - 1; i >= 0; i--)
{
if (ap[i] != 0)
return 0;
}
return 1;
}
#if TUNE_PROGRAM_BUILD
/* Some extras wanted when recompiling some .c files for use by the tune
program. Not part of a normal build.
@ -4769,6 +4811,18 @@ extern mp_size_t mullo_dc_threshold;
#define MULLO_MUL_N_THRESHOLD mullo_mul_n_threshold
extern mp_size_t mullo_mul_n_threshold;
#undef SQRLO_BASECASE_THRESHOLD
#define SQRLO_BASECASE_THRESHOLD sqrlo_basecase_threshold
extern mp_size_t sqrlo_basecase_threshold;
#undef SQRLO_DC_THRESHOLD
#define SQRLO_DC_THRESHOLD sqrlo_dc_threshold
extern mp_size_t sqrlo_dc_threshold;
#undef SQRLO_SQR_THRESHOLD
#define SQRLO_SQR_THRESHOLD sqrlo_sqr_threshold
extern mp_size_t sqrlo_sqr_threshold;
#undef MULMID_TOOM42_THRESHOLD
#define MULMID_TOOM42_THRESHOLD mulmid_toom42_threshold
extern mp_size_t mulmid_toom42_threshold;
@ -4865,6 +4919,18 @@ extern mp_size_t gcd_dc_threshold;
#define GCDEXT_DC_THRESHOLD gcdext_dc_threshold
extern mp_size_t gcdext_dc_threshold;
#undef DIV_QR_1N_PI1_METHOD
#define DIV_QR_1N_PI1_METHOD div_qr_1n_pi1_method
extern int div_qr_1n_pi1_method;
#undef DIV_QR_1_NORM_THRESHOLD
#define DIV_QR_1_NORM_THRESHOLD div_qr_1_norm_threshold
extern mp_size_t div_qr_1_norm_threshold;
#undef DIV_QR_1_UNNORM_THRESHOLD
#define DIV_QR_1_UNNORM_THRESHOLD div_qr_1_unnorm_threshold
extern mp_size_t div_qr_1_unnorm_threshold;
#undef DIVREM_1_NORM_THRESHOLD
#define DIVREM_1_NORM_THRESHOLD divrem_1_norm_threshold
extern mp_size_t divrem_1_norm_threshold;
@ -4953,6 +5019,8 @@ extern struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE];
#undef MUL_TOOM22_THRESHOLD_LIMIT
#undef MUL_TOOM33_THRESHOLD_LIMIT
#undef MULLO_BASECASE_THRESHOLD_LIMIT
#undef SQRLO_BASECASE_THRESHOLD_LIMIT
#undef SQRLO_DC_THRESHOLD_LIMIT
#undef SQR_TOOM3_THRESHOLD_LIMIT
#define SQR_TOOM2_MAX_GENERIC 200
#define MUL_TOOM22_THRESHOLD_LIMIT 700
@ -4965,6 +5033,8 @@ extern struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE];
#define MUL_TOOM8H_THRESHOLD_LIMIT 1200
#define SQR_TOOM8_THRESHOLD_LIMIT 1200
#define MULLO_BASECASE_THRESHOLD_LIMIT 200
#define SQRLO_BASECASE_THRESHOLD_LIMIT 200
#define SQRLO_DC_THRESHOLD_LIMIT 400
#define GET_STR_THRESHOLD_LIMIT 150
#define FAC_DSC_THRESHOLD_LIMIT 2048

View File

@ -1,20 +1,33 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
2004, 2005, 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2016 Free Software
Foundation, Inc.
This file 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.
This file is part of the GNU MP Library.
This file 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.
The GNU MP Library is free software; you can redistribute it and/or modify
it under the terms of either:
You should have received a copy of the GNU Lesser General Public License
along with this file. If not, see http://www.gnu.org/licenses/. */
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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 General Public License
for more details.
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
/* You have to define the following before including this file:
@ -139,30 +152,30 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
or want. */
#ifdef _LONG_LONG_LIMB
#define count_leading_zeros_gcc_clz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_clzll (x); \
#define count_leading_zeros_gcc_clz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_clzll (x); \
} while (0)
#else
#define count_leading_zeros_gcc_clz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_clzl (x); \
#define count_leading_zeros_gcc_clz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_clzl (x); \
} while (0)
#endif
#ifdef _LONG_LONG_LIMB
#define count_trailing_zeros_gcc_ctz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_ctzll (x); \
#define count_trailing_zeros_gcc_ctz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_ctzll (x); \
} while (0)
#else
#define count_trailing_zeros_gcc_ctz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_ctzl (x); \
#define count_trailing_zeros_gcc_ctz(count,x) \
do { \
ASSERT ((x) != 0); \
(count) = __builtin_ctzl (x); \
} while (0)
#endif
@ -187,7 +200,7 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
UDItype __m0 = (m0), __m1 = (m1); \
__asm__ ("umulh %r1,%2,%0" \
: "=r" (ph) \
: "%rJ" (m0), "rI" (m1)); \
: "%rJ" (__m0), "rI" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
#endif
@ -197,7 +210,7 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
(ph) = __UMULH (m0, m1); \
(ph) = __UMULH (__m0, __m1); \
(pl) = __m0 * __m1; \
} while (0)
#endif
@ -223,27 +236,27 @@ along with this file. If not, see http://www.gnu.org/licenses/. */
__asm__("cttz %1,%0" : "=r"(COUNT) : "r"(X))
#endif /* clz/ctz using cix */
#if ! defined (count_leading_zeros) \
#if ! defined (count_leading_zeros) \
&& defined (__GNUC__) && ! defined (LONGLONG_STANDALONE)
/* ALPHA_CMPBGE_0 gives "cmpbge $31,src,dst", ie. test src bytes == 0.
"$31" is written explicitly in the asm, since an "r" constraint won't
select reg 31. There seems no need to worry about "r31" syntax for cray,
since gcc itself (pre-release 3.4) emits just $31 in various places. */
#define ALPHA_CMPBGE_0(dst, src) \
since gcc itself (pre-release 3.4) emits just $31 in various places. */
#define ALPHA_CMPBGE_0(dst, src) \
do { asm ("cmpbge $31, %1, %0" : "=r" (dst) : "r" (src)); } while (0)
/* Zero bytes are turned into bits with cmpbge, a __clz_tab lookup counts
them, locating the highest non-zero byte. A second __clz_tab lookup
counts the leading zero bits in that byte, giving the result. */
#define count_leading_zeros(count, x) \
do { \
UWtype __clz__b, __clz__c, __clz__x = (x); \
ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \
__clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \
__clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \
__clz__x >>= __clz__b; \
__clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \
__clz__b = 65 - __clz__b; \
(count) = __clz__b - __clz__c; \
#define count_leading_zeros(count, x) \
do { \
UWtype __clz__b, __clz__c, __clz__x = (x); \
ALPHA_CMPBGE_0 (__clz__b, __clz__x); /* zero bytes */ \
__clz__b = __clz_tab [(__clz__b >> 1) ^ 0x7F]; /* 8 to 1 byte */ \
__clz__b = __clz__b * 8 - 7; /* 57 to 1 shift */ \
__clz__x >>= __clz__b; \
__clz__c = __clz_tab [__clz__x]; /* 8 to 1 bit */ \
__clz__b = 65 - __clz__b; \
(count) = __clz__b - __clz__c; \
} while (0)
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
#endif /* clz using cmpbge */
@ -280,7 +293,7 @@ long __MPN(count_leading_zeros) (UDItype);
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
(ph) = _int_mult_upper (m0, m1); \
(ph) = _int_mult_upper (__m0, __m1); \
(pl) = __m0 * __m1; \
} while (0)
#ifndef LONGLONG_STANDALONE
@ -299,14 +312,14 @@ long __MPN(count_leading_zeros) (UDItype);
code using "al<bl" arithmetically comes out making an actual 0 or 1 in a
register, which takes an extra cycle. */
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
UWtype __x; \
__x = (al) - (bl); \
if ((al) < (bl)) \
(sh) = (ah) - (bh) - 1; \
else \
(sh) = (ah) - (bh); \
(sl) = __x; \
do { \
UWtype __x; \
__x = (al) - (bl); \
if ((al) < (bl)) \
(sh) = (ah) - (bh) - 1; \
else \
(sh) = (ah) - (bh); \
(sl) = __x; \
} while (0)
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER)
/* Do both product parts in assembly, since that gives better code with
@ -345,9 +358,9 @@ long __MPN(count_leading_zeros) (UDItype);
#include <ia64intrin.h>
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UWtype _m0 = (m0), _m1 = (m1); \
ph = _m64_xmahu (_m0, _m1, 0); \
pl = _m0 * _m1; \
UWtype __m0 = (m0), __m1 = (m1); \
ph = _m64_xmahu (__m0, __m1, 0); \
pl = __m0 * __m1; \
} while (0)
#endif
#ifndef LONGLONG_STANDALONE
@ -411,20 +424,21 @@ long __MPN(count_leading_zeros) (UDItype);
: "=r" (sh), \
"=&r" (sl) \
: "r" ((USItype) (ah)), \
"rIJ" ((USItype) (bh)), \
"rICal" ((USItype) (bh)), \
"%r" ((USItype) (al)), \
"rIJ" ((USItype) (bl)))
"rICal" ((USItype) (bl)))
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("sub.f\t%1, %4, %5\n\tsbc\t%0, %2, %3" \
: "=r" (sh), \
"=&r" (sl) \
: "r" ((USItype) (ah)), \
"rIJ" ((USItype) (bh)), \
"rICal" ((USItype) (bh)), \
"r" ((USItype) (al)), \
"rIJ" ((USItype) (bl)))
"rICal" ((USItype) (bl)))
#endif
#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32
#if defined (__arm__) && (defined (__thumb2__) || !defined (__thumb__)) \
&& W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
@ -469,7 +483,39 @@ long __MPN(count_leading_zeros) (UDItype);
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "rI" (bh), "r" (al), "rI" (bl) __CLOBBER_CC);\
} while (0)
#if 1 || defined (__arm_m__) /* `M' series has widening multiply support */
#if defined (__ARM_ARCH_2__) || defined (__ARM_ARCH_2A__) \
|| defined (__ARM_ARCH_3__)
#define umul_ppmm(xh, xl, a, b) \
do { \
register USItype __t0, __t1, __t2; \
__asm__ ("%@ Inlined umul_ppmm\n" \
" mov %2, %5, lsr #16\n" \
" mov %0, %6, lsr #16\n" \
" bic %3, %5, %2, lsl #16\n" \
" bic %4, %6, %0, lsl #16\n" \
" mul %1, %3, %4\n" \
" mul %4, %2, %4\n" \
" mul %3, %0, %3\n" \
" mul %0, %2, %0\n" \
" adds %3, %4, %3\n" \
" addcs %0, %0, #65536\n" \
" adds %1, %1, %3, lsl #16\n" \
" adc %0, %0, %3, lsr #16" \
: "=&r" ((USItype) (xh)), "=r" ((USItype) (xl)), \
"=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
: "r" ((USItype) (a)), "r" ((USItype) (b)) __CLOBBER_CC); \
} while (0)
#define UMUL_TIME 20
#ifndef LONGLONG_STANDALONE
#define udiv_qrnnd(q, r, n1, n0, d) \
do { UWtype __r; \
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define UDIV_TIME 200
#endif /* LONGLONG_STANDALONE */
#else /* ARMv4 or newer */
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("umull %0,%1,%2,%3" : "=&r" (xl), "=&r" (xh) : "r" (a), "r" (b))
#define UMUL_TIME 5
@ -485,48 +531,10 @@ long __MPN(count_leading_zeros) (UDItype);
#define UDIV_NEEDS_NORMALIZATION 1
#define UDIV_TIME 70
#endif /* LONGLONG_STANDALONE */
#else
#define umul_ppmm(xh, xl, a, b) \
__asm__ ("%@ Inlined umul_ppmm\n" \
" mov %|r0, %2, lsr #16\n" \
" mov %|r2, %3, lsr #16\n" \
" bic %|r1, %2, %|r0, lsl #16\n" \
" bic %|r2, %3, %|r2, lsl #16\n" \
" mul %1, %|r1, %|r2\n" \
" mul %|r2, %|r0, %|r2\n" \
" mul %|r1, %0, %|r1\n" \
" mul %0, %|r0, %0\n" \
" adds %|r1, %|r2, %|r1\n" \
" addcs %0, %0, #65536\n" \
" adds %1, %1, %|r1, lsl #16\n" \
" adc %0, %0, %|r1, lsr #16" \
: "=&r" (xh), "=r" (xl) \
: "r" (a), "r" (b) \
: "r0", "r1", "r2")
#define UMUL_TIME 20
#ifndef LONGLONG_STANDALONE
#define udiv_qrnnd(q, r, n1, n0, d) \
do { UWtype __r; \
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define UDIV_TIME 200
#endif /* LONGLONG_STANDALONE */
#endif
/* This is a bizarre test, but GCC doesn't define useful common symbol. */
#if defined (__ARM_ARCH_5__) || defined (__ARM_ARCH_5T__) || \
defined (__ARM_ARCH_5E__) || defined (__ARM_ARCH_5TE__)|| \
defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) || \
defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) || \
defined (__ARM_ARCH_6ZK__)|| defined (__ARM_ARCH_6T2__)|| \
defined (__ARM_ARCH_6M__) || defined (__ARM_ARCH_7__) || \
defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) || \
defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
#define count_leading_zeros(count, x) \
__asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
#endif /* defined(__ARM_ARCH_2__) ... */
#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x)
#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x)
#define COUNT_LEADING_ZEROS_0 32
#endif
#endif /* __arm__ */
#if defined (__aarch64__) && W_TYPE_SIZE == 64
@ -535,19 +543,21 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
: "=r" (sh), "=&r" (sl) \
: "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
: "rZ" ((UDItype)(ah)), "rZ" ((UDItype)(bh)), \
"%r" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
: "=r,r" (sh), "=&r,&r" (sl) \
: "rZ,rZ" (ah), "rZ,rZ" (bh), "r,Z" (al), "rI,r" (bl) __CLOBBER_CC)
: "rZ,rZ" ((UDItype)(ah)), "rZ,rZ" ((UDItype)(bh)), \
"r,Z" ((UDItype)(al)), "rI,r" ((UDItype)(bl)) __CLOBBER_CC)
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
__asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (m0), "r" (m1)); \
__asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (__m0), "r" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
#define count_leading_zeros(count, x) \
__asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
#define count_leading_zeros(count, x) count_leading_zeros_gcc_clz(count, x)
#define count_trailing_zeros(count, x) count_trailing_zeros_gcc_ctz(count, x)
#define COUNT_LEADING_ZEROS_0 64
#endif /* __aarch64__ */
@ -852,6 +862,8 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif
#endif
/* On x86 and x86_64, every asm implicitly clobbers "flags" and "fpsr",
so we don't need __CLOBBER_CC. */
#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addl %5,%k1\n\tadcl %3,%k0" \
@ -946,7 +958,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
being 1 code byte smaller. "31-__cbtmp" is a workaround, probably at the
cost of one extra instruction. Do this for "i386" too, since that means
generic x86. */
#if ! defined (count_leading_zeros) && __GNUC__ < 3 \
#if ! defined (count_leading_zeros) && __GNUC__ < 3 \
&& (HAVE_HOST_CPU_i386 \
|| HAVE_HOST_CPU_i686 \
|| HAVE_HOST_CPU_pentiumpro \
@ -1027,7 +1039,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
ASSERT ((x) != 0); \
__asm__ ("bsfq %1,%q0" : "=r" (count) : "rm" ((UDItype)(x))); \
} while (0)
#endif /* x86_64 */
#endif /* __amd64__ */
#if defined (__i860__) && W_TYPE_SIZE == 32
#define rshift_rhlc(r,h,l,c) \
@ -1156,7 +1168,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
|| defined (__mc68030__) || defined (mc68030) \
|| defined (__mc68040__) || defined (mc68040) \
|| defined (__mc68060__) || defined (mc68060) \
|| defined (__NeXT__)) \
|| defined (__NeXT__)) \
&& ! defined (__mcpu32__)
#define count_leading_zeros(count, x) \
__asm__ ("bfffo %1{%b2:%b2},%0" \
@ -1217,7 +1229,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
w0 = __ll; \
} while (0)
#endif
#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) && !defined (__clang__)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
#endif
@ -1240,14 +1252,17 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
w0 = __ll; \
} while (0)
#endif
#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7)
#if !defined (umul_ppmm) && __GMP_GNUC_PREREQ (2,7) && !defined (__clang__)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
__asm__ ("dmultu %2,%3" \
: "=l" (w0), "=h" (w1) \
: "d" ((UDItype)(u)), "d" ((UDItype)(v)))
#endif
#if !defined (umul_ppmm)
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("dmultu %2,%3\n\tmflo %0\n\tmfhi %1" \
: "=d" (w0), "=d" (w1) : "d" (u), "d" (v))
: "=d" (w0), "=d" (w1) \
: "d" ((UDItype)(u)), "d" ((UDItype)(v)))
#endif
#define UMUL_TIME 20
#define UDIV_TIME 140
@ -1309,37 +1324,37 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
the system vendor compilers. (Is that vendor compilers with inline asm,
or what?) */
#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc) \
#if (HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc) \
&& W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl)); \
else \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
} while (0)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (ah) && (ah) == ~(USItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
else if (__builtin_constant_p (bh) && (bh) == ~(USItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl));\
else \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
} while (0)
@ -1392,55 +1407,78 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
__asm__ ("add%I4c %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "%r" (al), "rI" (bl));\
__asm__ ("add%I4c %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
else \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "%r" (al), "rI" (bl)); \
__asm__ ("add%I5c %1,%4,%5\n\tadde %0,%2,%3" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
"%r" ((UDItype)(al)), "rI" ((UDItype)(bl))); \
} while (0)
/* We use "*rI" for the constant operand here, since with just "I", gcc barfs.
This might seem strange, but gcc folds away the dead code late. */
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
do { \
if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "*rI" (-bl)); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("addic %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "*rI" (-bl)); \
else \
__asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl)); \
} else { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
else \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
} \
do { \
if (__builtin_constant_p (bl) && bl > -0x8000 && bl <= 0x8000) { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("addic %1,%3,%4\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("addic %1,%3,%4\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("addic %1,%3,%4\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
else \
__asm__ ("addic %1,%4,%5\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "*rI" (-((UDItype)(bl)))); \
} else { \
if (__builtin_constant_p (ah) && (ah) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\tsubfme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
else if (__builtin_constant_p (bh) && (bh) == 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddme %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
__asm__ ("subf%I3c %1,%4,%3\n\taddze %0,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), \
"rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
else \
__asm__ ("subf%I4c %1,%5,%4\n\tsubfe %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
"rI" ((UDItype)(al)), "r" ((UDItype)(bl))); \
} \
} while (0)
#endif /* ! _LONG_LONG_LIMB */
#define count_leading_zeros(count, x) \
@ -1459,7 +1497,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
__asm__ ("mulhdu %0,%1,%2" : "=r" (ph) : "%r" (__m0), "r" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
#endif
@ -1467,7 +1505,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#define smul_ppmm(ph, pl, m0, m1) \
do { \
DItype __m0 = (m0), __m1 = (m1); \
__asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (m0), "r" (m1)); \
__asm__ ("mulhd %0,%1,%2" : "=r" (ph) : "%r" (__m0), "r" (__m1)); \
(pl) = __m0 * __m1; \
} while (0)
#define SMUL_TIME 14 /* ??? */
@ -1744,19 +1782,43 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
"addcc %r4,%5,%1\n" \
" addccc %r6,%7,%%g0\n" \
" addc %r2,%3,%0" \
: "=r" (sh), "=&r" (sl) \
: "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl), \
"%rJ" ((al) >> 32), "rI" ((bl) >> 32) \
: "=r" (sh), "=&r" (sl) \
: "rJ" ((UDItype)(ah)), "rI" ((UDItype)(bh)), \
"%rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)), \
"%rJ" ((UDItype)(al) >> 32), "rI" ((UDItype)(bl) >> 32) \
__CLOBBER_CC)
#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
__asm__ ( \
"subcc %r4,%5,%1\n" \
" subccc %r6,%7,%%g0\n" \
" subc %r2,%3,%0" \
: "=r" (sh), "=&r" (sl) \
: "rJ" (ah), "rI" (bh), "rJ" (al), "rI" (bl), \
"rJ" ((al) >> 32), "rI" ((bl) >> 32) \
: "=r" (sh), "=&r" (sl) \
: "rJ" ((UDItype)(ah)), "rI" ((UDItype)(bh)), \
"rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)), \
"rJ" ((UDItype)(al) >> 32), "rI" ((UDItype)(bl) >> 32) \
__CLOBBER_CC)
#if __VIS__ >= 0x300
#undef add_ssaaaa
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ( \
"addcc %r4, %5, %1\n" \
" addxc %r2, %r3, %0" \
: "=r" (sh), "=&r" (sl) \
: "rJ" ((UDItype)(ah)), "rJ" ((UDItype)(bh)), \
"%rJ" ((UDItype)(al)), "rI" ((UDItype)(bl)) __CLOBBER_CC)
#define umul_ppmm(ph, pl, m0, m1) \
do { \
UDItype __m0 = (m0), __m1 = (m1); \
(pl) = __m0 * __m1; \
__asm__ ("umulxhi\t%2, %1, %0" \
: "=r" (ph) \
: "%r" (__m0), "r" (__m1)); \
} while (0)
#define count_leading_zeros(count, x) \
__asm__ ("lzd\t%1,%0" : "=r" (count) : "r" (x))
/* Needed by count_leading_zeros_32 in sparc64.h. */
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
#endif
#endif
#if (defined (__vax) || defined (__vax__)) && W_TYPE_SIZE == 32
@ -1835,11 +1897,11 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
/* FIXME: "sidi" here is highly doubtful, should sometimes be "diti". */
#if !defined (umul_ppmm) && defined (__umulsidi3)
#define umul_ppmm(ph, pl, m0, m1) \
{ \
do { \
UDWtype __ll = __umulsidi3 (m0, m1); \
ph = (UWtype) (__ll >> W_TYPE_SIZE); \
pl = (UWtype) __ll; \
}
} while (0)
#endif
#if !defined (__umulsidi3)
@ -1850,62 +1912,68 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif
#if defined (__cplusplus)
#define __longlong_h_C "C"
#else
#define __longlong_h_C
#endif
/* Use mpn_umul_ppmm or mpn_udiv_qrnnd functions, if they exist. The "_r"
forms have "reversed" arguments, meaning the pointer is last, which
sometimes allows better parameter passing, in particular on 64-bit
hppa. */
#define mpn_umul_ppmm __MPN(umul_ppmm)
extern UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
extern __longlong_h_C UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm \
&& ! defined (LONGLONG_STANDALONE)
#define umul_ppmm(wh, wl, u, v) \
do { \
UWtype __umul_ppmm__p0; \
(wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v)); \
(wl) = __umul_ppmm__p0; \
#define umul_ppmm(wh, wl, u, v) \
do { \
UWtype __umul_ppmm__p0; \
(wh) = mpn_umul_ppmm (&__umul_ppmm__p0, (UWtype) (u), (UWtype) (v));\
(wl) = __umul_ppmm__p0; \
} while (0)
#endif
#define mpn_umul_ppmm_r __MPN(umul_ppmm_r)
extern UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
extern __longlong_h_C UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
#if ! defined (umul_ppmm) && HAVE_NATIVE_mpn_umul_ppmm_r \
&& ! defined (LONGLONG_STANDALONE)
#define umul_ppmm(wh, wl, u, v) \
do { \
UWtype __umul_ppmm__p0; \
(wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_ppmm__p0); \
(wl) = __umul_ppmm__p0; \
#define umul_ppmm(wh, wl, u, v) \
do { \
UWtype __umul_p0; \
(wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_p0); \
(wl) = __umul_p0; \
} while (0)
#endif
#define mpn_udiv_qrnnd __MPN(udiv_qrnnd)
extern UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
extern __longlong_h_C UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd \
&& ! defined (LONGLONG_STANDALONE)
#define udiv_qrnnd(q, r, n1, n0, d) \
do { \
UWtype __udiv_qrnnd__r; \
(q) = mpn_udiv_qrnnd (&__udiv_qrnnd__r, \
UWtype __udiv_qrnnd_r; \
(q) = mpn_udiv_qrnnd (&__udiv_qrnnd_r, \
(UWtype) (n1), (UWtype) (n0), (UWtype) d); \
(r) = __udiv_qrnnd__r; \
(r) = __udiv_qrnnd_r; \
} while (0)
#endif
#define mpn_udiv_qrnnd_r __MPN(udiv_qrnnd_r)
extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
extern __longlong_h_C UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r \
&& ! defined (LONGLONG_STANDALONE)
#define udiv_qrnnd(q, r, n1, n0, d) \
do { \
UWtype __udiv_qrnnd__r; \
UWtype __udiv_qrnnd_r; \
(q) = mpn_udiv_qrnnd_r ((UWtype) (n1), (UWtype) (n0), (UWtype) d, \
&__udiv_qrnnd__r); \
(r) = __udiv_qrnnd__r; \
&__udiv_qrnnd_r); \
(r) = __udiv_qrnnd_r; \
} while (0)
#endif
@ -1927,7 +1995,7 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
do { \
UWtype __x; \
__x = (al) - (bl); \
(sh) = (ah) - (bh) - ((al) < (bl)); \
(sh) = (ah) - (bh) - ((al) < (bl)); \
(sl) = __x; \
} while (0)
#endif
@ -2038,7 +2106,8 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
/* If the processor has no udiv_qrnnd but sdiv_qrnnd, go through
__udiv_w_sdiv (defined in libgcc or elsewhere). */
#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd)
#if !defined (udiv_qrnnd) && defined (sdiv_qrnnd) \
&& ! defined (LONGLONG_STANDALONE)
#define udiv_qrnnd(q, r, nh, nl, d) \
do { \
UWtype __r; \

View File

@ -1,9 +1,8 @@
# Makefile.in generated by automake 1.11.6 from Makefile.am.
# Makefile.in generated by automake 1.15 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.
# Copyright (C) 1994-2014 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,60 +14,118 @@
@SET_MAKE@
# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005, 2011 Free Software
# Foundation, Inc.
# Copyright 1996, 1998-2002, 2005, 2011, 2013 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
# This file is part of the GNU MP Library.
#
# 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 is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# 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.
# * 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.
#
# 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/.
# or
#
# * the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# or both in parallel, as here.
#
# 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 General Public License
# for more details.
#
# You should have received copies of the GNU General Public License and the
# GNU Lesser General Public License along with the GNU MP Library. If not,
# see https://www.gnu.org/licenses/.
# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
# Inc.
# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
#
# This file is part of the GNU MP Library.
# This file is part of the GNU MP Library.
#
# 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 is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# 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.
# * 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.
#
# 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/.
# or
#
# * the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any
# later version.
#
# or both in parallel, as here.
#
# 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 General Public License
# for more details.
#
# You should have received copies of the GNU General Public License and the
# GNU Lesser General Public License along with the GNU MP Library. If not,
# see https://www.gnu.org/licenses/.
VPATH = @srcdir@
am__make_dryrun = \
{ \
am__dry=no; \
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
false; \
elif test -n '$(MAKE_HOST)'; then \
true; \
elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \
true; \
else \
false; \
fi; \
}
am__make_running_with_option = \
case $${target_option-} in \
?) ;; \
*) echo "am__make_running_with_option: internal error: invalid" \
"target option '$${target_option-}' specified" >&2; \
exit 1;; \
esac; \
has_opt=no; \
sane_makeflags=$$MAKEFLAGS; \
if $(am__is_gnu_make); then \
sane_makeflags=$$MFLAGS; \
else \
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;; \
bs=\\; \
sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
| sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
esac; \
test $$am__dry = yes; \
}
fi; \
skip_next=no; \
strip_trailopt () \
{ \
flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
}; \
for flg in $$sane_makeflags; do \
test $$skip_next = yes && { skip_next=no; continue; }; \
case $$flg in \
*=*|--*) continue;; \
-*I) strip_trailopt 'I'; skip_next=yes;; \
-*I?*) strip_trailopt 'I';; \
-*O) strip_trailopt 'O'; skip_next=yes;; \
-*O?*) strip_trailopt 'O';; \
-*l) strip_trailopt 'l'; skip_next=yes;; \
-*l?*) strip_trailopt 'l';; \
-[dEDm]) skip_next=yes;; \
-[JT]) skip_next=yes;; \
esac; \
case $$flg in \
*$$target_option*) has_opt=yes; break;; \
esac; \
done; \
test $$has_opt = yes
am__make_dryrun = (target_option=n; $(am__make_running_with_option))
am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@ -87,14 +144,13 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
DIST_COMMON = README $(srcdir)/Makeasm.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
subdir = mpn
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
$(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
@ -103,18 +159,43 @@ LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
nodist_libmpn_la_OBJECTS = fib_table.lo mp_bases.lo
libmpn_la_OBJECTS = $(nodist_libmpn_la_OBJECTS)
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
am__v_lt_1 =
AM_V_P = $(am__v_P_@AM_V@)
am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
am__v_P_0 = false
am__v_P_1 = :
AM_V_GEN = $(am__v_GEN_@AM_V@)
am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
am__v_GEN_0 = @echo " GEN " $@;
am__v_GEN_1 =
AM_V_at = $(am__v_at_@AM_V@)
am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
am__v_at_0 = @
am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -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) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
$(AM_CFLAGS) $(CFLAGS)
AM_V_CC = $(am__v_CC_@AM_V@)
am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
am__v_CC_0 = @echo " CC " $@;
am__v_CC_1 =
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(AM_LDFLAGS) $(LDFLAGS) -o $@
AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(nodist_libmpn_la_SOURCES)
DIST_SOURCES =
am__can_run_installinfo = \
@ -122,12 +203,31 @@ am__can_run_installinfo = \
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is
# *not* preserved.
am__uniquify_input = $(AWK) '\
BEGIN { nonempty = 0; } \
{ items[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in items) print i; }; } \
'
# Make sure the list of sources is unique. This is necessary because,
# e.g., the same source file might be shared among _SOURCES variables
# for different programs/libraries.
am__define_uniq_tagged_files = \
list='$(am__tagged_files)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
am__DIST_COMMON = $(srcdir)/Makeasm.am $(srcdir)/Makefile.in README
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
AR = @AR@
AS = @AS@
ASMFLAGS = @ASMFLAGS@
@ -197,6 +297,7 @@ LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@
M4 = @M4@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
@ -284,7 +385,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
AM_CPPFLAGS = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
-DOPERATION_`echo $* | sed 's/_$$//'`
OFILES = @mpn_objects@
@ -292,9 +393,9 @@ noinst_LTLIBRARIES = libmpn.la
nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c
libmpn_la_LIBADD = $(OFILES)
libmpn_la_DEPENDENCIES = $(OFILES)
TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \
minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr \
s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64 z8000
TARG_DIST = alpha arm arm64 cray generic ia64 lisp m68k m88k \
minithres mips32 mips64 pa32 pa64 power powerpc32 powerpc64 \
s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64
EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
@ -342,7 +443,6 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Ma
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --gnu --ignore-deps mpn/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
@ -351,7 +451,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
$(srcdir)/Makeasm.am:
$(srcdir)/Makeasm.am $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@ -364,14 +464,17 @@ $(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
test "$$dir" != "$$p" || dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
@list='$(noinst_LTLIBRARIES)'; \
locs=`for p in $$list; do echo $$p; done | \
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
sort -u`; \
test -z "$$locs" || { \
echo rm -f $${locs}; \
rm -f $${locs}; \
}
libmpn.la: $(libmpn_la_OBJECTS) $(libmpn_la_DEPENDENCIES) $(EXTRA_libmpn_la_DEPENDENCIES)
$(LINK) $(libmpn_la_OBJECTS) $(libmpn_la_LIBADD) $(LIBS)
$(AM_V_CCLD)$(LINK) $(libmpn_la_OBJECTS) $(libmpn_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@ -380,13 +483,13 @@ distclean-compile:
-rm -f *.tab.c
.c.o:
$(COMPILE) -c $<
$(AM_V_CC)$(COMPILE) -c -o $@ $<
.c.obj:
$(COMPILE) -c `$(CYGPATH_W) '$<'`
$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
.c.lo:
$(LTCOMPILE) -c -o $@ $<
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $<
mostlyclean-libtool:
-rm -f *.lo
@ -394,26 +497,15 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
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; }; }'`; \
mkid -fID $$unique
tags: TAGS
ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique
tags: tags-am
TAGS: tags
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
set x; \
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; }; }'`; \
$(am__define_uniq_tagged_files); \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
@ -425,15 +517,11 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
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; }; }'`; \
ctags: ctags-am
CTAGS: ctags
ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
$(am__define_uniq_tagged_files); \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$unique
@ -442,6 +530,21 @@ GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
cscopelist: cscopelist-am
cscopelist-am: $(am__tagged_files)
list='$(am__tagged_files)'; \
case "$(srcdir)" in \
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
*) sdir=$(subdir)/$(srcdir) ;; \
esac; \
for i in $$list; do \
if test -f "$$i"; then \
echo "$(subdir)/$$i"; \
else \
echo "$$sdir/$$i"; \
fi; \
done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -581,18 +684,21 @@ uninstall-am:
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES 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 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
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \
ctags-am 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 \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am
.PRECIOUS: Makefile
# These are BUILT_SOURCES at the top-level, so normally they're built before

View File

@ -1,118 +0,0 @@
; 29000 mpn_add_n -- Add two limb vectors of the same length > 0 and store
; sum in a third limb vector.
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; s2_ptr lr4
; size lr5
; We use the loadm/storem instructions and operate on chunks of 8
; limbs/per iteration, until less than 8 limbs remain.
; The 29k has no addition or subtraction instructions that doesn't
; affect carry, so we need to save and restore that as soon as we
; adjust the pointers. gr116 is used for this purpose. Note that
; gr116==0 means that carry should be set.
.sect .lit,lit
.text
.align 4
.global ___gmpn_add_n
.word 0x60000
___gmpn_add_n:
srl gr117,lr5,3
sub gr118,gr117,1
jmpt gr118,Ltail
constn gr116,-1 ; init cy reg
sub gr117,gr117,2 ; count for jmpfdec
; Main loop working 8 limbs/iteration.
Loop: mtsrim cr,(8-1)
loadm 0,0,gr96,lr3
add lr3,lr3,32
mtsrim cr,(8-1)
loadm 0,0,gr104,lr4
add lr4,lr4,32
subr gr116,gr116,0 ; restore carry
addc gr96,gr96,gr104
addc gr97,gr97,gr105
addc gr98,gr98,gr106
addc gr99,gr99,gr107
addc gr100,gr100,gr108
addc gr101,gr101,gr109
addc gr102,gr102,gr110
addc gr103,gr103,gr111
subc gr116,gr116,gr116 ; gr116 = not(cy)
mtsrim cr,(8-1)
storem 0,0,gr96,lr2
jmpfdec gr117,Loop
add lr2,lr2,32
; Code for the last up-to-7 limbs.
; This code might look very strange, but it's hard to write it
; differently without major slowdown.
and lr5,lr5,(8-1)
Ltail: sub gr118,lr5,1 ; count for CR
jmpt gr118,Lend
sub gr117,lr5,2 ; count for jmpfdec
mtsr cr,gr118
loadm 0,0,gr96,lr3
mtsr cr,gr118
loadm 0,0,gr104,lr4
subr gr116,gr116,0 ; restore carry
jmpfdec gr117,L1
addc gr96,gr96,gr104
jmp Lstore
mtsr cr,gr118
L1: jmpfdec gr117,L2
addc gr97,gr97,gr105
jmp Lstore
mtsr cr,gr118
L2: jmpfdec gr117,L3
addc gr98,gr98,gr106
jmp Lstore
mtsr cr,gr118
L3: jmpfdec gr117,L4
addc gr99,gr99,gr107
jmp Lstore
mtsr cr,gr118
L4: jmpfdec gr117,L5
addc gr100,gr100,gr108
jmp Lstore
mtsr cr,gr118
L5: jmpfdec gr117,L6
addc gr101,gr101,gr109
jmp Lstore
mtsr cr,gr118
L6: addc gr102,gr102,gr110
Lstore: storem 0,0,gr96,lr2
subc gr116,gr116,gr116 ; gr116 = not(cy)
Lend: jmpi lr0
add gr96,gr116,1

View File

@ -1,111 +0,0 @@
; 29000 __gmpn_addmul_1 -- Multiply a limb vector with a single limb and
; add the product to a second limb vector.
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; size lr4
; s2_limb lr5
.cputype 29050
.sect .lit,lit
.text
.align 4
.global ___gmpn_addmul_1
.word 0x60000
___gmpn_addmul_1:
sub lr4,lr4,8
jmpt lr4,Ltail
const gr120,0 ; init cylimb reg
srl gr117,lr4,3 ; divide by 8
sub gr117,gr117,1 ; count for jmpfdec
Loop: mtsrim cr,(8-1)
loadm 0,0,gr96,lr3
add lr3,lr3,32
multiplu gr104,gr96,lr5
multmu gr96,gr96,lr5
multiplu gr105,gr97,lr5
multmu gr97,gr97,lr5
multiplu gr106,gr98,lr5
multmu gr98,gr98,lr5
multiplu gr107,gr99,lr5
multmu gr99,gr99,lr5
multiplu gr108,gr100,lr5
multmu gr100,gr100,lr5
multiplu gr109,gr101,lr5
multmu gr101,gr101,lr5
multiplu gr110,gr102,lr5
multmu gr102,gr102,lr5
multiplu gr111,gr103,lr5
multmu gr103,gr103,lr5
add gr104,gr104,gr120
addc gr105,gr105,gr96
addc gr106,gr106,gr97
addc gr107,gr107,gr98
addc gr108,gr108,gr99
addc gr109,gr109,gr100
addc gr110,gr110,gr101
addc gr111,gr111,gr102
addc gr120,gr103,0
mtsrim cr,(8-1)
loadm 0,0,gr96,lr2
add gr104,gr96,gr104
addc gr105,gr97,gr105
addc gr106,gr98,gr106
addc gr107,gr99,gr107
addc gr108,gr100,gr108
addc gr109,gr101,gr109
addc gr110,gr102,gr110
addc gr111,gr103,gr111
addc gr120,gr120,0
mtsrim cr,(8-1)
storem 0,0,gr104,lr2
jmpfdec gr117,Loop
add lr2,lr2,32
Ltail: and lr4,lr4,(8-1)
sub gr118,lr4,1 ; count for CR
jmpt gr118,Lend
sub lr4,lr4,2
sub lr2,lr2,4 ; offset res_ptr by one limb
Loop2: load 0,0,gr116,lr3
add lr3,lr3,4
multiplu gr117,gr116,lr5
multmu gr118,gr116,lr5
add lr2,lr2,4
load 0,0,gr119,lr2
add gr117,gr117,gr120
addc gr118,gr118,0
add gr117,gr117,gr119
store 0,0,gr117,lr2
jmpfdec lr4,Loop2
addc gr120,gr118,0
Lend: jmpi lr0
or gr96,gr120,0 ; copy

View File

@ -1,91 +0,0 @@
; 29000 __gmpn_lshift --
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; s2_ptr lr4
; size lr5
; We use the loadm/storem instructions and operate on chunks of 8
; limbs/per iteration, until less than 8 limbs remain.
.sect .lit,lit
.text
.align 4
.global ___gmpn_lshift
.word 0x60000
___gmpn_lshift:
sll gr116,lr4,2
add lr3,gr116,lr3
add lr2,gr116,lr2
sub lr3,lr3,4
load 0,0,gr119,lr3
subr gr116,lr5,32
srl gr96,gr119,gr116 ; return value
sub lr4,lr4,1 ; actual loop count is SIZE - 1
srl gr117,lr4,3 ; chuck count = (actual count) / 8
cpeq gr118,gr117,0
jmpt gr118,Ltail
mtsr fc,lr5
sub gr117,gr117,2 ; count for jmpfdec
; Main loop working 8 limbs/iteration.
Loop: sub lr3,lr3,32
mtsrim cr,(8-1)
loadm 0,0,gr100,lr3
extract gr109,gr119,gr107
extract gr108,gr107,gr106
extract gr107,gr106,gr105
extract gr106,gr105,gr104
extract gr105,gr104,gr103
extract gr104,gr103,gr102
extract gr103,gr102,gr101
extract gr102,gr101,gr100
sub lr2,lr2,32
mtsrim cr,(8-1)
storem 0,0,gr102,lr2
jmpfdec gr117,Loop
or gr119,gr100,0
; Code for the last up-to-7 limbs.
and lr4,lr4,(8-1)
Ltail: cpeq gr118,lr4,0
jmpt gr118,Lend
sub lr4,lr4,2 ; count for jmpfdec
Loop2: sub lr3,lr3,4
load 0,0,gr116,lr3
extract gr117,gr119,gr116
sub lr2,lr2,4
store 0,0,gr117,lr2
jmpfdec lr4,Loop2
or gr119,gr116,0
Lend: extract gr117,gr119,0
sub lr2,lr2,4
jmpi lr0
store 0,0,gr117,lr2

View File

@ -1,95 +0,0 @@
; 29000 __gmpn_mul_1 -- Multiply a limb vector with a single limb and
; store the product in a second limb vector.
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; size lr4
; s2_limb lr5
.cputype 29050
.sect .lit,lit
.text
.align 4
.global ___gmpn_mul_1
.word 0x60000
___gmpn_mul_1:
sub lr4,lr4,8
jmpt lr4,Ltail
const gr120,0 ; init cylimb reg
srl gr117,lr4,3 ; divide by 8
sub gr117,gr117,1 ; count for jmpfdec
Loop: mtsrim cr,(8-1)
loadm 0,0,gr96,lr3
add lr3,lr3,32
multiplu gr104,gr96,lr5
multmu gr96,gr96,lr5
multiplu gr105,gr97,lr5
multmu gr97,gr97,lr5
multiplu gr106,gr98,lr5
multmu gr98,gr98,lr5
multiplu gr107,gr99,lr5
multmu gr99,gr99,lr5
multiplu gr108,gr100,lr5
multmu gr100,gr100,lr5
multiplu gr109,gr101,lr5
multmu gr101,gr101,lr5
multiplu gr110,gr102,lr5
multmu gr102,gr102,lr5
multiplu gr111,gr103,lr5
multmu gr103,gr103,lr5
add gr104,gr104,gr120
addc gr105,gr105,gr96
addc gr106,gr106,gr97
addc gr107,gr107,gr98
addc gr108,gr108,gr99
addc gr109,gr109,gr100
addc gr110,gr110,gr101
addc gr111,gr111,gr102
addc gr120,gr103,0
mtsrim cr,(8-1)
storem 0,0,gr104,lr2
jmpfdec gr117,Loop
add lr2,lr2,32
Ltail: and lr4,lr4,(8-1)
sub gr118,lr4,1 ; count for CR
jmpt gr118,Lend
sub lr4,lr4,2
sub lr2,lr2,4 ; offset res_ptr by one limb
Loop2: load 0,0,gr116,lr3
add lr3,lr3,4
multiplu gr117,gr116,lr5
multmu gr118,gr116,lr5
add lr2,lr2,4
add gr117,gr117,gr120
store 0,0,gr117,lr2
jmpfdec lr4,Loop2
addc gr120,gr118,0
Lend: jmpi lr0
or gr96,gr120,0 ; copy

View File

@ -1,87 +0,0 @@
; 29000 __gmpn_rshift --
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; s2_ptr lr4
; size lr5
; We use the loadm/storem instructions and operate on chunks of 8
; limbs/per iteration, until less than 8 limbs remain.
.sect .lit,lit
.text
.align 4
.global ___gmpn_rshift
.word 0x60000
___gmpn_rshift:
load 0,0,gr119,lr3
add lr3,lr3,4
subr gr116,lr5,32
sll gr96,gr119,gr116 ; return value
sub lr4,lr4,1 ; actual loop count is SIZE - 1
srl gr117,lr4,3 ; chuck count = (actual count) / 8
cpeq gr118,gr117,0
jmpt gr118,Ltail
mtsr fc,gr116
sub gr117,gr117,2 ; count for jmpfdec
; Main loop working 8 limbs/iteration.
Loop: mtsrim cr,(8-1)
loadm 0,0,gr100,lr3
add lr3,lr3,32
extract gr98,gr100,gr119
extract gr99,gr101,gr100
extract gr100,gr102,gr101
extract gr101,gr103,gr102
extract gr102,gr104,gr103
extract gr103,gr105,gr104
extract gr104,gr106,gr105
extract gr105,gr107,gr106
mtsrim cr,(8-1)
storem 0,0,gr98,lr2
add lr2,lr2,32
jmpfdec gr117,Loop
or gr119,gr107,0
; Code for the last up-to-7 limbs.
and lr4,lr4,(8-1)
Ltail: cpeq gr118,lr4,0
jmpt gr118,Lend
sub lr4,lr4,2 ; count for jmpfdec
Loop2: load 0,0,gr100,lr3
add lr3,lr3,4
extract gr117,gr100,gr119
store 0,0,gr117,lr2
add lr2,lr2,4
jmpfdec lr4,Loop2
or gr119,gr100,0
Lend: srl gr117,gr119,lr5
jmpi lr0
store 0,0,gr117,lr2

View File

@ -1,118 +0,0 @@
; 29000 mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
; store difference in a third limb vector.
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; s2_ptr lr4
; size lr5
; We use the loadm/storem instructions and operate on chunks of 8
; limbs/per iteration, until less than 8 limbs remain.
; The 29k has no addition or subtraction instructions that doesn't
; affect carry, so we need to save and restore that as soon as we
; adjust the pointers. gr116 is used for this purpose. Note that
; gr116==0 means that carry should be set.
.sect .lit,lit
.text
.align 4
.global ___gmpn_sub_n
.word 0x60000
___gmpn_sub_n:
srl gr117,lr5,3
sub gr118,gr117,1
jmpt gr118,Ltail
constn gr116,-1 ; init cy reg
sub gr117,gr117,2 ; count for jmpfdec
; Main loop working 8 limbs/iteration.
Loop: mtsrim cr,(8-1)
loadm 0,0,gr96,lr3
add lr3,lr3,32
mtsrim cr,(8-1)
loadm 0,0,gr104,lr4
add lr4,lr4,32
subr gr116,gr116,0 ; restore carry
subc gr96,gr96,gr104
subc gr97,gr97,gr105
subc gr98,gr98,gr106
subc gr99,gr99,gr107
subc gr100,gr100,gr108
subc gr101,gr101,gr109
subc gr102,gr102,gr110
subc gr103,gr103,gr111
subc gr116,gr116,gr116 ; gr116 = not(cy)
mtsrim cr,(8-1)
storem 0,0,gr96,lr2
jmpfdec gr117,Loop
add lr2,lr2,32
; Code for the last up-to-7 limbs.
; This code might look very strange, but it's hard to write it
; differently without major slowdown.
and lr5,lr5,(8-1)
Ltail: sub gr118,lr5,1 ; count for CR
jmpt gr118,Lend
sub gr117,lr5,2 ; count for jmpfdec
mtsr cr,gr118
loadm 0,0,gr96,lr3
mtsr cr,gr118
loadm 0,0,gr104,lr4
subr gr116,gr116,0 ; restore carry
jmpfdec gr117,L1
subc gr96,gr96,gr104
jmp Lstore
mtsr cr,gr118
L1: jmpfdec gr117,L2
subc gr97,gr97,gr105
jmp Lstore
mtsr cr,gr118
L2: jmpfdec gr117,L3
subc gr98,gr98,gr106
jmp Lstore
mtsr cr,gr118
L3: jmpfdec gr117,L4
subc gr99,gr99,gr107
jmp Lstore
mtsr cr,gr118
L4: jmpfdec gr117,L5
subc gr100,gr100,gr108
jmp Lstore
mtsr cr,gr118
L5: jmpfdec gr117,L6
subc gr101,gr101,gr109
jmp Lstore
mtsr cr,gr118
L6: subc gr102,gr102,gr110
Lstore: storem 0,0,gr96,lr2
subc gr116,gr116,gr116 ; gr116 = not(cy)
Lend: jmpi lr0
add gr96,gr116,1

View File

@ -1,114 +0,0 @@
; 29000 __gmpn_submul_1 -- Multiply a limb vector with a single limb and
; subtract the product from a second limb vector.
; Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
; INPUT PARAMETERS
; res_ptr lr2
; s1_ptr lr3
; size lr4
; s2_limb lr5
.cputype 29050
.sect .lit,lit
.text
.align 4
.global ___gmpn_submul_1
.word 0x60000
___gmpn_submul_1:
sub lr4,lr4,8
jmpt lr4,Ltail
const gr120,0 ; init cylimb reg
srl gr117,lr4,3 ; divide by 8
sub gr117,gr117,1 ; count for jmpfdec
Loop: mtsrim cr,(8-1)
loadm 0,0,gr96,lr3
add lr3,lr3,32
multiplu gr104,gr96,lr5
multmu gr96,gr96,lr5
multiplu gr105,gr97,lr5
multmu gr97,gr97,lr5
multiplu gr106,gr98,lr5
multmu gr98,gr98,lr5
multiplu gr107,gr99,lr5
multmu gr99,gr99,lr5
multiplu gr108,gr100,lr5
multmu gr100,gr100,lr5
multiplu gr109,gr101,lr5
multmu gr101,gr101,lr5
multiplu gr110,gr102,lr5
multmu gr102,gr102,lr5
multiplu gr111,gr103,lr5
multmu gr103,gr103,lr5
add gr104,gr104,gr120
addc gr105,gr105,gr96
addc gr106,gr106,gr97
addc gr107,gr107,gr98
addc gr108,gr108,gr99
addc gr109,gr109,gr100
addc gr110,gr110,gr101
addc gr111,gr111,gr102
addc gr120,gr103,0
mtsrim cr,(8-1)
loadm 0,0,gr96,lr2
sub gr96,gr96,gr104
subc gr97,gr97,gr105
subc gr98,gr98,gr106
subc gr99,gr99,gr107
subc gr100,gr100,gr108
subc gr101,gr101,gr109
subc gr102,gr102,gr110
subc gr103,gr103,gr111
add gr104,gr103,gr111 ; invert carry from previous sub
addc gr120,gr120,0
mtsrim cr,(8-1)
storem 0,0,gr96,lr2
jmpfdec gr117,Loop
add lr2,lr2,32
Ltail: and lr4,lr4,(8-1)
sub gr118,lr4,1 ; count for CR
jmpt gr118,Lend
sub lr4,lr4,2
sub lr2,lr2,4 ; offset res_ptr by one limb
Loop2: load 0,0,gr116,lr3
add lr3,lr3,4
multiplu gr117,gr116,lr5
multmu gr118,gr116,lr5
add lr2,lr2,4
load 0,0,gr119,lr2
add gr117,gr117,gr120
addc gr118,gr118,0
sub gr119,gr119,gr117
add gr104,gr119,gr117 ; invert carry from previous sub
store 0,0,gr119,lr2
jmpfdec lr4,Loop2
addc gr120,gr118,0
Lend: jmpi lr0
or gr96,gr120,0 ; copy

View File

@ -1,28 +0,0 @@
; Copyright 1999, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.sect .lit,lit
.text
.align 4
.global ___udiv_qrnnd
.word 0x60000
___udiv_qrnnd:
mtsr q,lr3
dividu gr96,lr4,lr5
mfsr gr116,q
jmpi lr0
store 0,0,gr116,lr2

View File

@ -1,27 +0,0 @@
; Copyright 1999, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.sect .lit,lit
.text
.align 4
.global ___umul_ppmm
.word 0x50000
___umul_ppmm:
multiplu gr116,lr3,lr4
multmu gr96,lr3,lr4
jmpi lr0
store 0,0,gr116,lr2

View File

@ -1,115 +0,0 @@
dnl Alpha mpn_sqr_diagonal.
dnl Copyright 2001, 2002, 2006 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C EV4: ?
C EV5: ?
C EV6: 2.3
C INPUT PARAMETERS
C rp r16
C up r17
C n r18
ASM_START()
PROLOGUE(mpn_sqr_diagonal)
lda r18, -2(r18) C n -= 2
ldq r0, 0(r17)
mulq r0, r0, r4
umulh r0, r0, r20
blt r18, L(ex1)
ldq r1, 8(r17)
mulq r1, r1, r5
umulh r1, r1, r21
beq r18, L(ex2)
lda r18, -2(r18) C n -= 2
ldq r0, 16(r17)
blt r18, L(ex3)
ldq r1, 24(r17)
beq r18, L(ex4)
ALIGN(16)
L(top): lda r18, -2(r18) C n -= 2
stq r4, 0(r16)
mulq r0, r0, r4
stq r20, 8(r16)
umulh r0, r0, r20
ldq r0, 32(r17)
blt r18, L(x)
stq r5, 16(r16)
mulq r1, r1, r5
stq r21, 24(r16)
umulh r1, r1, r21
ldq r1, 40(r17)
lda r16, 32(r16) C rp += 4
lda r17, 16(r17) C up += 2
bne r18, L(top)
ALIGN(16)
L(ex4): stq r4, 0(r16)
mulq r0, r0, r4
stq r20, 8(r16)
umulh r0, r0, r20
stq r5, 16(r16)
mulq r1, r1, r5
stq r21, 24(r16)
umulh r1, r1, r21
stq r4, 32(r16)
stq r20, 40(r16)
stq r5, 48(r16)
stq r21, 56(r16)
ret r31, (r26), 1
ALIGN(16)
L(x): stq r5, 16(r16)
mulq r1, r1, r5
stq r21, 24(r16)
umulh r1, r1, r21
stq r4, 32(r16)
mulq r0, r0, r4
stq r20, 40(r16)
umulh r0, r0, r20
stq r5, 48(r16)
stq r21, 56(r16)
stq r4, 64(r16)
stq r20, 72(r16)
ret r31, (r26), 1
L(ex1): stq r4, 0(r16)
stq r20, 8(r16)
ret r31, (r26), 1
ALIGN(16)
L(ex2): stq r4, 0(r16)
stq r20, 8(r16)
stq r5, 16(r16)
stq r21, 24(r16)
ret r31, (r26), 1
ALIGN(16)
L(ex3): stq r4, 0(r16)
mulq r0, r0, r4
stq r20, 8(r16)
umulh r0, r0, r20
stq r5, 16(r16)
stq r21, 24(r16)
stq r4, 32(r16)
stq r20, 40(r16)
ret r31, (r26), 1
EPILOGUE()
ASM_END()

View File

@ -1,65 +0,0 @@
dnl Alpha mpn_sqr_diagonal.
dnl Copyright 2001, 2002 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C EV4: 42
C EV5: 18
C EV6: 3.45
C INPUT PARAMETERS
C rp r16
C up r17
C n r18
ASM_START()
PROLOGUE(mpn_sqr_diagonal)
ldq r2,0(r17) C r2 = s1_limb
lda r18,-2(r18) C size -= 2
mulq r2,r2,r3 C r3 = prod_low
umulh r2,r2,r4 C r4 = prod_high
blt r18,$Lend1 C jump if size was == 1
ldq r2,8(r17) C r2 = s1_limb
beq r18,$Lend2 C jump if size was == 2
ALIGN(8)
$Loop: stq r3,0(r16)
mulq r2,r2,r3 C r3 = prod_low
lda r18,-1(r18) C size--
stq r4,8(r16)
umulh r2,r2,r4 C r4 = cy_limb
ldq r2,16(r17) C r2 = s1_limb
lda r17,8(r17) C s1_ptr++
lda r16,16(r16) C res_ptr++
bne r18,$Loop
$Lend2: stq r3,0(r16)
mulq r2,r2,r3 C r3 = prod_low
stq r4,8(r16)
umulh r2,r2,r4 C r4 = cy_limb
stq r3,16(r16)
stq r4,24(r16)
ret r31,(r26),1
$Lend1: stq r3,0(r16)
stq r4,8(r16)
ret r31,(r26),1
EPILOGUE(mpn_sqr_diagonal)
ASM_END()

View File

@ -1,124 +0,0 @@
dnl ARM mpn_addcnd_n, mpn_subcnd_n
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A8 ?
C Cortex-A9 2.5 slightly fluctuating
C Cortex-A15 ?
define(`rp', `r0')
define(`up', `r1')
define(`vp', `r2')
define(`n', `r3')
define(`cnd', `r12')
ifdef(`OPERATION_addcnd_n', `
define(`ADDSUB', adds)
define(`ADDSUBC', adcs)
define(`INITCY', `cmn r0, #0')
define(`RETVAL', `adc r0, n, #0')
define(func, mpn_addcnd_n)')
ifdef(`OPERATION_subcnd_n', `
define(`ADDSUB', subs)
define(`ADDSUBC', sbcs)
define(`INITCY', `cmp r0, #0')
define(`RETVAL', `adc r0, n, #0
rsb r0, r0, #1')
define(func, mpn_subcnd_n)')
MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
ASM_START()
PROLOGUE(func)
push {r4-r11}
ldr cnd, [sp, #32]
INITCY C really only needed for n = 0 (mod 4)
teq cnd, #0 C could use this for clearing/setting cy
mvnne cnd, #0 C conditionally set to 0xffffffff
ands r4, n, #3
beq L(top)
cmp r4, #2
bcc L(b1)
beq L(b2)
L(b3): ldm vp!, {r4,r5,r6}
ldm up!, {r8,r9,r10}
and r4, r4, cnd
and r5, r5, cnd
and r6, r6, cnd
ADDSUB r8, r8, r4
ADDSUBC r9, r9, r5
ADDSUBC r10, r10, r6
stm rp!, {r8,r9,r10}
sub n, n, #3
teq n, #0
bne L(top)
b L(end)
L(b2): ldm vp!, {r4,r5}
ldm up!, {r8,r9}
and r4, r4, cnd
and r5, r5, cnd
ADDSUB r8, r8, r4
ADDSUBC r9, r9, r5
stm rp!, {r8,r9}
sub n, n, #2
teq n, #0
bne L(top)
b L(end)
L(b1): ldr r4, [vp], #4
ldr r8, [up], #4
and r4, r4, cnd
ADDSUB r8, r8, r4
str r8, [rp], #4
sub n, n, #1
teq n, #0
beq L(end)
L(top): ldm vp!, {r4,r5,r6,r7}
ldm up!, {r8,r9,r10,r11}
and r4, r4, cnd
and r5, r5, cnd
and r6, r6, cnd
and r7, r7, cnd
ADDSUBC r8, r8, r4
ADDSUBC r9, r9, r5
ADDSUBC r10, r10, r6
ADDSUBC r11, r11, r7
sub n, n, #4
stm rp!, {r8,r9,r10,r11}
teq n, #0
bne L(top)
L(end): RETVAL
pop {r4-r11}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
EPILOGUE()

View File

@ -1,23 +1,34 @@
dnl ARM mpn_addlsh1_n and mpn_sublsh1_n
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
@ -25,6 +36,7 @@ C addlsh1_n sublsh1_n
C cycles/limb cycles/limb
C StrongARM ? ?
C XScale ? ?
C Cortex-A7 ? ?
C Cortex-A8 ? ?
C Cortex-A9 3.12 3.7
C Cortex-A15 ? ?
@ -151,8 +163,5 @@ L(rt1): mov r14, r12
REVCY(r12)
L(rt0): RETVAL( r14)
pop {r4-r10r11, r14}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -3,25 +3,37 @@ dnl ARM mpn_bdiv_dbm1c.
dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 4.25
C Cortex-A15 2.5
@ -97,8 +109,5 @@ L(wd1): subs r5, r5, r8
str r5, [qp]
sbc r0, r5, r12
pop {r4, r5, r6, r7, r8}
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
ret lr
EPILOGUE()

View File

@ -3,28 +3,40 @@ dnl ARM mpn_com.
dnl Copyright 2003, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 2.0
C Cortex-A15 ?
C Cortex-A15 1.75
define(`rp', `r0')
define(`up', `r1')
@ -59,9 +71,5 @@ L(top): ldmia up!, { r3, r8, r9, r12 } C load 4 limbs
bne L(top)
ldmfd sp!, { r7, r8, r9 } C restore regs from stack
L(rtn):
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
L(rtn): ret lr
EPILOGUE()

View File

@ -1,30 +1,48 @@
dnl ARM mpn_copyd.
dnl Copyright 2003, 2012 Free Software Foundation, Inc.
dnl Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
dnl Copyright 2003, 2012, 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 1.5
C Cortex-A15 ?
C Cortex-A9 1.25-1.5
C Cortex-A15 1.25
C TODO
C * Consider wider unrolling. Analogous 8-way code runs 10% faster on both A9
C and A15. But it probably slows things down for 8 <= n < a few dozen.
define(`rp', `r0')
define(`up', `r1')
@ -34,8 +52,8 @@ ASM_START()
PROLOGUE(mpn_copyd)
mov r12, n, lsl #2
sub r12, r12, #4
add rp, rp, r12 C make rp point at last limb
add up, up, r12 C make up point at last limb
add rp, rp, r12
add up, up, r12
tst n, #1
beq L(skip1)
@ -44,22 +62,23 @@ PROLOGUE(mpn_copyd)
L(skip1):
tst n, #2
beq L(skip2)
ldmda up!, { r3, r12 } C load 2 limbs
stmda rp!, { r3, r12 } C store 2 limbs
ldmda up!, { r3,r12 }
stmda rp!, { r3,r12 }
L(skip2):
bics n, n, #3
beq L(rtn)
stmfd sp!, { r7, r8, r9 } C save regs on stack
L(top): ldmda up!, { r3, r8, r9, r12 } C load 4 limbs
push { r4-r5 }
subs n, n, #4
stmda rp!, { r3, r8, r9, r12 } C store 4 limbs
ldmda up!, { r3,r4,r5,r12 }
beq L(end)
L(top): subs n, n, #4
stmda rp!, { r3,r4,r5,r12 }
ldmda up!, { r3,r4,r5,r12 }
bne L(top)
ldmfd sp!, { r7, r8, r9 } C restore regs from stack
L(rtn):
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
L(end): stmda rp, { r3,r4,r5,r12 }
pop { r4-r5 }
L(rtn): ret lr
EPILOGUE()

View File

@ -1,30 +1,48 @@
dnl ARM mpn_copyi.
dnl Copyright 2003, 2012 Free Software Foundation, Inc.
dnl Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
dnl Copyright 2003, 2012, 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 1.5
C Cortex-A15 ?
C Cortex-A9 1.25-1.5
C Cortex-A15 1.25
C TODO
C * Consider wider unrolling. Analogous 8-way code runs 10% faster on both A9
C and A15. But it probably slows things down for 8 <= n < a few dozen.
define(`rp', `r0')
define(`up', `r1')
@ -39,22 +57,23 @@ PROLOGUE(mpn_copyi)
L(skip1):
tst n, #2
beq L(skip2)
ldmia up!, { r3, r12 } C load 2 limbs
stmia rp!, { r3, r12 } C store 2 limbs
ldmia up!, { r3,r12 }
stmia rp!, { r3,r12 }
L(skip2):
bics n, n, #3
beq L(rtn)
stmfd sp!, { r7, r8, r9 } C save regs on stack
L(top): ldmia up!, { r3, r8, r9, r12 } C load 4 limbs
push { r4-r5 }
subs n, n, #4
stmia rp!, { r3, r8, r9, r12 } C store 4 limbs
ldmia up!, { r3,r4,r5,r12 }
beq L(end)
L(top): subs n, n, #4
stmia rp!, { r3,r4,r5,r12 }
ldmia up!, { r3,r4,r5,r12 }
bne L(top)
ldmfd sp!, { r7, r8, r9 } C restore regs from stack
L(rtn):
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
L(end): stm rp, { r3,r4,r5,r12 }
pop { r4-r5 }
L(rtn): ret lr
EPILOGUE()

View File

@ -3,19 +3,30 @@ dnl ARM mpn_invert_limb -- Invert a normalized limb.
dnl Copyright 2001, 2009, 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
@ -41,13 +52,10 @@ PROLOGUE(mpn_invert_limb)
adds r1, r12, r0
adc r3, r3, r0
rsb r0, r3, r2
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
ret lr
EPILOGUE()
.section .rodata
RODATA
ALIGN(2)
approx_tab:
.short 0xffc0,0xfec0,0xfdc0,0xfcc0,0xfbc0,0xfac0,0xfa00,0xf900

View File

@ -1,23 +1,34 @@
dnl ARM mpn_and_n, mpn_andn_n. mpn_nand_n, etc.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 1997, 2000, 2001, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
@ -25,9 +36,10 @@ C cycles/limb cycles/limb
C and andn ior xor nand iorn nior xnor
C StrongARM ? ?
C XScale ? ?
C Cortex-A7 ? ?
C Cortex-A8 ? ?
C Cortex-A9 2.5-2.72 2.75-3
C Cortex-A15 ? ?
C Cortex-A15 2.25 2.75
C TODO
C * It seems that 2.25 c/l and 2.75 c/l is possible for A9.
@ -123,8 +135,5 @@ L(mid): sub n, n, #4
pop { r4, r5, r6, r7 } C popping r8-r10 here strangely fails
L(rtn): pop { r8, r9, r10 }
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -1,29 +1,41 @@
dnl ARM mpn_lshift.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 3.5
C Cortex-A15 ?
@ -42,7 +54,7 @@ PROLOGUE(mpn_lshift)
add rp, rp, n, lsl #2
rsb tnc, cnt, #32
lsl r7, r4, cnt
mov r7, r4, lsl cnt
tst n, #1
beq L(evn) C n even
@ -58,22 +70,19 @@ L(evn): ldr r6, [up, #-4]!
L(top): ldr r8, [up, #-4]!
orr r7, r7, r6, lsr tnc
str r7, [rp, #-4]!
lsl r7, r6, cnt
mov r7, r6, lsl cnt
L(mid): ldr r6, [up, #-4]!
orr r7, r7, r8, lsr tnc
str r7, [rp, #-4]!
lsl r7, r8, cnt
mov r7, r8, lsl cnt
subs n, n, #2
bgt L(top)
L(end): orr r7, r7, r6, lsr tnc
str r7, [rp, #-4]!
lsl r7, r6, cnt
mov r7, r6, lsl cnt
L(1): str r7, [rp, #-4]
lsr r0, r4, tnc
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -1,29 +1,41 @@
dnl ARM mpn_lshiftc.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 4.0
C Cortex-A15 ?
@ -43,7 +55,7 @@ PROLOGUE(mpn_lshiftc)
rsb tnc, cnt, #32
mvn r6, r4
lsl r7, r6, cnt
mov r7, r6, lsl cnt
tst n, #1
beq L(evn) C n even
@ -62,25 +74,22 @@ L(top): ldr r8, [up, #-4]!
orr r7, r7, r6, lsr tnc
str r7, [rp, #-4]!
mvn r8, r8
lsl r7, r6, cnt
mov r7, r6, lsl cnt
L(mid): ldr r6, [up, #-4]!
orr r7, r7, r8, lsr tnc
str r7, [rp, #-4]!
mvn r6, r6
lsl r7, r8, cnt
mov r7, r8, lsl cnt
subs n, n, #2
bgt L(top)
L(end): orr r7, r7, r6, lsr tnc
str r7, [rp, #-4]!
lsl r7, r6, cnt
mov r7, r6, lsl cnt
L(1): mvn r6, #0
orr r7, r7, r6, lsr tnc
str r7, [rp, #-4]
lsr r0, r4, tnc
mov r0, r4, lsr tnc
pop {r4, r6, r7, r8}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -1,30 +1,42 @@
dnl ARM mpn_mod_34lsub1 -- remainder modulo 2^24-1.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl Copyright 2012, 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 1.33
C Cortex-A15 ?
C Cortex-A15 1.33
define(`ap', r0)
define(`n', r1)
@ -48,7 +60,7 @@ PROLOGUE(mpn_mod_34lsub1)
ldmia ap!, { r2, r3, r12 }
subs n, n, #3
blt L(sum) C n <= 5
adds r0, r0, #0 C clear carry
cmn r0, #0 C clear carry
sub n, n, #3
b L(mid)
@ -83,21 +95,18 @@ L(sum2):
add r0, r0, r2, lsr #24
add r0, r0, r7
lsl r7, r3, #8
mov r7, r3, lsl #8
bic r1, r7, #0xff000000
add r0, r0, r1
add r0, r0, r3, lsr #16
lsl r7, r12, #16
mov r7, r12, lsl #16
bic r1, r7, #0xff000000
add r0, r0, r1
add r0, r0, r12, lsr #8
pop { r4, r5, r6, r7 }
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
ret lr
L(le2): cmn n, #1
bne L(1)
@ -108,8 +117,5 @@ L(1): ldr r2, [ap]
bic r0, r2, #0xff000000
add r0, r0, r2, lsr #24
pop { r4, r5, r6, r7 }
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
ret lr
EPILOGUE()

View File

@ -1,32 +1,52 @@
dnl ARM mpn_modexact_1c_odd
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 10
C Cortex-A15 ?
C Cortex-A15 9
C Architecture requirements:
C v5 -
C v5t -
C v5te -
C v6 -
C v6t2 -
C v7a -
define(`up', `r0')
define(`n', `r1')
@ -68,8 +88,5 @@ L(end): sbcs cy, r5, cy
addcc r0, r0, #1
ldmfd sp!, {r4, r5}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -1,32 +1,44 @@
dnl ARM mpn_rsh1add_n and mpn_rsh1sub_n.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 3.64-3.7
C Cortex-A15 ?
C Cortex-A15 2.5
C TODO
C * Not optimised.
@ -59,7 +71,7 @@ PROLOGUE(func)
ldr r4, [up], #4
ldr r8, [vp], #4
ADDSUB r4, r4, r8
rrxs r12, r7
movs r12, r7, rrx
and r11, r4, #1 C return value
subs n, n, #4
blo L(end)
@ -70,10 +82,10 @@ L(top): ldmia up!, {r5,r6,r7}
ADDSUBC r5, r5, r8
ADDSUBC r6, r6, r9
ADDSUBC r7, r7, r10
rrxs r12, r7
rrxs r6, r6
rrxs r5, r5
rrxs r4, r4
movs r12, r7, rrx
movs r6, r6, rrx
movs r5, r5, rrx
movs r4, r4, rrx
subs n, n, #3
stmia rp!, {r4,r5,r6}
mov r4, r7
@ -86,9 +98,9 @@ L(end): cmn n, #2
cmn r12, r12
ADDSUBC r5, r5, r8
ADDSUBC r6, r6, r9
rrxs r12, r6
rrxs r5, r5
rrxs r4, r4
movs r12, r6, rrx
movs r5, r5, rrx
movs r4, r4, rrx
stmia rp!, {r4,r5}
mov r4, r6
b L(e1)
@ -98,18 +110,15 @@ L(e2): bne L(e1)
ldr r8, [vp, #0]
cmn r12, r12
ADDSUBC r5, r5, r8
rrxs r12, r5
rrxs r4, r4
movs r12, r5, rrx
movs r4, r4, rrx
str r4, [rp], #4
mov r4, r5
L(e1): RSTCY( r12, r1)
rrxs r4, r4
mov r4, r4, rrx
str r4, [rp, #0]
mov r0, r11
pop {r4-r11}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -1,29 +1,41 @@
dnl ARM mpn_rshift.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Contributed to the GNU project by Torbjörn Granlund.
dnl Copyright 1997, 2000, 2001, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 3.5
C Cortex-A15 ?
@ -40,7 +52,7 @@ PROLOGUE(mpn_rshift)
ldr r4, [up]
rsb tnc, cnt, #32
lsr r7, r4, cnt
mov r7, r4, lsr cnt
tst n, #1
beq L(evn) C n even
@ -56,22 +68,19 @@ L(evn): ldr r6, [up, #4]!
L(top): ldr r8, [up, #4]!
orr r7, r7, r6, lsl tnc
str r7, [rp], #4
lsr r7, r6, cnt
mov r7, r6, lsr cnt
L(mid): ldr r6, [up, #4]!
orr r7, r7, r8, lsl tnc
str r7, [rp], #4
lsr r7, r8, cnt
mov r7, r8, lsr cnt
subs n, n, #2
bgt L(top)
L(end): orr r7, r7, r6, lsl tnc
str r7, [rp], #4
lsr r7, r6, cnt
L(1): str r7, [rp], #4
lsl r0, r4, tnc
mov r7, r6, lsr cnt
L(1): str r7, [rp]
mov r0, r4, lsl tnc
pop {r4, r6, r7, r8}
ifdef(`ARM_THUMB_MODE',
` bx r14
',` mov pc, r14
')
ret r14
EPILOGUE()

View File

@ -4,19 +4,30 @@ dnl Return quotient and store remainder through a supplied pointer.
dnl Copyright 2001, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
@ -50,10 +61,7 @@ L(oop): divstep(n1,n0,d)
str n1, [rem_ptr] C store remainder
adc r0, n0, n0 C quotient: add last carry from divstep
ifdef(`ARM_THUMB_MODE',
` bx lr
',` mov pc, lr
')
ret lr
L(_large_divisor):
stmfd sp!, { r8, lr }

View File

@ -1,75 +0,0 @@
dnl ARM mpn_modexact_1c_odd
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A8 ?
C Cortex-A9 9
C Cortex-A15 ?
define(`up', `r0')
define(`n', `r1')
define(`d', `r2')
define(`cy', `r3')
.protected binvert_limb_table
ASM_START()
PROLOGUE(mpn_modexact_1c_odd)
stmfd sp!, {r4, r5, r6, r7}
LEA( r4, binvert_limb_table)
ldr r6, [up], #4 C up[0]
ubfx r12, d, #1, #7
ldrb r4, [r4, r12]
smulbb r12, r4, r4
mul r12, d, r12
rsb r12, r12, r4, asl #1
mul r4, r12, r12
mul r4, d, r4
rsb r4, r4, r12, asl #1 C r4 = inverse
subs n, n, #1
sub r6, r6, cy
mul r6, r6, r4
beq L(end)
rsb r5, r4, #0 C r5 = -inverse
L(top): ldr r7, [up], #4
mov r12, #0
umaal r12, cy, r6, d
mul r6, r7, r4
mla r6, cy, r5, r6
subs n, n, #1
bne L(top)
L(end): mov r12, #0
umaal r12, cy, r6, d
mov r0, cy
ldmfd sp!, {r4, r5, r6, r7}
bx r14
EPILOGUE()

View File

@ -1,46 +0,0 @@
; Clipper __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
; sum in a third limb vector.
; Copyright 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 16
.globl ___gmpn_add_n
___gmpn_add_n:
subq $8,sp
storw r6,(sp)
loadw 12(sp),r2
loadw 16(sp),r3
loadq $0,r6 ; clear carry-save register
.Loop: loadw (r1),r4
loadw (r2),r5
addwc r6,r6 ; restore carry from r6
addwc r5,r4
storw r4,(r0)
subwc r6,r6 ; save carry in r6
addq $4,r0
addq $4,r1
addq $4,r2
subq $1,r3
brne .Loop
negw r6,r0
loadw (sp),r6
addq $8,sp
ret sp

View File

@ -1,45 +0,0 @@
; Clipper __gmpn_mul_1 -- Multiply a limb vector with a limb and store
; the result in a second limb vector.
; Copyright 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 16
.globl ___gmpn_mul_1
___gmpn_mul_1:
subq $8,sp
storw r6,(sp)
loadw 12(sp),r2
loadw 16(sp),r3
loadq $0,r6 ; clear carry limb
.Loop: loadw (r1),r4
mulwux r3,r4
addw r6,r4 ; add old carry limb into low product limb
loadq $0,r6
addwc r5,r6 ; propagate cy into high product limb
storw r4,(r0)
addq $4,r0
addq $4,r1
subq $1,r2
brne .Loop
movw r6,r0
loadw 0(sp),r6
addq $8,sp
ret sp

View File

@ -1,46 +0,0 @@
; Clipper __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
; store difference in a third limb vector.
; Copyright 1995, 2000 Free Software Foundation, Inc.
; This file is part of the GNU MP Library.
; 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 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 Lesser General Public License
; along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 16
.globl ___gmpn_sub_n
___gmpn_sub_n:
subq $8,sp
storw r6,(sp)
loadw 12(sp),r2
loadw 16(sp),r3
loadq $0,r6 ; clear carry-save register
.Loop: loadw (r1),r4
loadw (r2),r5
addwc r6,r6 ; restore carry from r6
subwc r5,r4
storw r4,(r0)
subwc r6,r6 ; save carry in r6
addq $4,r0
addq $4,r1
addq $4,r2
subq $1,r3
brne .Loop
negw r6,r0
loadw (sp),r6
addq $8,sp
ret sp

View File

@ -1,62 +0,0 @@
/* mpn_addcnd_n -- Compute R = U + V if CND != 0 or R = U if CND == 0.
Both cases should take the same time and perform the exact same memory
accesses, since this function is intended to be used where side-channel
attack resilience is relevant.
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2008, 2009, 2011 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
mpn_addcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
{
mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
mask = -(mp_limb_t) (cnd != 0);
cy = 0;
do
{
ul = *up++;
vl = *vp++ & mask;
#if GMP_NAIL_BITS == 0
sl = ul + vl;
cy1 = sl < ul;
rl = sl + cy;
cy2 = rl < sl;
cy = cy1 | cy2;
*rp++ = rl;
#else
rl = ul + vl;
rl += cy;
cy = rl >> GMP_NUMB_BITS;
*rp++ = rl & GMP_NUMB_MASK;
#endif
}
while (--n != 0);
return cy;
}

View File

@ -1,31 +1,40 @@
/* mpn_div_qr_2 -- Divide natural numbers, producing both remainder and
quotient. The divisor is two limbs.
Contributed to the GNU project by Torbjorn Granlund and Niels Möller
Contributed to the GNU project by Torbjorn Granlund and Niels Möller
THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS
ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP
RELEASE.
THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2011 Free Software
Foundation, Inc.
Copyright 1993-1996, 1999-2002, 2011 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -42,13 +51,13 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Define some longlong.h-style macros, but for wider operations.
* add_sssaaaa is like longlong.h's add_ssaaaa but the propagating
carry-out into an additional sum opeand.
carry-out into an additional sum operand.
* add_csaac accepts two addends and a carry in, and generates a sum
and a carry out. A little like a "full adder".
*/
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER)
#if defined (__GNUC__) && ! defined (__INTEL_COMPILER) && ! defined (NO_ASM)
#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
#define add_sssaaaa(s2, s1, s0, a1, a0, b1, b0) \
__asm__ ("add\t%7, %k2\n\tadc\t%5, %k1\n\tadc\t$0, %k0" \
: "=r" (s2), "=&r" (s1), "=&r" (s0) \
@ -116,7 +125,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#endif
/* Typically used with r1, r0 same as n3, n2. Other types of overlap
between inputs and outputs not supported. */
between inputs and outputs are not supported. */
#define udiv_qr_4by2(q1,q0, r1,r0, n3,n2,n1,n0, d1,d0, di1,di0) \
do { \
mp_limb_t _q3, _q2a, _q2, _q1, _q2c, _q1c, _q1d, _q0; \
@ -131,7 +140,6 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d); \
\
add_ssaaaa (r1, r0, n3, n2, CNST_LIMB(0), CNST_LIMB(1)); \
/* FIXME: combine as in x86_64 asm */ \
\
/* [q3,q2,q1,q0] += [n3,n3,n1,n0] */ \
add_csaac (_c, _q0, _q0, n0, CNST_LIMB(0)); \
@ -144,7 +152,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
\
sub_ddmmss (r1, r0, n1, n0, _t1, _t0); \
\
_mask = -(mp_limb_t) (r1 >= _q1 & (r1 > _q1 | r0 >= _q0)); /* (r1,r0) >= (q1,q0) */ \
_mask = -(mp_limb_t) ((r1 >= _q1) & ((r1 > _q1) | (r0 >= _q0))); /* (r1,r0) >= (q1,q0) */ \
add_ssaaaa (r1, r0, r1, r0, d1 & _mask, d0 & _mask); \
sub_ddmmss (_q3, _q2, _q3, _q2, CNST_LIMB(0), -_mask); \
\

View File

@ -1,29 +1,38 @@
/* mpn_divrem_2 -- Divide natural numbers, producing both remainder and
quotient. The divisor is two limbs.
THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS
ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP
RELEASE.
THIS FILE CONTAINS INTERNAL FUNCTIONS WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 1993, 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
Foundation, Inc.
Copyright 1993-1996, 1999-2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"

View File

@ -9,17 +9,28 @@ Copyright 2003, 2004, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -78,7 +89,7 @@ static volatile const long CONST_NEG_1022_SUB_53 = -1022 - 53;
should come out nice and compact.
The generic code used to work one bit at a time, which was not only slow,
but implicitly relied upon denoms for intermediates, since the lowest bits'
but implicitly relied upon denorms for intermediates, since the lowest bits'
weight of a perfectly valid fp number underflows in non-denorm. Therefore,
the generic code now works limb-per-limb, initially creating a number x such
that 1 <= x <= BASE. (BASE is reached only as result of rounding.) Then

View File

@ -1,29 +1,40 @@
/* mpn_mod_1_1p (ap, n, b, cps)
Divide (ap,,n) by b. Return the single-limb remainder.
Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
Based on a suggestion by Peter L. Montgomery.
THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
Copyright 2008-2011, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -37,7 +48,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
* add_mssaaaa is like longlong.h's add_ssaaaa, but also generates
* carry out, in the form of a mask. */
#if defined (__GNUC__)
#if defined (__GNUC__) && ! defined (NO_ASM)
#if HAVE_HOST_CPU_FAMILY_x86 && W_TYPE_SIZE == 32
#define add_mssaaaa(m, s1, s0, a1, a0, b1, b0) \
@ -80,6 +91,17 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
: "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl), \
"rJ" ((al) >> 32), "rI" ((bl) >> 32) \
__CLOBBER_CC)
#if __VIS__ >= 0x300
#undef add_mssaaaa
#define add_mssaaaa(m, sh, sl, ah, al, bh, bl) \
__asm__ ( "addcc %r5, %6, %2\n\t" \
"addxccc %r3, %4, %1\n\t" \
"clr %0\n\t" \
"movcs %%xcc, -1, %0" \
: "=r" (m), "=r" (sh), "=&r" (sl) \
: "rJ" (ah), "rI" (bh), "%rJ" (al), "rI" (bl) \
__CLOBBER_CC)
#endif
#endif
#if HAVE_HOST_CPU_FAMILY_powerpc && !defined (_LONG_LONG_LIMB)
@ -107,7 +129,7 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
"%2" ((UDItype)(a0)), "r" ((UDItype)(b0)) __CLOBBER_CC)
#endif
#if defined (__arm__) && W_TYPE_SIZE == 32
#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32
#define add_mssaaaa(m, sh, sl, ah, al, bh, bl) \
__asm__ ( "adds %2, %5, %6\n\t" \
"adcs %1, %3, %4\n\t" \
@ -165,7 +187,7 @@ mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
}
mp_limb_t
mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t bmodb[4])
{
mp_limb_t rh, rl, bi, ph, pl, r;
mp_limb_t B1modb, B2modb;
@ -180,7 +202,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
rl = ap[n - 1];
umul_ppmm (ph, pl, rl, B1modb);
add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]);
add_ssaaaa (rh, rl, ph, pl, CNST_LIMB(0), ap[n - 2]);
for (i = n - 3; i >= 0; i -= 1)
{
@ -189,7 +211,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
+ HI(rr) * (B^2 mod b) <= (B-1)(b-1)
*/
umul_ppmm (ph, pl, rl, B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[i]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i]);
umul_ppmm (rh, rl, rh, B2modb);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
@ -239,7 +261,7 @@ mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
}
mp_limb_t
mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t bmodb[4])
{
int cnt;
mp_limb_t bi, B1modb;
@ -294,8 +316,7 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
r1 = (r1 << cnt) | (r0 >> (GMP_LIMB_BITS - cnt));
r0 <<= cnt;
/* NOTE: Might get r1 == b here, but udiv_rnnd_preinv allows
that. */
/* NOTE: Might get r1 == b here, but udiv_rnnd_preinv allows that. */
}
else
{

View File

@ -9,22 +9,33 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
Copyright 2008-2010 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -71,7 +82,7 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
}
mp_limb_t
mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[5])
{
mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb;
@ -97,7 +108,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
}
umul_ppmm (ph, pl, ap[n - 2], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
umul_ppmm (rh, rl, ap[n - 1], B2modb);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
n--;
@ -116,7 +127,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
+ HI(rr) * (B^3 mod b) <= (B-1)(b-1)
*/
umul_ppmm (ph, pl, ap[i + 1], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
umul_ppmm (ch, cl, rl, B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@ -126,7 +137,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
}
umul_ppmm (rh, cl, rh, B1modb);
add_ssaaaa (rh, rl, rh, rl, 0, cl);
add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
cnt = cps[1];
bi = cps[0];

View File

@ -9,22 +9,33 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2008, 2009, 2010, 2013 Free Software Foundation, Inc.
Copyright 2008-2010, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -74,7 +85,7 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
}
mp_limb_t
mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[6])
{
mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb, B4modb;
@ -95,7 +106,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
{
case 0:
umul_ppmm (ph, pl, ap[n - 2], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
umul_ppmm (rh, rl, ap[n - 1], B2modb);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
n -= 3;
@ -121,7 +132,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
+ HI(rr) * (B^4 mod b) <= (B-1)(b-1)
*/
umul_ppmm (ph, pl, ap[i + 1], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
umul_ppmm (ch, cl, ap[i + 2], B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@ -134,7 +145,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
}
umul_ppmm (rh, cl, rh, B1modb);
add_ssaaaa (rh, rl, rh, rl, 0, cl);
add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
cnt = cps[1];
bi = cps[0];

View File

@ -9,22 +9,33 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2008, 2009, 2010 Free Software Foundation, Inc.
Copyright 2008-2010 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -77,7 +88,7 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
}
mp_limb_t
mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[7])
{
mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
@ -96,7 +107,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
{
case 0:
umul_ppmm (ph, pl, ap[n - 3], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 4]);
umul_ppmm (ch, cl, ap[n - 2], B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
umul_ppmm (rh, rl, ap[n - 1], B3modb);
@ -115,7 +126,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
break;
case 3:
umul_ppmm (ph, pl, ap[n - 2], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
umul_ppmm (rh, rl, ap[n - 1], B2modb);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
n -= 3;
@ -132,7 +143,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
+ HI(rr) * (B^5 mod b) <= (B-1)(b-1)
*/
umul_ppmm (ph, pl, ap[i + 1], B1modb);
add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[i + 0]);
umul_ppmm (ch, cl, ap[i + 2], B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@ -148,7 +159,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
}
umul_ppmm (rh, cl, rh, B1modb);
add_ssaaaa (rh, rl, rh, rl, 0, cl);
add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
cnt = cps[1];
bi = cps[0];

View File

@ -1,446 +0,0 @@
/* mpn_powm_sec -- Compute R = U^E mod M. Secure variant, side-channel silent
under the assumption that the multiply instruction is side channel silent.
Contributed to the GNU project by Torbjorn Granlund.
THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2007, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/*
BASIC ALGORITHM, Compute U^E mod M, where M < B^n is odd.
1. T <- (B^n * U) mod M Convert to REDC form
2. Compute table U^0, U^1, U^2... of E-dependent size
3. While there are more bits in E
W <- power left-to-right base-k
TODO:
* Make getbits a macro, thereby allowing it to update the index operand.
That will simplify the code using getbits. (Perhaps make getbits' sibling
getbit then have similar form, for symmetry.)
* Write an itch function. Or perhaps get rid of tp parameter since the huge
pp area is allocated locally anyway?
* Choose window size without looping. (Superoptimize or think(tm).)
* Call side-channel silent division function for converting to REDC residue.
* REDC_1_TO_REDC_2_THRESHOLD might actually represent the cutoff between
redc_1 and redc_n. On such systems, we will switch to redc_2 causing
slowdown.
*/
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#undef MPN_REDC_1_SEC
#define MPN_REDC_1_SEC(rp, up, mp, n, invm) \
do { \
mp_limb_t cy; \
cy = mpn_redc_1 (rp, up, mp, n, invm); \
mpn_subcnd_n (rp, rp, mp, n, cy); \
} while (0)
#undef MPN_REDC_2_SEC
#define MPN_REDC_2_SEC(rp, up, mp, n, mip) \
do { \
mp_limb_t cy; \
cy = mpn_redc_2 (rp, up, mp, n, mip); \
mpn_subcnd_n (rp, rp, mp, n, cy); \
} while (0)
#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
#define WANT_REDC_2 1
#endif
/* Define our own mpn squaring function. We do this since we cannot use a
native mpn_sqr_basecase over TUNE_SQR_TOOM2_MAX, or a non-native one over
SQR_TOOM2_THRESHOLD. This is so because of fixed size stack allocations
made inside mpn_sqr_basecase. */
#if HAVE_NATIVE_mpn_sqr_diagonal
#define MPN_SQR_DIAGONAL(rp, up, n) \
mpn_sqr_diagonal (rp, up, n)
#else
#define MPN_SQR_DIAGONAL(rp, up, n) \
do { \
mp_size_t _i; \
for (_i = 0; _i < (n); _i++) \
{ \
mp_limb_t ul, lpl; \
ul = (up)[_i]; \
umul_ppmm ((rp)[2 * _i + 1], lpl, ul, ul << GMP_NAIL_BITS); \
(rp)[2 * _i] = lpl >> GMP_NAIL_BITS; \
} \
} while (0)
#endif
#if ! HAVE_NATIVE_mpn_sqr_basecase
/* The limit of the generic code is SQR_TOOM2_THRESHOLD. */
#define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
#endif
#if HAVE_NATIVE_mpn_sqr_basecase
#ifdef TUNE_SQR_TOOM2_MAX
/* We slightly abuse TUNE_SQR_TOOM2_MAX here. If it is set for an assembly
mpn_sqr_basecase, it comes from SQR_TOOM2_THRESHOLD_MAX in the assembly
file. An assembly mpn_sqr_basecase that does not define it, should allow
any size. */
#define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
#endif
#endif
#ifdef WANT_FAT_BINARY
/* For fat builds, we use SQR_TOOM2_THRESHOLD which will expand to a read from
__gmpn_cpuvec. Perhaps any possible sqr_basecase.asm allow any size, and we
limit the use unnecessarily. We cannot tell, so play it safe. FIXME. */
#define SQR_BASECASE_LIM SQR_TOOM2_THRESHOLD
#endif
#ifndef SQR_BASECASE_LIM
/* If SQR_BASECASE_LIM is now not defined, use mpn_sqr_basecase for any operand
size. */
#define mpn_local_sqr(rp,up,n,tp) mpn_sqr_basecase(rp,up,n)
#else
/* Define our own squaring function, which uses mpn_sqr_basecase for its
allowed sizes, but its own code for larger sizes. */
static void
mpn_local_sqr (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr tp)
{
mp_size_t i;
ASSERT (n >= 1);
ASSERT (! MPN_OVERLAP_P (rp, 2*n, up, n));
if (BELOW_THRESHOLD (n, SQR_BASECASE_LIM))
{
mpn_sqr_basecase (rp, up, n);
return;
}
{
mp_limb_t ul, lpl;
ul = up[0];
umul_ppmm (rp[1], lpl, ul, ul << GMP_NAIL_BITS);
rp[0] = lpl >> GMP_NAIL_BITS;
}
if (n > 1)
{
mp_limb_t cy;
cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]);
tp[n - 1] = cy;
for (i = 2; i < n; i++)
{
mp_limb_t cy;
cy = mpn_addmul_1 (tp + 2 * i - 2, up + i, n - i, up[i - 1]);
tp[n + i - 2] = cy;
}
MPN_SQR_DIAGONAL (rp + 2, up + 1, n - 1);
{
mp_limb_t cy;
#if HAVE_NATIVE_mpn_addlsh1_n
cy = mpn_addlsh1_n (rp + 1, rp + 1, tp, 2 * n - 2);
#else
cy = mpn_lshift (tp, tp, 2 * n - 2, 1);
cy += mpn_add_n (rp + 1, rp + 1, tp, 2 * n - 2);
#endif
rp[2 * n - 1] += cy;
}
}
}
#endif
#define getbit(p,bi) \
((p[(bi - 1) / GMP_NUMB_BITS] >> (bi - 1) % GMP_NUMB_BITS) & 1)
static inline mp_limb_t
getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
{
int nbits_in_r;
mp_limb_t r;
mp_size_t i;
if (bi < nbits)
{
return p[0] & (((mp_limb_t) 1 << bi) - 1);
}
else
{
bi -= nbits; /* bit index of low bit to extract */
i = bi / GMP_NUMB_BITS; /* word index of low bit to extract */
bi %= GMP_NUMB_BITS; /* bit index in low word */
r = p[i] >> bi; /* extract (low) bits */
nbits_in_r = GMP_NUMB_BITS - bi; /* number of bits now in r */
if (nbits_in_r < nbits) /* did we get enough bits? */
r += p[i + 1] << nbits_in_r; /* prepend bits from higher word */
return r & (((mp_limb_t ) 1 << nbits) - 1);
}
}
#ifndef POWM_SEC_TABLE
#if GMP_NUMB_BITS < 50
#define POWM_SEC_TABLE 2,33,96,780,2741
#else
#define POWM_SEC_TABLE 2,130,524,2578
#endif
#endif
#if TUNE_PROGRAM_BUILD
extern int win_size (mp_bitcnt_t);
#else
static inline int
win_size (mp_bitcnt_t eb)
{
int k;
static mp_bitcnt_t x[] = {0,POWM_SEC_TABLE,~(mp_bitcnt_t)0};
for (k = 1; eb > x[k]; k++)
;
return k;
}
#endif
/* Convert U to REDC form, U_r = B^n * U mod M.
Uses scratch space at tp of size 2un + n + 1. */
static void
redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n, mp_ptr tp)
{
#if 0
mp_ptr qp;
qp = tp + un + n; /* un + n - n + 1 = un + 1 limbs */
MPN_ZERO (tp, n);
MPN_COPY (tp + n, up, un);
mpn_tdiv_qr (qp, rp, 0L, tp, un + n, mp, n);
#else
/* FIXME: Use passed scratch space instead of allocating our own! */
mp_ptr scratch;
TMP_DECL;
TMP_MARK;
MPN_ZERO (tp, n);
MPN_COPY (tp + n, up, un);
scratch = TMP_ALLOC_LIMBS ((un + n) + 2 * n + 2);
mpn_sb_div_r_sec (tp, un + n, mp, n, scratch);
MPN_COPY (rp, tp, n);
TMP_FREE;
#endif
}
/* rp[n-1..0] = bp[bn-1..0] ^ ep[en-1..0] mod mp[n-1..0]
Requires that mp[n-1..0] is odd.
Requires that ep[en-1..0] > 1.
Uses scratch space at tp as defined by mpn_powm_sec_itch. */
void
mpn_powm_sec (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
mp_srcptr ep, mp_size_t en,
mp_srcptr mp, mp_size_t n, mp_ptr tp)
{
mp_limb_t ip[2], *mip;
mp_bitcnt_t ebi;
int windowsize, this_windowsize;
mp_limb_t expbits;
mp_ptr pp, this_pp;
long i;
int cnd;
ASSERT (en > 1 || (en == 1 && ep[0] > 0));
ASSERT (n >= 1 && ((mp[0] & 1) != 0));
MPN_SIZEINBASE_2EXP(ebi, ep, en, 1);
windowsize = win_size (ebi);
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
{
mip = ip;
binvert_limb (mip[0], mp[0]);
mip[0] = -mip[0];
}
else
{
mip = ip;
mpn_binvert (mip, mp, 2, tp);
mip[0] = -mip[0]; mip[1] = ~mip[1];
}
#else
mip = ip;
binvert_limb (mip[0], mp[0]);
mip[0] = -mip[0];
#endif
pp = tp;
tp += (n << windowsize); /* put tp after power table */
/* Compute pp[0] table entry */
/* scratch: | n | 1 | n+2 | */
/* | pp[0] | 1 | redcify | */
this_pp = pp;
this_pp[n] = 1;
redcify (this_pp, this_pp + n, 1, mp, n, this_pp + n + 1);
this_pp += n;
/* Compute pp[1] table entry. To avoid excessive scratch usage in the
degenerate situation where B >> M, we let redcify use scratch space which
will later be used by the pp table (element 2 and up). */
/* scratch: | n | n | bn + n + 1 | */
/* | pp[0] | pp[1] | redcify | */
redcify (this_pp, bp, bn, mp, n, this_pp + n);
/* Precompute powers of b and put them in the temporary area at pp. */
/* scratch: | n | n | ... | | 2n | */
/* | pp[0] | pp[1] | ... | pp[2^windowsize-1] | product | */
for (i = (1 << windowsize) - 2; i > 0; i--)
{
mpn_mul_basecase (tp, this_pp, n, pp + n, n);
this_pp += n;
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
else
MPN_REDC_2_SEC (this_pp, tp, mp, n, mip);
#else
MPN_REDC_1_SEC (this_pp, tp, mp, n, mip[0]);
#endif
}
expbits = getbits (ep, ebi, windowsize);
if (ebi < windowsize)
ebi = 0;
else
ebi -= windowsize;
mpn_tabselect (rp, pp, n, 1 << windowsize, expbits);
/* Main exponentiation loop. */
/* scratch: | n | n | ... | | 3n-4n | */
/* | pp[0] | pp[1] | ... | pp[2^windowsize-1] | loop scratch | */
#define INNERLOOP \
while (ebi != 0) \
{ \
expbits = getbits (ep, ebi, windowsize); \
this_windowsize = windowsize; \
if (ebi < windowsize) \
{ \
this_windowsize -= windowsize - ebi; \
ebi = 0; \
} \
else \
ebi -= windowsize; \
\
do \
{ \
mpn_local_sqr (tp, rp, n, tp + 2 * n); \
MPN_REDUCE (rp, tp, mp, n, mip); \
this_windowsize--; \
} \
while (this_windowsize != 0); \
\
mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits); \
mpn_mul_basecase (tp, rp, n, tp + 2*n, n); \
\
MPN_REDUCE (rp, tp, mp, n, mip); \
}
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
{
#undef MPN_MUL_N
#undef MPN_SQR
#undef MPN_REDUCE
#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1_SEC (rp, tp, mp, n, mip[0])
INNERLOOP;
}
else
{
#undef MPN_MUL_N
#undef MPN_SQR
#undef MPN_REDUCE
#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_2_SEC (rp, tp, mp, n, mip)
INNERLOOP;
}
#else
#undef MPN_MUL_N
#undef MPN_SQR
#undef MPN_REDUCE
#define MPN_MUL_N(r,a,b,n) mpn_mul_basecase (r,a,n,b,n)
#define MPN_SQR(r,a,n) mpn_sqr_basecase (r,a,n)
#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1_SEC (rp, tp, mp, n, mip[0])
INNERLOOP;
#endif
MPN_COPY (tp, rp, n);
MPN_ZERO (tp + n, n);
#if WANT_REDC_2
if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
MPN_REDC_1_SEC (rp, tp, mp, n, mip[0]);
else
MPN_REDC_2_SEC (rp, tp, mp, n, mip);
#else
MPN_REDC_1_SEC (rp, tp, mp, n, mip[0]);
#endif
cnd = mpn_sub_n (tp, rp, mp, n); /* we need just retval */
mpn_subcnd_n (rp, rp, mp, n, !cnd);
}
mp_size_t
mpn_powm_sec_itch (mp_size_t bn, mp_size_t en, mp_size_t n)
{
int windowsize;
mp_size_t redcify_itch, itch;
/* The top scratch usage will either be when reducing B in the 2nd redcify
call, or more typically n*2^windowsize + 3n or 4n, in the main loop. (It
is 3n or 4n depending on if we use mpn_local_sqr or a native
mpn_sqr_basecase. We assume 4n always for now.) */
windowsize = win_size (en * GMP_NUMB_BITS); /* slight over-estimate of exp */
/* The 2n term is due to pp[0] and pp[1] at the time of the 2nd redcify call,
the 2bn + n + 1 term is due to redcify's own usage. */
redcify_itch = (2 * n) + (2 * bn + n + 1);
/* The n * 2^windowsize term is due to the power table, the 4n term is due to
scratch needs of squaring/multiplication in the exponentiation loop. */
itch = (n << windowsize) + (4 * n);
return MAX (itch, redcify_itch);
}

View File

@ -1,105 +0,0 @@
/* mpn_sb_div_qr_sec, mpn_sb_div_r_sec -- Compute Q = floor(U / V), U = U mod
V. Side-channel silent under the assumption that the used instructions are
side-channel silent.
Contributed to the GNU project by Torbjorn Granlund.
THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2011, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License along
with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
#if OPERATION_sb_div_qr_sec
/* Needs (nn + dn + 1) + mpn_sbpi1_div_qr_sec's needs of (2nn' - dn + 1) for a
total of 3nn + 4 limbs at tp. Note that mpn_sbpi1_div_qr_sec's nn is one
greater than ours, therefore +4 and not just +2. */
#define FNAME mpn_sb_div_qr_sec
#define Q(q) q,
#endif
#if OPERATION_sb_div_r_sec
/* Needs (nn + dn + 1) + mpn_sbpi1_div_r_sec's needs of (dn + 1) for a total of
nn + 2dn + 2 limbs at tp. */
#define FNAME mpn_sb_div_r_sec
#define Q(q)
#endif
void
FNAME (Q(mp_ptr qp)
mp_ptr np, mp_size_t nn,
mp_srcptr dp, mp_size_t dn,
mp_ptr tp)
{
mp_limb_t d1, d0, qh;
unsigned int cnt;
mp_ptr np2, dp2;
gmp_pi1_t dinv;
mp_limb_t inv32;
mp_limb_t cy;
ASSERT (dn >= 1);
ASSERT (nn >= dn);
ASSERT (dp[dn - 1] != 0);
d1 = dp[dn - 1];
count_leading_zeros (cnt, d1);
if (cnt != 0)
{
dp2 = tp; /* dn limbs */
mpn_lshift (dp2, dp, dn, cnt);
np2 = tp + dn; /* (nn + 1) limbs */
cy = mpn_lshift (np2, np, nn, cnt);
np2[nn++] = cy;
}
else
{
/* FIXME: Consider copying np->np2 here, adding a 0-limb at the top.
That would simplify the underlying sbpi1 function, since then it
could assume nn > dn. */
dp2 = (mp_ptr) dp;
np2 = np;
}
d0 = dp2[dn - 1];
d0 += (~d0 != 0);
invert_limb (inv32, d0);
/* We add nn + dn to tp here, not nn + 1 + dn, as expected. This is since nn
here will have been incremented. */
#if OPERATION_sb_div_qr_sec
qh = mpn_sbpi1_div_qr_sec (qp, np2, nn, dp2, dn, inv32, tp + nn + dn);
#else
mpn_sbpi1_div_r_sec (np2, nn, dp2, dn, inv32, tp + nn + dn);
#endif
if (cnt == 0)
; /* we have np = np2 here. */
else
mpn_rshift (np, np2, dn, cnt);
#if OPERATION_sb_div_qr_sec
if (cnt == 0)
qp[nn - dn] = qh;
#endif
}

View File

@ -1,162 +0,0 @@
/* mpn_sbpi1_div_qr_sec, mpn_sbpi1_div_r_sec -- Compute Q = floor(U / V), U = U
mod V. Side-channel silent under the assumption that the used instructions
are side-channel silent.
Contributed to the GNU project by Torbjorn Granlund.
THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH MUTABLE INTERFACES. IT IS ONLY
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License along
with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
/* This side-channel silent division algorithm reduces the partial remainder by
GMP_NUMB_BITS/2 bits at a time, compared to GMP_NUMB_BITS for the main
division algorithm. We do not insists on reducing by exactly
GMP_NUMB_BITS/2, but may leave a partial remainder that is D*B^i to 3D*B^i
too large (B is the limb base, D is the divisor, and i is the induction
variable); the subsequent step will handle the extra partial remainder bits.
With that partial remainder reduction, each step generates a quotient "half
limb". The outer loop generates two quotient half limbs, an upper (q1h) and
a lower (q0h) which are stored sparsely in separate limb arrays. These
arrays are added at the end; using separate arrays avoids data-dependent
carry propagation which could else pose a side-channel leakage problem.
The quotient half limbs may be between -3 to 0 from the accurate value
("accurate" being the one which corresponds to a reduction to a principal
partial remainder). Too small quotient half limbs correspond to too large
remainders, which we reduce later, as described above.
In order to keep quotients from getting too big, corresponding to a negative
partial remainder, we use an inverse which is slightly smaller than usually.
*/
#if OPERATION_sbpi1_div_qr_sec
/* Needs (dn + 1) + (nn - dn) + (nn - dn) = 2nn - dn + 1 limbs at tp. */
#define FNAME mpn_sbpi1_div_qr_sec
#define Q(q) q,
#define RETTYPE mp_limb_t
#endif
#if OPERATION_sbpi1_div_r_sec
/* Needs (dn + 1) limbs at tp. */
#define FNAME mpn_sbpi1_div_r_sec
#define Q(q)
#define RETTYPE void
#endif
RETTYPE
FNAME (Q(mp_ptr qp)
mp_ptr np, mp_size_t nn,
mp_srcptr dp, mp_size_t dn,
mp_limb_t dinv,
mp_ptr tp)
{
mp_limb_t nh, cy, q1h, q0h, dummy, cnd;
mp_size_t i;
mp_ptr hp;
#if OPERATION_sbpi1_div_qr_sec
mp_limb_t qh;
mp_ptr qlp, qhp;
#endif
ASSERT (dn >= 1);
ASSERT (nn >= dn);
ASSERT ((dp[dn - 1] & GMP_NUMB_HIGHBIT) != 0);
if (nn == dn)
{
cy = mpn_sub_n (np, np, dp, dn);
mpn_addcnd_n (np, np, dp, dn, cy);
#if OPERATION_sbpi1_div_qr_sec
return 1 - cy;
#else
return;
#endif
}
/* Create a divisor copy shifted half a limb. */
hp = tp; /* (dn + 1) limbs */
hp[dn] = mpn_lshift (hp, dp, dn, GMP_NUMB_BITS / 2);
#if OPERATION_sbpi1_div_qr_sec
qlp = tp + (dn + 1); /* (nn - dn) limbs */
qhp = tp + (nn + 1); /* (nn - dn) limbs */
#endif
np += nn - dn;
nh = 0;
for (i = nn - dn - 1; i >= 0; i--)
{
np--;
nh = (nh << GMP_NUMB_BITS/2) + (np[dn] >> GMP_NUMB_BITS/2);
umul_ppmm (q1h, dummy, nh, dinv);
q1h += nh;
#if OPERATION_sbpi1_div_qr_sec
qhp[i] = q1h;
#endif
mpn_submul_1 (np, hp, dn + 1, q1h);
nh = np[dn];
umul_ppmm (q0h, dummy, nh, dinv);
q0h += nh;
#if OPERATION_sbpi1_div_qr_sec
qlp[i] = q0h;
#endif
nh -= mpn_submul_1 (np, dp, dn, q0h);
}
/* 1st adjustment depends on extra high remainder limb. */
cnd = nh != 0; /* FIXME: cmp-to-int */
#if OPERATION_sbpi1_div_qr_sec
qlp[0] += cnd;
#endif
nh -= mpn_subcnd_n (np, np, dp, dn, cnd);
/* 2nd adjustment depends on remainder/divisor comparison as well as whether
extra remainder limb was nullified by previous subtract. */
cy = mpn_sub_n (np, np, dp, dn);
cy = cy - nh;
#if OPERATION_sbpi1_div_qr_sec
qlp[0] += 1 - cy;
#endif
mpn_addcnd_n (np, np, dp, dn, cy);
/* 3rd adjustment depends on remainder/divisor comparison. */
cy = mpn_sub_n (np, np, dp, dn);
#if OPERATION_sbpi1_div_qr_sec
qlp[0] += 1 - cy;
#endif
mpn_addcnd_n (np, np, dp, dn, cy);
#if OPERATION_sbpi1_div_qr_sec
/* Combine quotient halves into final quotient. */
qh = mpn_lshift (qhp, qhp, nn - dn, GMP_NUMB_BITS/2);
qh += mpn_add_n (qp, qhp, qlp, nn - dn);
return qh;
#else
return;
#endif
}

View File

@ -1,62 +0,0 @@
/* mpn_subcnd_n -- Compute R = U - V if CND != 0 or R = U if CND == 0.
Both cases should take the same time and perform the exact same memory
accesses, since this function is intended to be used where side-channel
attack resilience is relevant.
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
Copyright 1992, 1993, 1994, 1996, 2000, 2002, 2008, 2009, 2011 Free Software
Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
mp_limb_t
mpn_subcnd_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t cnd)
{
mp_limb_t ul, vl, sl, rl, cy, cy1, cy2, mask;
ASSERT (n >= 1);
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
mask = -(mp_limb_t) (cnd != 0);
cy = 0;
do
{
ul = *up++;
vl = *vp++ & mask;
#if GMP_NAIL_BITS == 0
sl = ul - vl;
cy1 = sl > ul;
rl = sl - cy;
cy2 = rl > sl;
cy = cy1 | cy2;
*rp++ = rl;
#else
rl = ul - vl;
rl -= cy;
cy = rl >> (GMP_LIMB_BITS - 1);
*rp++ = rl & GMP_NUMB_MASK;
#endif
}
while (--n != 0);
return cy;
}

View File

@ -1,48 +0,0 @@
/* mpn_tabselect.
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
Copyright 2007, 2008, 2009, 2011 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
/* Select entry `which' from table `tab', which has nents entries, each `n'
limbs. Store the selected entry at rp. Reads entire table to avoid
side-channel information leaks. O(n*nents).
FIXME: Move to its own file. */
void
mpn_tabselect (volatile mp_limb_t *rp, volatile mp_limb_t *tab, mp_size_t n,
mp_size_t nents, mp_size_t which)
{
mp_size_t k, i;
mp_limb_t mask;
volatile mp_limb_t *tp;
for (k = 0; k < nents; k++)
{
mask = -(mp_limb_t) (which == k);
tp = tab + n * k;
for (i = 0; i < n; i++)
{
rp[i] = (rp[i] & ~mask) | (tp[i] & mask);
}
}
}

View File

@ -1,28 +1,39 @@
/* mpn_toom_interpolate_7pts -- Interpolate for toom44, 53, 62.
Contributed to the GNU project by Niels Möller.
Contributed to the GNU project by Niels Möller.
Improvements by Marco Bodrato.
THE FUNCTION IN THIS FILE IS INTERNAL WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
Copyright 2006, 2007, 2009, 2014 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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.
it under the terms of either:
* 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.
or
* the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any
later version.
or both in parallel, as here.
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.
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
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/. */
You should have received copies of the GNU General Public License and the
GNU Lesser General Public License along with the GNU MP Library. If not,
see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
@ -240,7 +251,10 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
cy = mpn_add_n (rp + 5*n, w4 + n, w5, n);
MPN_INCR_U (w5 + n, n + 1, w4[2*n] + cy);
if (w6n > n + 1)
ASSERT_NOCARRY (mpn_add (rp + 6*n, rp + 6*n, w6n, w5 + n, n + 1));
{
cy = mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, n + 1);
MPN_INCR_U (rp + 7*n + 1, w6n - n - 1, cy);
}
else
{
ASSERT_NOCARRY (mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, w6n));

View File

@ -1,9 +0,0 @@
This directory contains mpn functions for Intel i960 processors.
RELEVANT OPTIMIZATION ISSUES
The code in this directory is not well optimized.
STATUS
The code in this directory has not been tested.

View File

@ -1,41 +0,0 @@
# I960 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
# sum in a third limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 4
.globl ___gmpn_add_n
___gmpn_add_n:
mov 0,g6 # clear carry-save register
cmpo 1,0 # clear cy
Loop: subo 1,g3,g3 # update loop counter
ld (g1),g5 # load from s1_ptr
addo 4,g1,g1 # s1_ptr++
ld (g2),g4 # load from s2_ptr
addo 4,g2,g2 # s2_ptr++
cmpo g6,1 # restore cy from g6, relies on cy being 0
addc g4,g5,g4 # main add
subc 0,0,g6 # save cy in g6
st g4,(g0) # store result to res_ptr
addo 4,g0,g0 # res_ptr++
cmpobne 0,g3,Loop # when branch is taken, clears C bit
mov g6,g0
ret

View File

@ -1,46 +0,0 @@
# I960 __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
# the result to a second limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 4
.globl ___gmpn_mul_1
___gmpn_mul_1:
subo g2,0,g2
shlo 2,g2,g4
subo g4,g1,g1
subo g4,g0,g13
mov 0,g0
cmpo 1,0 # clear C bit on AC.cc
Loop: ld (g1)[g2*4],g5
emul g3,g5,g6
ld (g13)[g2*4],g5
addc g0,g6,g6 # relies on that C bit is clear
addc 0,g7,g7
addc g5,g6,g6 # relies on that C bit is clear
st g6,(g13)[g2*4]
addc 0,g7,g0
addo g2,1,g2
cmpobne 0,g2,Loop # when branch is taken, clears C bit
ret

View File

@ -1,43 +0,0 @@
# I960 __gmpn_mul_1 -- Multiply a limb vector with a limb and store
# the result in a second limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 4
.globl ___gmpn_mul_1
___gmpn_mul_1:
subo g2,0,g2
shlo 2,g2,g4
subo g4,g1,g1
subo g4,g0,g13
mov 0,g0
cmpo 1,0 # clear C bit on AC.cc
Loop: ld (g1)[g2*4],g5
emul g3,g5,g6
addc g0,g6,g6 # relies on that C bit is clear
st g6,(g13)[g2*4]
addc 0,g7,g0
addo g2,1,g2
cmpobne 0,g2,Loop # when branch is taken, clears C bit
ret

View File

@ -1,41 +0,0 @@
# I960 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
# store difference in a third limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 4
.globl ___gmpn_sub_n
___gmpn_sub_n:
mov 1,g6 # set carry-save register
cmpo 1,0 # clear cy
Loop: subo 1,g3,g3 # update loop counter
ld (g1),g5 # load from s1_ptr
addo 4,g1,g1 # s1_ptr++
ld (g2),g4 # load from s2_ptr
addo 4,g2,g2 # s2_ptr++
cmpo g6,1 # restore cy from g6, relies on cy being 0
subc g4,g5,g4 # main subtract
subc 0,0,g6 # save cy in g6
st g4,(g0) # store result to res_ptr
addo 4,g0,g0 # res_ptr++
cmpobne 0,g3,Loop # when branch is taken, cy will be 0
mov g6,g0
ret

View File

@ -1,51 +0,0 @@
dnl IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2003, 2004, 2005, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: 3.0
C Itanium 2: 1.5
define(LSH, 1)
define(RSH, 63)
ifdef(`OPERATION_addlsh1_n',`
define(ADDSUB, add)
define(ADDP, 1)
define(CND, ltu)
define(INCR, 1)
define(LIM, -1)
define(func, mpn_addlsh1_n)
')
ifdef(`OPERATION_sublsh1_n',`
define(ADDSUB, sub)
define(CND, gtu)
define(INCR, -1)
define(LIM, 0)
define(func, mpn_sublsh1_n)
')
MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
include_mpn(`ia64/aorslshC_n.asm')

View File

@ -1,51 +0,0 @@
dnl IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2003, 2004, 2005, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: 3.0
C Itanium 2: 1.5
define(LSH, 2)
define(RSH, 62)
ifdef(`OPERATION_addlsh2_n',`
define(ADDSUB, add)
define(ADDP, 1)
define(CND, ltu)
define(INCR, 1)
define(LIM, -1)
define(func, mpn_addlsh2_n)
')
ifdef(`OPERATION_sublsh2_n',`
define(ADDSUB, sub)
define(CND, gtu)
define(INCR, -1)
define(LIM, 0)
define(func, mpn_sublsh2_n)
')
MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
include_mpn(`ia64/aorslshC_n.asm')

View File

@ -1,360 +0,0 @@
dnl IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2003, 2004, 2005, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
C cycles/limb
C Itanium: ?
C Itanium 2: 1.5
C TODO
C * Use shladd in feed-in code (for mpn_addlshC_n).
C INPUT PARAMETERS
define(`rp', `r32')
define(`up', `r33')
define(`vp', `r34')
define(`n', `r35')
define(cmpeqor, `cmp.eq.or')
define(PFDIST, 500)
define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
define(`v0',`r18') define(`v1',`r19') define(`v2',`r20') define(`v3',`r21')
define(`w0',`r22') define(`w1',`r23') define(`w2',`r24') define(`w3',`r25')
define(`s0',`r26') define(`s1',`r27') define(`s2',`r28') define(`s3',`r29')
define(`x0',`r30') define(`x1',`r31') define(`x2',`r30') define(`x3',`r31')
ASM_START()
PROLOGUE(func)
.prologue
.save ar.lc, r2
.body
ifdef(`HAVE_ABI_32',`
addp4 rp = 0, rp C M I
addp4 up = 0, up C M I
addp4 vp = 0, vp C M I
zxt4 n = n C I
;;
')
{.mmi; ld8 r11 = [vp], 8 C M01
ld8 r10 = [up], 8 C M01
mov.i r2 = ar.lc C I0
}{.mmi; and r14 = 3, n C M I
cmp.lt p15, p0 = 4, n C M I
add n = -5, n C M I
;;
}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
cmp.eq p7, p0 = 2, r14 C M I
cmp.eq p8, p0 = 3, r14 C M I
}{.bbb
(p6) br.dptk .Lb01 C B
(p7) br.dptk .Lb10 C B
(p8) br.dptk .Lb11 C B
}
.Lb00: ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
shr.u n = n, 2 C I0
;;
.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shl x3 = r11, LSH C I0
;;
.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shrp x0 = v0, r11, RSH C I0
.mmb; ADDSUB w3 = r10, x3 C M I
nop 0
(p15) br.dpnt .grt4 C B
;;
.mii; cmp.CND p7, p0 = w3, r10 C M I
shrp x1 = v1, v0, RSH C I0
ADDSUB w0 = u0, x0 C M I
;;
.mii; cmp.CND p8, p0 = w0, u0 C M I
shrp x2 = v2, v1, RSH C I0
ADDSUB w1 = u1, x1 C M I
.mmb; nop 0
nop 0
br .Lcj4 C B
ALIGN(32)
.grt4: ld8 v3 = [vp], 8 C M01
shrp x0 = v0, r11, RSH C I0
cmp.CND p8, p0 = w3, r10 C M I
;;
.mmi; ld8 u3 = [up], 8 C M01
add r11 = PFDIST, vp
shrp x1 = v1, v0, RSH C I0
.mmi; ld8 v0 = [vp], 8 C M01
ADDSUB w0 = u0, x0 C M I
nop 0
;;
.mmi; cmp.CND p6, p0 = w0, u0 C M I
add r10 = PFDIST, up
mov.i ar.lc = n C I0
.mmb; ADDSUB w1 = u1, x1 C M I
ld8 u0 = [up], 8 C M01
br .LL00 C B
ALIGN(32)
.Lb01:
ifdef(`ADDP',
` shladd w2 = r11, LSH, r10 C M I
shr.u r8 = r11, RSH C retval I0
(p15) br.dpnt .grt1 C B
;;
',`
shl x2 = r11, LSH C I0
(p15) br.dpnt .grt1 C B
;;
ADDSUB w2 = r10, x2 C M I
shr.u r8 = r11, RSH C retval I0
;;
')
cmp.CND p6, p0 = w2, r10 C M I
br .Lcj1
.grt1: ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shr.u n = n, 2 C I0
;;
ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
mov.i ar.lc = n C FIXME swap with next I0
ifdef(`ADDP',
`',`
ADDSUB w2 = r10, x2
')
;;
.mmi; ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shrp x3 = v3, r11, RSH C I0
;;
.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shrp x0 = v0, v3, RSH C I0
.mmb; cmp.CND p6, p0 = w2, r10 C M I
ADDSUB w3 = u3, x3 C M I
br.cloop.dptk .grt5 C B
;;
.mmi; cmp.CND p7, p0 = w3, u3 C M I
ADDSUB w0 = u0, x0 C M I
shrp x1 = v1, v0, RSH C I0
.mmb; nop 0
nop 0
br .Lcj5 C B
.grt5:
.mmi; add r10 = PFDIST, up
add r11 = PFDIST, vp
shrp x0 = v0, v3, RSH C I0
.mmb; ld8 v3 = [vp], 8 C M01
cmp.CND p8, p0 = w3, u3 C M I
br .LL01 C B
ALIGN(32)
.Lb10: ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shl x1 = r11, LSH C I0
.mmb; nop 0
nop 0
(p15) br.dpnt .grt2 C B
;;
.mmi; ADDSUB w1 = r10, x1 C M I
nop 0
shrp x2 = v2, r11, RSH C I0
;;
.mmi; cmp.CND p9, p0 = w1, r10 C M I
ADDSUB w2 = u2, x2 C M I
shr.u r8 = v2, RSH C retval I0
;;
.mmb; cmp.CND p6, p0 = w2, u2 C M I
nop 0
br .Lcj2 C B
.grt2: ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shr.u n = n, 2 C I0
;;
.mmi; ld8 v0 = [vp], 8 C M01
ld8 u0 = [up], 8 C M01
mov.i ar.lc = n C I0
.mmi; ADDSUB w1 = r10, x1 C M I
nop 0
nop 0
;;
.mii; ld8 v1 = [vp], 8 C M01
shrp x2 = v2, r11, RSH C I0
cmp.CND p8, p0 = w1, r10 C M I
;;
.mmi; add r10 = PFDIST, up
ld8 u1 = [up], 8 C M01
shrp x3 = v3, v2, RSH C I0
.mmi; add r11 = PFDIST, vp
ld8 v2 = [vp], 8 C M01
ADDSUB w2 = u2, x2 C M I
;;
.mmi; cmp.CND p6, p0 = w2, u2 C M I
ld8 u2 = [up], 8 C M01
shrp x0 = v0, v3, RSH C I0
.mbb; ADDSUB w3 = u3, x3 C M I
br.cloop.dpnt L(top) C B
br L(end) C B
.Lb11: ld8 v1 = [vp], 8 C M01
ld8 u1 = [up], 8 C M01
shl x0 = r11, LSH C I0
;;
.mmi; ld8 v2 = [vp], 8 C M01
ld8 u2 = [up], 8 C M01
shr.u n = n, 2 C I0
.mmb; nop 0
nop 0
(p15) br.dpnt .grt3 C B
;;
.mii; nop 0
shrp x1 = v1, r11, RSH C I0
ADDSUB w0 = r10, x0 C M I
;;
.mii; cmp.CND p8, p0 = w0, r10 C M I
shrp x2 = v2, v1, RSH C I0
ADDSUB w1 = u1, x1 C M I
;;
.mmb; cmp.CND p9, p0 = w1, u1 C M I
ADDSUB w2 = u2, x2 C M I
br .Lcj3 C B
.grt3:
.mmi; ld8 v3 = [vp], 8 C M01
ld8 u3 = [up], 8 C M01
shrp x1 = v1, r11, RSH C I0
.mmi; ADDSUB w0 = r10, x0 C M I
nop 0
nop 0
;;
.mmi; ld8 v0 = [vp], 8 C M01
cmp.CND p6, p0 = w0, r10 C M I
mov.i ar.lc = n C I0
.mmi; ld8 u0 = [up], 8 C M01
ADDSUB w1 = u1, x1 C M I
nop 0
;;
.mmi; add r10 = PFDIST, up
add r11 = PFDIST, vp
shrp x2 = v2, v1, RSH C I0
.mmb; ld8 v1 = [vp], 8 C M01
cmp.CND p8, p0 = w1, u1 C M I
br .LL11 C B
C *** MAIN LOOP START ***
ALIGN(32)
L(top): st8 [rp] = w1, 8 C M23
lfetch [r10], 32
(p8) cmpeqor p6, p0 = LIM, w2 C M I
(p8) add w2 = INCR, w2 C M I
ld8 v3 = [vp], 8 C M01
cmp.CND p8, p0 = w3, u3 C M I
;;
.LL01: ld8 u3 = [up], 8 C M01
shrp x1 = v1, v0, RSH C I0
(p6) cmpeqor p8, p0 = LIM, w3 C M I
(p6) add w3 = INCR, w3 C M I
ld8 v0 = [vp], 8 C M01
ADDSUB w0 = u0, x0 C M I
;;
st8 [rp] = w2, 8 C M23
cmp.CND p6, p0 = w0, u0 C M I
nop.b 0
ld8 u0 = [up], 8 C M01
lfetch [r11], 32
ADDSUB w1 = u1, x1 C M I
;;
.LL00: st8 [rp] = w3, 8 C M23
shrp x2 = v2, v1, RSH C I0
(p8) cmpeqor p6, p0 = LIM, w0 C M I
(p8) add w0 = INCR, w0 C M I
ld8 v1 = [vp], 8 C M01
cmp.CND p8, p0 = w1, u1 C M I
;;
.LL11: ld8 u1 = [up], 8 C M01
shrp x3 = v3, v2, RSH C I0
(p6) cmpeqor p8, p0 = LIM, w1 C M I
(p6) add w1 = INCR, w1 C M I
ld8 v2 = [vp], 8 C M01
ADDSUB w2 = u2, x2 C M I
;;
.mmi; st8 [rp] = w0, 8 C M23
cmp.CND p6, p0 = w2, u2 C M I
shrp x0 = v0, v3, RSH C I0
ld8 u2 = [up], 8 C M01
ADDSUB w3 = u3, x3 C M I
br.cloop.dptk L(top) C B
;;
C *** MAIN LOOP END ***
L(end):
.mmi; st8 [rp] = w1, 8 C M23
(p8) cmpeqor p6, p0 = LIM, w2 C M I
shrp x1 = v1, v0, RSH C I0
.mmi;
(p8) add w2 = INCR, w2 C M I
cmp.CND p7, p0 = w3, u3 C M I
ADDSUB w0 = u0, x0 C M I
;;
.Lcj5:
.mmi; st8 [rp] = w2, 8 C M23
(p6) cmpeqor p7, p0 = LIM, w3 C M I
shrp x2 = v2, v1, RSH C I0
.mmi;
(p6) add w3 = INCR, w3 C M I
cmp.CND p8, p0 = w0, u0 C M I
ADDSUB w1 = u1, x1 C M I
;;
.Lcj4:
.mmi; st8 [rp] = w3, 8 C M23
(p7) cmpeqor p8, p0 = LIM, w0 C M I
mov.i ar.lc = r2 C I0
.mmi;
(p7) add w0 = INCR, w0 C M I
cmp.CND p9, p0 = w1, u1 C M I
ADDSUB w2 = u2, x2 C M I
;;
.Lcj3:
.mmi; st8 [rp] = w0, 8 C M23
(p8) cmpeqor p9, p0 = LIM, w1 C M I
shr.u r8 = v2, RSH C I0
.mmi;
(p8) add w1 = INCR, w1 C M I
cmp.CND p6, p0 = w2, u2 C M I
nop 0
;;
.Lcj2:
.mmi; st8 [rp] = w1, 8 C M23
(p9) cmpeqor p6, p0 = LIM, w2 C M I
(p9) add w2 = INCR, w2 C M I
;;
.Lcj1:
.mmb; st8 [rp] = w2 C M23
(p6) add r8 = 1, r8 C M I
br.ret.sptk.many b0 C B
EPILOGUE()
ASM_END()

View File

@ -1,139 +0,0 @@
dnl IA-64 mpn_tabselect.
dnl Copyright 2011 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C Itanium: ?
C Itanium 2: 2.5
C NOTES
C * Using software pipelining could trivially yield 2 c/l without unrolling,
C or 1+epsilon with unrolling. (This code was modelled after the powerpc64
C code, for simplicity.)
C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
define(`rp', `r32')
define(`tp', `r33')
define(`n', `r34')
define(`nents', `r35')
define(`which', `r36')
define(`mask', `r8')
define(`rp1', `r32')
define(`tp1', `r33')
define(`rp2', `r14')
define(`tp2', `r15')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_tabselect)
.prologue
.save ar.lc, r2
.body
ifdef(`HAVE_ABI_32',`
.mmi; addp4 rp = 0, rp C M I
addp4 tp = 0, tp C M I
zxt4 n = n C I
.mii; nop 0
zxt4 nents = nents C I
zxt4 which = which C I
;;
')
.mmi; add rp2 = 8, rp1
add tp2 = 8, tp1
add r6 = -2, n
;;
.mmi; cmp.eq p10, p0 = 1, n
and r9 = 1, n C set cr0 for use in inner loop
shr.u r6 = r6, 1 C inner loop count
;;
.mmi; cmp.eq p8, p0 = 0, r9
sub which = nents, which
shl n = n, 3
;;
L(outer):
.mmi cmp.eq p6, p7 = which, nents C are we at the selected table entry?
nop 0
mov ar.lc = r6 C I0
;;
.mmb;
(p6) mov mask = -1
(p7) mov mask = 0
(p8) br.dptk L(top) C branch to loop entry if n even
;;
.mmi; ld8 r16 = [tp1], 8
add tp2 = 8, tp2
nop 0
;;
.mmi; ld8 r18 = [rp1]
and r16 = r16, mask
nop 0
;;
.mmi; andcm r18 = r18, mask
;;
or r16 = r16, r18
nop 0
;;
.mmb; st8 [rp1] = r16, 8
add rp2 = 8, rp2
(p10) br.dpnt L(end)
ALIGN(32)
L(top):
.mmi; ld8 r16 = [tp1], 16
ld8 r17 = [tp2], 16
nop 0
;;
.mmi; ld8 r18 = [rp1]
and r16 = r16, mask
nop 0
.mmi; ld8 r19 = [rp2]
and r17 = r17, mask
nop 0
;;
.mmi; andcm r18 = r18, mask
andcm r19 = r19, mask
nop 0
;;
.mmi; or r16 = r16, r18
or r17 = r17, r19
nop 0
;;
.mmb; st8 [rp1] = r16, 16
st8 [rp2] = r17, 16
br.cloop.dptk L(top)
;;
L(end):
.mmi; sub rp1 = rp1, n C move rp back to beginning
sub rp2 = rp2, n C move rp back to beginning
cmp.ne p9, p0 = 1, nents
.mmb; add nents = -1, nents
nop 0
(p9) br.dptk L(outer)
;;
.mib; nop 0
nop 0
br.ret.sptk.many b0
EPILOGUE()

View File

@ -1,44 +0,0 @@
# ns32000 __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
# sum in a third limb vector.
# Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.align 1
.globl ___gmpn_add_n
___gmpn_add_n:
save [r3,r4,r5]
negd 28(sp),r3
movd r3,r0
lshd 2,r0
movd 24(sp),r4
subd r0,r4 # r4 -> to end of S2
movd 20(sp),r5
subd r0,r5 # r5 -> to end of S1
movd 16(sp),r2
subd r0,r2 # r2 -> to end of RES
subd r0,r0 # cy = 0
Loop: movd r5[r3:d],r0
addcd r4[r3:d],r0
movd r0,r2[r3:d]
acbd 1,r3,Loop
scsd r0 # r0 = cy.
restore [r5,r4,r3]
ret 0

View File

@ -1,46 +0,0 @@
# ns32000 __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
# the result to a second limb vector.
# Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.align 1
.globl ___gmpn_addmul_1
___gmpn_addmul_1:
save [r3,r4,r5,r6,r7]
negd 24(sp),r4
movd r4,r0
lshd 2,r0
movd 20(sp),r5
subd r0,r5 # r5 -> to end of S1
movd 16(sp),r6
subd r0,r6 # r6 -> to end of RES
subd r0,r0 # r0 = 0, cy = 0
movd 28(sp),r7 # r7 = s2_limb
Loop: movd r5[r4:d],r2
meid r7,r2 # r2 = low_prod, r3 = high_prod
addcd r0,r2 # r2 = low_prod + cy_limb
movd r3,r0 # r0 = new cy_limb
addcd 0,r0
addd r2,r6[r4:d]
acbd 1,r4,Loop
addcd 0,r0
restore [r7,r6,r5,r4,r3]
ret 0

View File

@ -1,45 +0,0 @@
# ns32000 __gmpn_mul_1 -- Multiply a limb vector with a limb and store
# the result in a second limb vector.
# Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.align 1
.globl ___gmpn_mul_1
___gmpn_mul_1:
save [r3,r4,r5,r6,r7]
negd 24(sp),r4
movd r4,r0
lshd 2,r0
movd 20(sp),r5
subd r0,r5 # r5 -> to end of S1
movd 16(sp),r6
subd r0,r6 # r6 -> to end of RES
subd r0,r0 # r0 = 0, cy = 0
movd 28(sp),r7 # r7 = s2_limb
Loop: movd r5[r4:d],r2
meid r7,r2 # r2 = low_prod, r3 = high_prod
addcd r0,r2 # r2 = low_prod + cy_limb
movd r3,r0 # r0 = new cy_limb
movd r2,r6[r4:d]
acbd 1,r4,Loop
addcd 0,r0
restore [r7,r6,r5,r4,r3]
ret 0

View File

@ -1,44 +0,0 @@
# ns32000 __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
# store difference in a third limb vector.
# Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.align 1
.globl ___gmpn_sub_n
___gmpn_sub_n:
save [r3,r4,r5]
negd 28(sp),r3
movd r3,r0
lshd 2,r0
movd 24(sp),r4
subd r0,r4 # r4 -> to end of S2
movd 20(sp),r5
subd r0,r5 # r5 -> to end of S1
movd 16(sp),r2
subd r0,r2 # r2 -> to end of RES
subd r0,r0 # cy = 0
Loop: movd r5[r3:d],r0
subcd r4[r3:d],r0
movd r0,r2[r3:d]
acbd 1,r3,Loop
scsd r0 # r0 = cy.
restore [r5,r4,r3]
ret 0

View File

@ -1,46 +0,0 @@
# ns32000 __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
# the result from a second limb vector.
# Copyright 1992, 1994, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.align 1
.globl ___gmpn_submul_1
___gmpn_submul_1:
save [r3,r4,r5,r6,r7]
negd 24(sp),r4
movd r4,r0
lshd 2,r0
movd 20(sp),r5
subd r0,r5 # r5 -> to end of S1
movd 16(sp),r6
subd r0,r6 # r6 -> to end of RES
subd r0,r0 # r0 = 0, cy = 0
movd 28(sp),r7 # r7 = s2_limb
Loop: movd r5[r4:d],r2
meid r7,r2 # r2 = low_prod, r3 = high_prod
addcd r0,r2 # r2 = low_prod + cy_limb
movd r3,r0 # r0 = new cy_limb
addcd 0,r0
subd r2,r6[r4:d]
acbd 1,r4,Loop
addcd 0,r0
restore [r7,r6,r5,r4,r3]
ret 0

View File

@ -2,31 +2,43 @@ divert(-1)
dnl m4 macros for powerpc32 GNU/Linux assembly.
dnl Copyright 2003, 2005, 2006 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
define(`ASM_START',`')
dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
define(`PROLOGUE_cpu',
m4_assert_numargs(1)
`
m4_assert_numargs_range(1,2)
`ifelse(`$2',toc,,
`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
.section ".text"
.align 3
.globl $1
@ -41,17 +53,18 @@ define(`LEA',
m4_assert_numargs(2)
`ifdef(`PIC',`
mflr r0
bcl 20,31,1f
bcl 20, 31, 1f
1: mflr $1
addis $1, $1, (_GLOBAL_OFFSET_TABLE_-1b)@ha
addi $1, $1, (_GLOBAL_OFFSET_TABLE_-1b)@l
mtlr r0
addis $1,$1,_GLOBAL_OFFSET_TABLE_-1b@ha
addi $1,$1,_GLOBAL_OFFSET_TABLE_-1b@l
lwz $1, $2@got($1)
',`
lis $1, $2@ha
la $1, $2@l($1)
')')
define(`LEAL',
m4_assert_numargs(2)
`LEA($1,$2)')

View File

@ -1,103 +0,0 @@
dnl PowerPC-32 mpn_sqr_diagonal.
dnl Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C 603e: ?
C 604e: 4.0
C 75x (G3): 10.5
C 7400,7410 (G4): 10.5
C 744x,745x (G4+): 4.0
C power4/ppc970: 8.6
C power5: 7.0
C INPUT PARAMETERS
C rp r3
C up r4
C n r5
ASM_START()
PROLOGUE(mpn_sqr_diagonal)
lwz r6,0(r4)
mtctr r5
addi r3,r3,-4
bdz L(end1)
lwzu r7,4(r4)
mullw r9,r6,r6
mulhwu r11,r6,r6
bdz L(end2)
lwzu r6,4(r4)
mullw r8,r7,r7
mulhwu r10,r7,r7
bdz L(ende)
L(loop):
lwzu r7,4(r4)
stw r9,4(r3)
mullw r9,r6,r6
stwu r11,8(r3)
mulhwu r11,r6,r6
bdz L(endo)
lwzu r6,4(r4)
stw r8,4(r3)
mullw r8,r7,r7
stwu r10,8(r3)
mulhwu r10,r7,r7
bdnz L(loop)
L(ende):
stw r9,4(r3)
mullw r9,r6,r6
stw r11,8(r3)
mulhwu r11,r6,r6
stw r8,12(r3)
stw r10,16(r3)
stw r9,20(r3)
stw r11,24(r3)
blr
L(endo):
stw r8,4(r3)
mullw r8,r7,r7
stw r10,8(r3)
mulhwu r10,r7,r7
stw r9,12(r3)
stw r11,16(r3)
stw r8,20(r3)
stw r10,24(r3)
blr
L(end2):
mullw r8,r7,r7
stw r9,4(r3)
mulhwu r10,r7,r7
stw r11,8(r3)
stw r8,12(r3)
stw r10,16(r3)
blr
L(end1):
mullw r9,r6,r6
mulhwu r11,r6,r6
stw r9,4(r3)
stw r11,8(r3)
blr
EPILOGUE(mpn_sqr_diagonal)

View File

@ -1,98 +0,0 @@
dnl PowerPC-32 mpn_tabselect.
dnl Copyright 2011 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C 603e: ?
C 604e: ?
C 75x (G3): ?
C 7400,7410 (G4): ?
C 744x,745x (G4+): ?
C power4/ppc970: 3.3
C power5: ?
C NOTES
C * This has not been tuned for any specific processor. Its speed should not
C be too bad, though.
C * Using VMX could result in significant speedup for certain CPUs.
C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
define(`rp', `r3')
define(`tp', `r4')
define(`n', `r5')
define(`nents', `r6')
define(`which', `r7')
define(`mask', `r8')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_tabselect)
addi r0, n, 1
srwi r0, r0, 1 C inner loop count
andi. r9, n, 1 C set cr0 for use in inner loop
subf which, nents, which
slwi n, n, 2
L(outer):
mtctr r0 C put inner loop count in ctr
add r9, which, nents C are we at the selected table entry?
addic r9, r9, -1 C set CF iff not selected entry
subfe mask, r0, r0
beq cr0, L(top) C branch to loop entry if n even
lwz r9, 0(tp)
addi tp, tp, 4
and r9, r9, mask
lwz r11, 0(rp)
andc r11, r11, mask
or r9, r9, r11
stw r9, 0(rp)
addi rp, rp, 4
bdz L(end)
ALIGN(16)
L(top): lwz r9, 0(tp)
lwz r10, 4(tp)
addi tp, tp, 8
nop
and r9, r9, mask
and r10, r10, mask
lwz r11, 0(rp)
lwz r12, 4(rp)
andc r11, r11, mask
andc r12, r12, mask
or r9, r9, r11
or r10, r10, r12
stw r9, 0(rp)
stw r10, 4(rp)
addi rp, rp, 8
bdnz L(top)
L(end): subf rp, n, rp C move rp back to beginning
cmpwi cr6, nents, 1
addi nents, nents, -1
bne cr6, L(outer)
blr
EPILOGUE()

View File

@ -1,185 +0,0 @@
dnl PowerPC-64 mpn_addcnd_n/mpn_subcnd_n.
dnl Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2007, 2011, 2012 Free
dnl Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630 ?
C POWER4/PPC970 2.25
C POWER5 ?
C POWER6 3
C POWER7 ?
C INPUT PARAMETERS
define(`rp', `r3')
define(`up', `r4')
define(`vp', `r5')
define(`n', `r6')
define(`cnd', `r7')
ifdef(`OPERATION_addcnd_n',`
define(ADDSUBC, adde)
define(ADDSUB, addc)
define(func, mpn_addcnd_n)
define(GENRVAL, `addi r3, r3, 1')
define(SETCBR, `addic r0, $1, -1')
define(CLRCB, `addic r0, r0, 0')
')
ifdef(`OPERATION_subcnd_n',`
define(ADDSUBC, subfe)
define(ADDSUB, subfc)
define(func, mpn_subcnd_n)
define(GENRVAL, `neg r3, r3')
define(SETCBR, `subfic r0, $1, 0')
define(CLRCB, `addic r0, r1, -1')
')
MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
ASM_START()
PROLOGUE(func)
std r31, -8(r1)
std r30, -16(r1)
std r29, -24(r1)
std r28, -32(r1)
std r27, -40(r1)
subfic cnd, cnd, 0
subfe cnd, cnd, cnd
rldicl. r0, r6, 0,62 C r0 = n & 3, set cr0
cmpdi cr6, r0, 2
addi r6, r6, 3 C compute count...
srdi r6, r6, 2 C ...for ctr
mtctr r6 C copy count into ctr
beq cr0, L(b00)
blt cr6, L(b01)
beq cr6, L(b10)
L(b11): ld r8, 0(up) C load s1 limb
ld r9, 0(vp) C load s2 limb
ld r10, 8(up) C load s1 limb
ld r11, 8(vp) C load s2 limb
ld r12, 16(up) C load s1 limb
addi up, up, 24
ld r0, 16(vp) C load s2 limb
addi vp, vp, 24
and r9, r9, cnd
and r11, r11, cnd
and r0, r0, cnd
ADDSUB r29, r9, r8
ADDSUBC r30, r11, r10
ADDSUBC r31, r0, r12
std r29, 0(rp)
std r30, 8(rp)
std r31, 16(rp)
addi rp, rp, 24
bdnz L(go)
b L(ret)
L(b01): ld r12, 0(up) C load s1 limb
addi up, up, 8
ld r0, 0(vp) C load s2 limb
addi vp, vp, 8
and r0, r0, cnd
ADDSUB r31, r0, r12 C add
std r31, 0(rp)
addi rp, rp, 8
bdnz L(go)
b L(ret)
L(b10): ld r10, 0(up) C load s1 limb
ld r11, 0(vp) C load s2 limb
ld r12, 8(up) C load s1 limb
addi up, up, 16
ld r0, 8(vp) C load s2 limb
addi vp, vp, 16
and r11, r11, cnd
and r0, r0, cnd
ADDSUB r30, r11, r10 C add
ADDSUBC r31, r0, r12 C add
std r30, 0(rp)
std r31, 8(rp)
addi rp, rp, 16
bdnz L(go)
b L(ret)
L(b00): CLRCB C clear/set cy
L(go): ld r6, 0(up) C load s1 limb
ld r27, 0(vp) C load s2 limb
ld r8, 8(up) C load s1 limb
ld r9, 8(vp) C load s2 limb
ld r10, 16(up) C load s1 limb
ld r11, 16(vp) C load s2 limb
ld r12, 24(up) C load s1 limb
ld r0, 24(vp) C load s2 limb
and r27, r27, cnd
and r9, r9, cnd
and r11, r11, cnd
and r0, r0, cnd
bdz L(end)
addi up, up, 32
addi vp, vp, 32
L(top): ADDSUBC r28, r27, r6
ld r6, 0(up) C load s1 limb
ld r27, 0(vp) C load s2 limb
ADDSUBC r29, r9, r8
ld r8, 8(up) C load s1 limb
ld r9, 8(vp) C load s2 limb
ADDSUBC r30, r11, r10
ld r10, 16(up) C load s1 limb
ld r11, 16(vp) C load s2 limb
ADDSUBC r31, r0, r12
ld r12, 24(up) C load s1 limb
ld r0, 24(vp) C load s2 limb
std r28, 0(rp)
addi up, up, 32
std r29, 8(rp)
addi vp, vp, 32
std r30, 16(rp)
std r31, 24(rp)
addi rp, rp, 32
and r27, r27, cnd
and r9, r9, cnd
and r11, r11, cnd
and r0, r0, cnd
bdnz L(top) C decrement ctr and loop back
L(end): ADDSUBC r28, r27, r6
ADDSUBC r29, r9, r8
ADDSUBC r30, r11, r10
ADDSUBC r31, r0, r12
std r28, 0(rp)
std r29, 8(rp)
std r30, 16(rp)
std r31, 24(rp)
L(ret): ld r31, -8(r1)
ld r30, -16(r1)
ld r29, -24(r1)
ld r28, -32(r1)
ld r27, -40(r1)
subfe r3, r0, r0 C -cy
GENRVAL
blr
EPILOGUE()

View File

@ -1,44 +0,0 @@
dnl PowerPC-64 mpn_addlsh1_n and mpn_sublsh1_n.
dnl Copyright 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
define(LSH, 1)
define(RSH, 63)
ifdef(`OPERATION_addlsh1_n',`
define(ADDSUBC, addc)
define(ADDSUBE, adde)
define(INITCY, `addic $1, r1, 0')
define(RETVAL, `addze r3, $1')
define(func, mpn_addlsh1_n)
')
ifdef(`OPERATION_sublsh1_n',`
define(ADDSUBC, subfc)
define(ADDSUBE, subfe)
define(INITCY, `addic $1, r1, -1')
define(RETVAL, `subfze r3, $1
neg r3, r3')
define(func, mpn_sublsh1_n)
')
MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
include_mpn(`powerpc64/mode64/aorslshC_n.asm')

View File

@ -1,44 +0,0 @@
dnl PowerPC-64 mpn_addlsh2_n and mpn_sublsh2_n.
dnl Copyright 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
define(LSH, 2)
define(RSH, 62)
ifdef(`OPERATION_addlsh2_n',`
define(ADDSUBC, addc)
define(ADDSUBE, adde)
define(INITCY, `addic $1, r1, 0')
define(RETVAL, `addze r3, $1')
define(func, mpn_addlsh2_n)
')
ifdef(`OPERATION_sublsh2_n',`
define(ADDSUBC, subfc)
define(ADDSUBE, subfe)
define(INITCY, `addic $1, r1, -1')
define(RETVAL, `subfze r3, $1
neg r3, r3')
define(func, mpn_sublsh2_n)
')
MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
include_mpn(`powerpc64/mode64/aorslshC_n.asm')

View File

@ -1,156 +0,0 @@
dnl PowerPC-64 mpn_addlshC_n and mpn_sublshC_n, where C is a small constant.
dnl Copyright 2003, 2005, 2009, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
C cycles/limb
C POWER3/PPC630 1.83 (1.5 c/l should be possible)
C POWER4/PPC970 3 (2.0 c/l should be possible)
C POWER5 3
C POWER6 3.5-47
C POWER7 3
C STATUS
C * Try combining upx+up, and vpx+vp.
C * The worst case 47 c/l for POWER6 happens if the 3rd operand for ldx is
C greater than the 2nd operand. Yes, this addition is non-commutative wrt
C performance.
C INPUT PARAMETERS
define(`rp', `r3')
define(`up', `r4')
define(`vp', `r5')
define(`n', `r6')
define(`rpx', `r6')
define(`upx', `r7')
define(`vpx', `r12')
define(`s0', `r0') define(`s1', `r9')
define(`u0', `r8')
define(`v0', `r10') define(`v1', `r11')
ASM_START()
PROLOGUE(func)
cmpldi cr0, n, 13
bgt L(big)
mtctr n C copy n in ctr
INITCY( r0) C clear cy
ld v0, 0(vp) C load v limb
ld u0, 0(up) C load u limb
addi up, up, -8 C update up
addi rp, rp, -8 C update rp
sldi s1, v0, LSH
bdz L(ex1) C If done, skip loop
ALIGN(16)
L(lo0): ld v1, 8(vp) C load v limb
ADDSUBE s1, s1, u0 C add limbs with cy, set cy
ldu u0, 16(up) C load u limb and update up
srdi s0, v0, RSH C shift down previous v limb
std s1, 8(rp) C store result limb
rldimi s0, v1, LSH, 0 C left shift v limb and merge with prev v limb
bdz L(ex0) C decrement ctr and exit if done
ldu v0, 16(vp) C load v limb and update vp
ADDSUBE s0, s0, u0 C add limbs with cy, set cy
ld u0, 8(up) C load u limb
srdi s1, v1, RSH C shift down previous v limb
stdu s0, 16(rp) C store result limb and update rp
rldimi s1, v0, LSH, 0 C left shift v limb and merge with prev v limb
bdnz L(lo0) C decrement ctr and loop back
L(ex1): ADDSUBE r7, s1, u0
std r7, 8(rp) C store last result limb
srdi r0, v0, RSH
RETVAL( r0)
blr
L(ex0): ADDSUBE r7, s0, u0
std r7, 16(rp) C store last result limb
srdi r0, v1, RSH
RETVAL( r0)
blr
L(big): rldicl. r0, n, 0,63 C r0 = n & 1, set cr0
addi r6, n, -1 C ...for ctr
srdi r6, r6, 1 C ...for ctr
mtctr r6 C copy count into ctr
beq cr0, L(b0)
L(b1): ld v1, 0(vp)
ld u0, 0(up)
sldi s1, v1, LSH
srdi s0, v1, RSH
ld v0, 8(vp)
ADDSUBC s1, s1, u0 C add limbs without cy, set cy
addi rpx, rp, -16
addi rp, rp, -8
sub upx, up, rp
sub vpx, vp, rp
sub up, up, rpx
sub vp, vp, rpx
addi up, up, 8
addi upx, upx, 16
addi vp, vp, 16
addi vpx, vpx, 24
b L(mid)
L(b0): ld v0, 0(vp)
ld u0, 0(up)
sldi s0, v0, LSH
srdi s1, v0, RSH
ld v1, 8(vp)
ADDSUBC s0, s0, u0 C add limbs without cy, set cy
addi rpx, rp, -8
addi rp, rp, -16
sub upx, up, rpx
sub vpx, vp, rpx
sub up, up, rp
sub vp, vp, rp
addi up, up, 8
addi upx, upx, 16
addi vp, vp, 16
addi vpx, vpx, 24
ALIGN(32)
L(top): ldx u0, rp, up
ldx v0, rp, vp
rldimi s1, v1, LSH, 0
stdu s0, 16(rp)
srdi s0, v1, RSH
ADDSUBE s1, s1, u0 C add limbs with cy, set cy
L(mid): ldx u0, rpx, upx
ldx v1, rpx, vpx
rldimi s0, v0, LSH, 0
stdu s1, 16(rpx)
srdi s1, v0, RSH
ADDSUBE s0, s0, u0 C add limbs with cy, set cy
bdnz L(top) C decrement CTR and loop back
ldx u0, rp, up
rldimi s1, v1, LSH, 0
std s0, 16(rp)
srdi s0, v1, RSH
ADDSUBE s1, s1, u0 C add limbs with cy, set cy
std s1, 24(rp)
RETVAL( r0)
blr
EPILOGUE()

View File

@ -1,102 +0,0 @@
dnl PowerPC-64 mpn_rsh1add_n -- rp[] = (up[] + vp[]) >> 1
dnl Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630 2 (1.5 c/l should be possible)
C POWER4/PPC970 4 (2.0 c/l should be possible)
C POWER5 3.5 (2.0 c/l should be possible)
C POWER6 4.5
C POWER7 3.5
define(`rp',`r3')
define(`up',`r4')
define(`vp',`r5')
define(`s0',`r6')
define(`s1',`r7')
define(`x',`r0')
define(`u0',`r8')
define(`u1',`r9')
define(`v0',`r10')
define(`v1',`r11')
ASM_START()
PROLOGUE(mpn_rsh1add_n)
mtctr r6 C copy size to count register
addi rp, rp, -8
ld u1, 0(up)
ld v1, 0(vp)
addc x, v1, u1
rldicl r12, x, 0, 63 C return value
srdi s1, x, 1
bdz L(1)
ld u0, 8(up)
ld v0, 8(vp)
bdz L(end)
ALIGN(32)
L(top): ldu u1, 16(up)
ldu v1, 16(vp)
adde x, v0, u0
srdi s0, x, 1
rldimi s1, x, 63, 0
std s1, 8(rp)
bdz L(exi)
ld u0, 8(up)
ld v0, 8(vp)
adde x, v1, u1
srdi s1, x, 1
rldimi s0, x, 63, 0
stdu s0, 16(rp)
bdnz L(top)
L(end): adde x, v0, u0
srdi s0, x, 1
rldimi s1, x, 63, 0
std s1, 8(rp)
li x, 0
addze x, x
rldimi s0, x, 63, 0
std s0, 16(rp)
mr r3, r12
blr
L(exi): adde x, v1, u1
srdi s1, x, 1
rldimi s0, x, 63, 0
stdu s0, 16(rp)
L(1): li x, 0
addze x, x
rldimi s1, x, 63, 0
std s1, 8(rp)
mr r3, r12
blr
EPILOGUE()

View File

@ -1,100 +0,0 @@
dnl PowerPC-64 mpn_rsh1sub_n -- rp[] = (up[] - vp[]) >> 1
dnl Copyright 2003, 2005, 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630 2 (1.5 c/l should be possible)
C POWER4/PPC970 4 (2.0 c/l should be possible)
C POWER5 3.5 (2.0 c/l should be possible)
C POWER6 4.5
C POWER7 3.5
define(`rp',`r3')
define(`up',`r4')
define(`vp',`r5')
define(`s0',`r6')
define(`s1',`r7')
define(`x',`r0')
define(`u0',`r8')
define(`u1',`r9')
define(`v0',`r10')
define(`v1',`r11')
ASM_START()
PROLOGUE(mpn_rsh1sub_n)
mtctr r6 C copy size to count register
addi rp, rp, -8
ld u1, 0(up)
ld v1, 0(vp)
subfc x, v1, u1
rldicl r12, x, 0, 63 C return value
srdi s1, x, 1
bdz L(1)
ld u0, 8(up)
ld v0, 8(vp)
bdz L(end)
ALIGN(32)
L(top): ldu u1, 16(up)
ldu v1, 16(vp)
subfe x, v0, u0
srdi s0, x, 1
rldimi s1, x, 63, 0
std s1, 8(rp)
bdz L(exi)
ld u0, 8(up)
ld v0, 8(vp)
subfe x, v1, u1
srdi s1, x, 1
rldimi s0, x, 63, 0
stdu s0, 16(rp)
bdnz L(top)
L(end): subfe x, v0, u0
srdi s0, x, 1
rldimi s1, x, 63, 0
std s1, 8(rp)
subfe x, x, x
rldimi s0, x, 63, 0
std s0, 16(rp)
mr r3, r12
blr
L(exi): subfe x, v1, u1
srdi s1, x, 1
rldimi s0, x, 63, 0
stdu s0, 16(rp)
L(1): subfe x, x, x
rldimi s1, x, 63, 0
std s1, 8(rp)
mr r3, r12
blr
EPILOGUE()

View File

@ -1,96 +0,0 @@
dnl PowerPC-64 mpn_tabselect.
dnl Copyright 2011 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C POWER3/PPC630 ?
C POWER4/PPC970 3.3
C POWER5 ?
C POWER6 ?
C POWER7 2.5
C NOTES
C * This has not been tuned for any specific processor. Its speed should not
C be too bad, though.
C * Using VMX could result in significant speedup for certain CPUs.
C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
define(`rp', `r3')
define(`tp', `r4')
define(`n', `r5')
define(`nents', `r6')
define(`which', `r7')
define(`mask', `r8')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_tabselect)
addi r0, n, 1
srdi r0, r0, 1 C inner loop count
andi. r9, n, 1 C set cr0 for use in inner loop
subf which, nents, which
sldi n, n, 3
L(outer):
mtctr r0 C put inner loop count in ctr
add r9, which, nents C are we at the selected table entry?
addic r9, r9, -1 C set CF iff not selected entry
subfe mask, r0, r0
beq cr0, L(top) C branch to loop entry if n even
ld r9, 0(tp)
addi tp, tp, 8
and r9, r9, mask
ld r11, 0(rp)
andc r11, r11, mask
or r9, r9, r11
std r9, 0(rp)
addi rp, rp, 8
bdz L(end)
ALIGN(16)
L(top): ld r9, 0(tp)
ld r10, 8(tp)
addi tp, tp, 16
nop
and r9, r9, mask
and r10, r10, mask
ld r11, 0(rp)
ld r12, 8(rp)
andc r11, r11, mask
andc r12, r12, mask
or r9, r9, r11
or r10, r10, r12
std r9, 0(rp)
std r10, 8(rp)
addi rp, rp, 16
bdnz L(top)
L(end): subf rp, n, rp C move rp back to beginning
cmpdi cr6, nents, 1
addi nents, nents, -1
bne cr6, L(outer)
blr
EPILOGUE()

View File

@ -1,74 +0,0 @@
# Pyramid __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
# sum in a third limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 2
.globl ___gmpn_add_n
___gmpn_add_n:
movw $-1,tr0 # representation for carry clear
movw pr3,tr2
andw $3,tr2
beq Lend0
subw tr2,pr3
Loop0: rsubw $0,tr0 # restore carry bit from carry-save register
movw (pr1),tr1
addwc (pr2),tr1
movw tr1,(pr0)
subwb tr0,tr0
addw $4,pr0
addw $4,pr1
addw $4,pr2
addw $-1,tr2
bne Loop0
mtstw pr3,pr3
beq Lend
Lend0:
Loop: rsubw $0,tr0 # restore carry bit from carry-save register
movw (pr1),tr1
addwc (pr2),tr1
movw tr1,(pr0)
movw 4(pr1),tr1
addwc 4(pr2),tr1
movw tr1,4(pr0)
movw 8(pr1),tr1
addwc 8(pr2),tr1
movw tr1,8(pr0)
movw 12(pr1),tr1
addwc 12(pr2),tr1
movw tr1,12(pr0)
subwb tr0,tr0
addw $16,pr0
addw $16,pr1
addw $16,pr2
addw $-4,pr3
bne Loop
Lend:
mnegw tr0,pr0
ret

View File

@ -1,43 +0,0 @@
# Pyramid __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
# the result to a second limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 2
.globl ___gmpn_addmul_1
___gmpn_addmul_1:
mova (pr0)[pr2*4],pr0
mova (pr1)[pr2*4],pr1
mnegw pr2,pr2
movw $0,tr3
Loop: movw (pr1)[pr2*4],tr1
uemul pr3,tr0
addw tr3,tr1
movw $0,tr3
addwc tr0,tr3
movw (pr0)[pr2*0x4],tr0
addw tr0,tr1
addwc $0,tr3
movw tr1,(pr0)[pr2*4]
addw $1,pr2
bne Loop
movw tr3,pr0
ret

View File

@ -1,40 +0,0 @@
# Pyramid __gmpn_mul_1 -- Multiply a limb vector with a limb and store
# the result in a second limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 2
.globl ___gmpn_mul_1
___gmpn_mul_1:
mova (pr0)[pr2*4],pr0
mova (pr1)[pr2*4],pr1
mnegw pr2,pr2
movw $0,tr3
Loop: movw (pr1)[pr2*4],tr1
uemul pr3,tr0
addw tr3,tr1
movw $0,tr3
addwc tr0,tr3
movw tr1,(pr0)[pr2*4]
addw $1,pr2
bne Loop
movw tr3,pr0
ret

View File

@ -1,74 +0,0 @@
# Pyramid __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and
# store difference in a third limb vector.
# Copyright 1995, 2000 Free Software Foundation, Inc.
# This file is part of the GNU MP Library.
# 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 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 Lesser General Public License
# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
.text
.align 2
.globl ___gmpn_sub_n
___gmpn_sub_n:
movw $-1,tr0 # representation for carry clear
movw pr3,tr2
andw $3,tr2
beq Lend0
subw tr2,pr3
Loop0: rsubw $0,tr0 # restore carry bit from carry-save register
movw (pr1),tr1
subwb (pr2),tr1
movw tr1,(pr0)
subwb tr0,tr0
addw $4,pr0
addw $4,pr1
addw $4,pr2
addw $-1,tr2
bne Loop0
mtstw pr3,pr3
beq Lend
Lend0:
Loop: rsubw $0,tr0 # restore carry bit from carry-save register
movw (pr1),tr1
subwb (pr2),tr1
movw tr1,(pr0)
movw 4(pr1),tr1
subwb 4(pr2),tr1
movw tr1,4(pr0)
movw 8(pr1),tr1
subwb 8(pr2),tr1
movw tr1,8(pr0)
movw 12(pr1),tr1
subwb 12(pr2),tr1
movw tr1,12(pr0)
subwb tr0,tr0
addw $16,pr0
addw $16,pr1
addw $16,pr2
addw $-4,pr3
bne Loop
Lend:
mnegw tr0,pr0
ret

View File

@ -0,0 +1,140 @@
dnl SPARC v9 mpn_lshift
dnl Contributed to the GNU project by David Miller.
dnl Copyright 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC 1&2: 2
C UltraSPARC 3: 2.5
C UltraSPARC T1: 17.5
C UltraSPARC T3: 8
C UltraSPARC T4: 3
C INPUT PARAMETERS
define(`rp', `%i0')
define(`up', `%i1')
define(`n', `%i2')
define(`cnt', `%i3')
define(`tcnt', `%i4')
define(`retval', `%i5')
define(`u0', `%l0')
define(`u1', `%l1')
define(`r0', `%l6')
define(`r1', `%l7')
define(`u0_off', `%o0')
define(`u1_off', `%o1')
define(`r0_off', `%o2')
define(`r1_off', `%o3')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_lshift)
save %sp, -176, %sp
sllx n, 3, n
sub %g0, cnt, tcnt
sub up, 8, u1_off
add rp, (5 * 8), r1_off
ldx [n + u1_off], u1 C WAS: up - 8
add u1_off, (3 * 8), u1_off
sub r1_off, 8, r0_off
sub u1_off, 8, u0_off
subcc n, (3 * 8), n
srlx u1, tcnt, retval
bl,pn %xcc, L(end12)
sllx u1, cnt, %l3
ldx [n + u0_off], u0 C WAS: up - 16
subcc n, (2 * 8), n
ldx [n + u1_off], u1 C WAS: up - 24
bl,pn %xcc, L(end34)
srlx u0, tcnt, %l4
b,a L(top)
ALIGN(16)
L(top):
sllx u0, cnt, %l2
or %l4, %l3, r0
ldx [n + u0_off], u0 C WAS: up - 16
srlx u1, tcnt, %l5
stx r0, [n + r0_off] C WAS: rp - 8
subcc n, (2 * 8), n
sllx u1, cnt, %l3
or %l2, %l5, r1
ldx [n + u1_off], u1 C WAS: up - 24
srlx u0, tcnt, %l4
bge,pt %xcc, L(top)
stx r1, [n + r1_off] C WAS: rp - 16
L(end34):
sllx u0, cnt, %l2
or %l4, %l3, r0
srlx u1, tcnt, %l5
stx r0, [n + r0_off] C WAS: rp - 8
or %l2, %l5, r1
sub n, (2 * 8), %o5
sllx u1, cnt, %l3
stx r1, [%o5 + r1_off] C WAS: rp - 16
L(end12):
andcc n, 8, %g0
bz,pn %xcc, L(done)
nop
ldx [n + u0_off], u1
srlx u1, tcnt, %l4
or %l4, %l3, r0
stx r0, [r0_off - 24]
sllx u1, cnt, %l3
L(done):
stx %l3, [r0_off - 32]
ret
restore retval, 0, %o0
EPILOGUE()

View File

@ -0,0 +1,142 @@
dnl SPARC v9 mpn_rshift
dnl Contributed to the GNU project by David Miller.
dnl Copyright 2013 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC 1&2: 2
C UltraSPARC 3: 2.5
C UltraSPARC T1: 17.5
C UltraSPARC T3: 8
C UltraSPARC T4: 3
C INPUT PARAMETERS
define(`rp', `%i0')
define(`up', `%i1')
define(`n', `%i2')
define(`cnt', `%i3')
define(`tcnt', `%i4')
define(`retval', `%i5')
define(`u0', `%l0')
define(`u1', `%l1')
define(`r0', `%l6')
define(`r1', `%l7')
define(`u0_off', `%o0')
define(`u1_off', `%o1')
define(`r0_off', `%o2')
define(`r1_off', `%o3')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_rshift)
save %sp, -176, %sp
sllx n, 3, n
sub %g0, cnt, tcnt
add up, n, up
add rp, n, rp
neg n, n
sub up, (2 * 8), u0_off
sub rp, (5 * 8), r0_off
ldx [n + up], u1 C WAS: up + 0
sub u0_off, (1 * 8), u1_off
sub r0_off, (1 * 8), r1_off
subcc n, -(3 * 8), n
sllx u1, tcnt, retval
bg,pn %xcc, L(end12)
srlx u1, cnt, %l3
ldx [n + u0_off], u0 C WAS: up + 0
subcc n, -(2 * 8), n
ldx [n + u1_off], u1 C WAS: up + 8
bg,pn %xcc, L(end34)
sllx u0, tcnt, %l4
b,a L(top)
ALIGN(16)
L(top):
srlx u0, cnt, %l2
or %l3, %l4, r0
ldx [n + u0_off], u0 C WAS: up + 0
sllx u1, tcnt, %l5
stx r0, [n + r0_off] C WAS: rp + 0
subcc n, -(2 * 8), n
srlx u1, cnt, %l3
or %l2, %l5, r1
ldx [n + u1_off], u1 C WAS: up + 8
sllx u0, tcnt, %l4
ble,pt %xcc, L(top)
stx r1, [n + r1_off] C WAS: rp + 8
L(end34):
srlx u0, cnt, %l2
or %l3, %l4, r0
sllx u1, tcnt, %l5
stx r0, [n + r0_off] C WAS: rp + 0
or %l2, %l5, r1
sub n, -(2 * 8), %o5
srlx u1, cnt, %l3
stx r1, [%o5 + r1_off] C WAS: rp + 8
L(end12):
andcc n, 8, %g0
bz,pn %xcc, L(done)
nop
ldx [n + u0_off], u1
sllx u1, tcnt, %l4
or %l3, %l4, r0
stx r0, [r0_off + 24]
srlx u1, cnt, %l3
L(done):
stx %l3, [r0_off + 32]
ret
restore retval, 0, %o0
EPILOGUE()

View File

@ -1,150 +0,0 @@
dnl SPARC v9 mpn_lshift
dnl Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
dnl Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC 1&2: 2
C UltraSPARC 3: 2.5
C INPUT PARAMETERS
define(`rp', `%i0')
define(`up', `%i1')
define(`n', `%i2')
define(`cnt',`%i3')
define(`u0', `%l0')
define(`u1', `%l2')
define(`u2', `%l4')
define(`u3', `%l6')
define(`tnc',`%i4')
define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_lshift)
save %sp,-160,%sp
sllx n,3,%g1
sub %g0,cnt,tnc C negate shift count
add up,%g1,up C make %o1 point at end of src
add rp,%g1,rp C make %o0 point at end of res
ldx [up-8],u3 C load first limb
subcc n,5,n
srlx u3,tnc,%i5 C compute function result
bl,pn %xcc,.Lend1234
sllx u3,cnt,%g3
subcc n,4,n
ldx [up-16],u0
ldx [up-24],u1
add up,-32,up
ldx [up-0],u2
ldx [up-8],u3
bl,pn %xcc,.Lend5678
srlx u0,tnc,%g2
b,a .Loop
ALIGN(16)
.Loop:
sllx u0,cnt,%g1
or %g3,%g2,%g3
ldx [up-16],u0
fanop
C --
srlx u1,tnc,%g2
subcc n,4,n
stx %g3,[rp-8]
fanop
C --
sllx u1,cnt,%g3
or %g1,%g2,%g1
ldx [up-24],u1
fanop
C --
srlx u2,tnc,%g2
stx %g1,[rp-16]
add up,-32,up
fanop
C --
sllx u2,cnt,%g1
or %g3,%g2,%g3
ldx [up-0],u2
fanop
C --
srlx u3,tnc,%g2
stx %g3,[rp-24]
add rp,-32,rp
fanop
C --
sllx u3,cnt,%g3
or %g1,%g2,%g1
ldx [up-8],u3
fanop
C --
srlx u0,tnc,%g2
stx %g1,[rp-0]
bge,pt %xcc,.Loop
fanop
C --
.Lend5678:
sllx u0,cnt,%g1
or %g3,%g2,%g3
srlx u1,tnc,%g2
stx %g3,[rp-8]
sllx u1,cnt,%g3
or %g1,%g2,%g1
srlx u2,tnc,%g2
stx %g1,[rp-16]
sllx u2,cnt,%g1
or %g3,%g2,%g3
srlx u3,tnc,%g2
stx %g3,[rp-24]
add rp,-32,rp
sllx u3,cnt,%g3 C carry...
or %g1,%g2,%g1
stx %g1,[rp-0]
.Lend1234:
addcc n,4,n
bz,pn %xcc,.Lret
fanop
.Loop0:
add rp,-8,rp
subcc n,1,n
ldx [up-16],u3
add up,-8,up
srlx u3,tnc,%g2
or %g3,%g2,%g3
stx %g3,[rp]
sllx u3,cnt,%g3
bnz,pt %xcc,.Loop0
fanop
.Lret:
stx %g3,[rp-8]
mov %i5,%i0
ret
restore
EPILOGUE(mpn_lshift)

View File

@ -1,147 +0,0 @@
dnl SPARC v9 mpn_rshift
dnl Copyright 1996, 2000, 2001, 2002, 2003, 2010 Free Software Foundation,
dnl Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC 1&2: 2
C UltraSPARC 3: 2.5 (for some up/rp alignments)
C INPUT PARAMETERS
define(`rp', `%i0')
define(`up', `%i1')
define(`n', `%i2')
define(`cnt',`%i3')
define(`u0', `%l0')
define(`u1', `%l2')
define(`u2', `%l4')
define(`u3', `%l6')
define(`tnc',`%i4')
define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_rshift)
save %sp,-160,%sp
sub %g0,cnt,tnc C negate shift count
ldx [up],u3 C load first limb
subcc n,5,n
sllx u3,tnc,%i5 C compute function result
bl,pn %xcc,.Lend1234
srlx u3,cnt,%g3
subcc n,4,n
ldx [up+8],u0
ldx [up+16],u1
add up,32,up
ldx [up-8],u2
ldx [up+0],u3
bl,pn %xcc,.Lend5678
sllx u0,tnc,%g2
b,a .Loop
ALIGN(16)
.Loop:
srlx u0,cnt,%g1
or %g3,%g2,%g3
ldx [up+8],u0
fanop
C --
sllx u1,tnc,%g2
subcc n,4,n
stx %g3,[rp+0]
fanop
C --
srlx u1,cnt,%g3
or %g1,%g2,%g1
ldx [up+16],u1
fanop
C --
sllx u2,tnc,%g2
stx %g1,[rp+8]
add up,32,up
fanop
C --
srlx u2,cnt,%g1
or %g3,%g2,%g3
ldx [up-8],u2
fanop
C --
sllx u3,tnc,%g2
stx %g3,[rp+16]
add rp,32,rp
fanop
C --
srlx u3,cnt,%g3
or %g1,%g2,%g1
ldx [up+0],u3
fanop
C --
sllx u0,tnc,%g2
stx %g1,[rp-8]
bge,pt %xcc,.Loop
fanop
C --
.Lend5678:
srlx u0,cnt,%g1
or %g3,%g2,%g3
sllx u1,tnc,%g2
stx %g3,[rp+0]
srlx u1,cnt,%g3
or %g1,%g2,%g1
sllx u2,tnc,%g2
stx %g1,[rp+8]
srlx u2,cnt,%g1
or %g3,%g2,%g3
sllx u3,tnc,%g2
stx %g3,[rp+16]
add rp,32,rp
srlx u3,cnt,%g3 C carry...
or %g1,%g2,%g1
stx %g1,[rp-8]
.Lend1234:
addcc n,4,n
bz,pn %xcc,.Lret
fanop
.Loop0:
add rp,8,rp
subcc n,1,n
ldx [up+8],u3
add up,8,up
sllx u3,tnc,%g2
or %g3,%g2,%g3
stx %g3,[rp-8]
srlx u3,cnt,%g3
bnz,pt %xcc,.Loop0
fanop
.Lret:
stx %g3,[rp+0]
mov %i5,%i0
ret
restore
EPILOGUE(mpn_rshift)

View File

@ -1,59 +0,0 @@
dnl SPARC v9 mpn_lshift for T1/T2.
dnl Copyright 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC T1: 17
C UltraSPARC T2: ?
C INPUT PARAMETERS
define(`rp', `%o0')
define(`up', `%o1')
define(`vp', `%o2')
define(`n', `%o3')
define(`cy', `%o4')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_lshift)
add %o1, -8, %o1
add %o0, 8, %g1
sllx %o2, 3, %g5
sub %g0, %o3, %o4
ldx [%o1+%g5], %g2
add %g5, -8, %g5
brz,pn %g5, L(end)
sllx %g2, %o3, %g4
L(top): ldx [%o1+%g5], %o5
nop
add %g5, -8, %g5
srlx %o5, %o4, %g3
or %g4, %g3, %g3
sllx %o5, %o3, %g4
stx %g3, [%g1+%g5]
brnz %g5, L(top)
nop
L(end): stx %g4, [%g1-8]
retl
srlx %g2, %o4, %o0
EPILOGUE()

View File

@ -1,60 +0,0 @@
dnl SPARC v9 mpn_lshiftc for T1/T2.
dnl Copyright 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC T1: 17
C UltraSPARC T2: ?
C INPUT PARAMETERS
define(`rp', `%o0')
define(`up', `%o1')
define(`vp', `%o2')
define(`n', `%o3')
define(`cy', `%o4')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_lshiftc)
add %o1, -8, %o1
add %o0, 8, %g1
sllx %o2, 3, %g5
sub %g0, %o3, %o4
ldx [%o1+%g5], %g2
add %g5, -8, %g5
brz,pn %g5, L(end)
sllx %g2, %o3, %g4
L(top): ldx [%o1+%g5], %o5
not %g4
add %g5, -8, %g5
srlx %o5, %o4, %g3
andn %g4, %g3, %g3
sllx %o5, %o3, %g4
stx %g3, [%g1+%g5]
brnz %g5, L(top)
nop
L(end): not %g4
stx %g4, [%g1-8]
retl
srlx %g2, %o4, %o0
EPILOGUE()

View File

@ -1,61 +0,0 @@
dnl SPARC v9 mpn_rshift for T1/T2.
dnl Copyright 2010 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C UltraSPARC T1: 17
C UltraSPARC T2: ?
C INPUT PARAMETERS
define(`rp', `%o0')
define(`up', `%o1')
define(`vp', `%o2')
define(`n', `%o3')
define(`cy', `%o4')
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
PROLOGUE(mpn_rshift)
add %o1, 0, %o1
add %o0, -16, %g1
sllx %o2, 3, %g5
add %o1, %g5, %o1
add %g1, %g5, %g1
neg %g5
sub %g0, %o3, %o4
ldx [%o1+%g5], %g2
add %g5, 8, %g5
brz,pn %g5, L(end)
srlx %g2, %o3, %g4
L(top): ldx [%o1+%g5], %o5
add %g5, 8, %g5
sllx %o5, %o4, %g3
or %g4, %g3, %g3
srlx %o5, %o3, %g4
stx %g3, [%g1+%g5]
brnz %g5, L(top)
nop
L(end): stx %g4, [%g1+8]
retl
sllx %g2, %o4, %o0
EPILOGUE()

View File

@ -1,104 +0,0 @@
dnl x86 mpn_tabselect.
dnl Copyright 2011 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C P5 ?
C P6 model 0-8,10-12 ?
C P6 model 9 (Banias) ?
C P6 model 13 (Dothan) ?
C P4 model 0 (Willamette) ?
C P4 model 1 (?) ?
C P4 model 2 (Northwood) 4.5
C P4 model 3 (Prescott) ?
C P4 model 4 (Nocona) ?
C Intel Atom ?
C AMD K6 ?
C AMD K7 3.4
C AMD K8 ?
C AMD K10 ?
C NOTES
C * This has not been tuned for any specific processor. Its speed should not
C be too bad, though.
C * Using SSE2 could result in many-fold speedup.
C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
define(`rp', `%edi')
define(`tp', `%esi')
define(`n', `%ebx')
define(`nents', `%ecx')
define(`which', `36(%esp)')
define(`i', `%ebp')
define(`maskp', `20(%esp)')
define(`maskn', `32(%esp)')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_tabselect)
push %edi
push %esi
push %ebx
push %ebp
mov 20(%esp), rp
mov 24(%esp), tp
mov 28(%esp), n
mov 32(%esp), nents
lea (rp,n,4), rp
lea (tp,n,4), tp
sub nents, which
L(outer):
mov which, %eax
add nents, %eax
neg %eax C set CF iff 'which' != k
sbb %eax, %eax
mov %eax, maskn
not %eax
mov %eax, maskp
mov n, i
neg i
ALIGN(16)
L(top): mov (tp,i,4), %eax
and maskp, %eax
mov (rp,i,4), %edx
and maskn, %edx
or %edx, %eax
mov %eax, (rp,i,4)
inc i
js L(top)
L(end): mov n, %eax
lea (tp,%eax,4), tp
dec nents
jne L(outer)
L(outer_end):
pop %ebp
pop %ebx
pop %esi
pop %edi
ret
EPILOGUE()

View File

@ -1,172 +0,0 @@
dnl AMD64 mpn_addcnd_n, mpn_subcnd_n
dnl Copyright 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C AMD K8,K9 2.25
C AMD K10 2
C AMD bd1 3.55
C AMD bobcat 2.5
C Intel P4 13
C Intel core2 2.9
C Intel NHM 2.9
C Intel SBR 2.4
C Intel atom 6.5
C VIA nano 3
C NOTES
C * It might seem natural to use the cmov insn here, but since this function
C is supposed to have the exact same execution pattern for cnd true and
C false, and since cmov's documentation is not clear about wheather it
C actually reads both source operands and writes the register for a false
C condition, we cannot use it.
C * Two cases could be optimised: (1) addcnd_n could use ADCSBB-from-memory
C to save one insn/limb, and (2) when up=rp addcnd_n and subcnd_n could use
C ADCSBB-to-memory, again saving 1 insn/limb.
C * This runs optimally at decoder bandwidth on K10. It has not been tuned
C for any other processor.
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp', `%rdx')
define(`n', `%rcx')
define(`cnd', `%r8')
ifdef(`OPERATION_addcnd_n', `
define(ADDSUB, add)
define(ADCSBB, adc)
define(func, mpn_addcnd_n)')
ifdef(`OPERATION_subcnd_n', `
define(ADDSUB, sub)
define(ADCSBB, sbb)
define(func, mpn_subcnd_n)')
MULFUNC_PROLOGUE(mpn_addcnd_n mpn_subcnd_n)
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(func)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8 ')
push %rbx
push %rbp
push %r12
push %r13
push %r14
neg cnd
sbb cnd, cnd C make cnd mask
lea (vp,n,8), vp
lea (up,n,8), up
lea (rp,n,8), rp
mov R32(n), R32(%rax)
neg n
and $3, R32(%rax)
jz L(top) C carry-save reg rax = 0 in this arc
cmp $2, R32(%rax)
jc L(b1)
jz L(b2)
L(b3): mov (vp,n,8), %r12
mov 8(vp,n,8), %r13
mov 16(vp,n,8), %r14
mov (up,n,8), %r10
mov 8(up,n,8), %rbx
mov 16(up,n,8), %rbp
and cnd, %r12
and cnd, %r13
and cnd, %r14
ADDSUB %r12, %r10
ADCSBB %r13, %rbx
ADCSBB %r14, %rbp
sbb R32(%rax), R32(%rax) C save carry
mov %r10, (rp,n,8)
mov %rbx, 8(rp,n,8)
mov %rbp, 16(rp,n,8)
add $3, n
js L(top)
jmp L(end)
L(b2): mov (vp,n,8), %r12
mov 8(vp,n,8), %r13
mov (up,n,8), %r10
mov 8(up,n,8), %rbx
and cnd, %r12
and cnd, %r13
ADDSUB %r12, %r10
ADCSBB %r13, %rbx
sbb R32(%rax), R32(%rax) C save carry
mov %r10, (rp,n,8)
mov %rbx, 8(rp,n,8)
add $2, n
js L(top)
jmp L(end)
L(b1): mov (vp,n,8), %r12
mov (up,n,8), %r10
and cnd, %r12
ADDSUB %r12, %r10
sbb R32(%rax), R32(%rax) C save carry
mov %r10, (rp,n,8)
add $1, n
jns L(end)
ALIGN(16)
L(top): mov (vp,n,8), %r12
mov 8(vp,n,8), %r13
mov 16(vp,n,8), %r14
mov 24(vp,n,8), %r11
mov (up,n,8), %r10
mov 8(up,n,8), %rbx
mov 16(up,n,8), %rbp
mov 24(up,n,8), %r9
and cnd, %r12
and cnd, %r13
and cnd, %r14
and cnd, %r11
add R32(%rax), R32(%rax) C restore carry
ADCSBB %r12, %r10
ADCSBB %r13, %rbx
ADCSBB %r14, %rbp
ADCSBB %r11, %r9
sbb R32(%rax), R32(%rax) C save carry
mov %r10, (rp,n,8)
mov %rbx, 8(rp,n,8)
mov %rbp, 16(rp,n,8)
mov %r9, 24(rp,n,8)
add $4, n
js L(top)
L(end): neg R32(%rax)
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,458 +0,0 @@
dnl AMD64 mpn_mul_basecase.
dnl Contributed to the GNU project by Torbjorn Granlund and David Harvey.
dnl Copyright 2008, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C AMD K8,K9 2.375
C AMD K10 2.375
C Intel P4 15-16
C Intel core2 4.45
C Intel corei 4.35
C Intel atom ?
C VIA nano 4.5
C The inner loops of this code are the result of running a code generation and
C optimization tool suite written by David Harvey and Torbjorn Granlund.
C TODO
C * Use fewer registers. (how??? I can't see it -- david)
C * Avoid some "mov $0,r" and instead use "xor r,r".
C * Can the top of each L(addmul_outer_n) prologue be folded into the
C mul_1/mul_2 prologues, saving a LEA (%rip)? It would slow down the
C case where vn = 1 or 2; is it worth it?
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`un_param',`%rdx')
define(`vp', `%rcx')
define(`vn', `%r8')
define(`v0', `%r12')
define(`v1', `%r9')
define(`w0', `%rbx')
define(`w1', `%r15')
define(`w2', `%rbp')
define(`w3', `%r10')
define(`n', `%r11')
define(`outer_addr', `%r14')
define(`un', `%r13')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mul_basecase)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8d ')
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
xor R32(un), R32(un)
mov (up), %rax
mov (vp), v0
sub un_param, un C rdx used by mul
mov un, n
mov R32(un_param), R32(w0)
lea (rp,un_param,8), rp
lea (up,un_param,8), up
mul v0
test $1, R8(vn)
jz L(mul_2)
C ===========================================================
C mul_1 for vp[0] if vn is odd
L(mul_1):
and $3, R32(w0)
jz L(mul_1_prologue_0)
cmp $2, R32(w0)
jc L(mul_1_prologue_1)
jz L(mul_1_prologue_2)
L(mul_1_prologue_3):
add $-1, n
lea L(addmul_outer_3)(%rip), outer_addr
mov %rax, w3
mov %rdx, w0
jmp L(mul_1_entry_3)
L(mul_1_prologue_0):
mov %rax, w2
mov %rdx, w3 C note: already w0 == 0
lea L(addmul_outer_0)(%rip), outer_addr
jmp L(mul_1_entry_0)
L(mul_1_prologue_1):
cmp $-1, un
jne 2f
mov %rax, -8(rp)
mov %rdx, (rp)
jmp L(ret)
2: add $1, n
lea L(addmul_outer_1)(%rip), outer_addr
mov %rax, w1
mov %rdx, w2
xor R32(w3), R32(w3)
mov (up,n,8), %rax
jmp L(mul_1_entry_1)
L(mul_1_prologue_2):
add $-2, n
lea L(addmul_outer_2)(%rip), outer_addr
mov %rax, w0
mov %rdx, w1
mov 24(up,n,8), %rax
xor R32(w2), R32(w2)
xor R32(w3), R32(w3)
jmp L(mul_1_entry_2)
C this loop is 10 c/loop = 2.5 c/l on K8, for all up/rp alignments
ALIGN(16)
L(mul_1_top):
mov w0, -16(rp,n,8)
add %rax, w1
mov (up,n,8), %rax
adc %rdx, w2
L(mul_1_entry_1):
xor R32(w0), R32(w0)
mul v0
mov w1, -8(rp,n,8)
add %rax, w2
adc %rdx, w3
L(mul_1_entry_0):
mov 8(up,n,8), %rax
mul v0
mov w2, (rp,n,8)
add %rax, w3
adc %rdx, w0
L(mul_1_entry_3):
mov 16(up,n,8), %rax
mul v0
mov w3, 8(rp,n,8)
xor R32(w2), R32(w2) C zero
mov w2, w3 C zero
add %rax, w0
mov 24(up,n,8), %rax
mov w2, w1 C zero
adc %rdx, w1
L(mul_1_entry_2):
mul v0
add $4, n
js L(mul_1_top)
mov w0, -16(rp)
add %rax, w1
mov w1, -8(rp)
adc %rdx, w2
mov w2, (rp)
add $-1, vn C vn -= 1
jz L(ret)
mov 8(vp), v0
mov 16(vp), v1
lea 8(vp), vp C vp += 1
lea 8(rp), rp C rp += 1
jmp *outer_addr
C ===========================================================
C mul_2 for vp[0], vp[1] if vn is even
ALIGN(16)
L(mul_2):
mov 8(vp), v1
and $3, R32(w0)
jz L(mul_2_prologue_0)
cmp $2, R32(w0)
jz L(mul_2_prologue_2)
jc L(mul_2_prologue_1)
L(mul_2_prologue_3):
lea L(addmul_outer_3)(%rip), outer_addr
add $2, n
mov %rax, -16(rp,n,8)
mov %rdx, w2
xor R32(w3), R32(w3)
xor R32(w0), R32(w0)
mov -16(up,n,8), %rax
jmp L(mul_2_entry_3)
ALIGN(16)
L(mul_2_prologue_0):
add $3, n
mov %rax, w0
mov %rdx, w1
xor R32(w2), R32(w2)
mov -24(up,n,8), %rax
lea L(addmul_outer_0)(%rip), outer_addr
jmp L(mul_2_entry_0)
ALIGN(16)
L(mul_2_prologue_1):
mov %rax, w3
mov %rdx, w0
xor R32(w1), R32(w1)
lea L(addmul_outer_1)(%rip), outer_addr
jmp L(mul_2_entry_1)
ALIGN(16)
L(mul_2_prologue_2):
add $1, n
lea L(addmul_outer_2)(%rip), outer_addr
mov $0, R32(w0)
mov $0, R32(w1)
mov %rax, w2
mov -8(up,n,8), %rax
mov %rdx, w3
jmp L(mul_2_entry_2)
C this loop is 18 c/loop = 2.25 c/l on K8, for all up/rp alignments
ALIGN(16)
L(mul_2_top):
mov -32(up,n,8), %rax
mul v1
add %rax, w0
adc %rdx, w1
mov -24(up,n,8), %rax
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov -24(up,n,8), %rax
adc %rdx, w1
adc $0, R32(w2)
L(mul_2_entry_0):
mul v1
add %rax, w1
mov w0, -24(rp,n,8)
adc %rdx, w2
mov -16(up,n,8), %rax
mul v0
mov $0, R32(w3)
add %rax, w1
adc %rdx, w2
mov -16(up,n,8), %rax
adc $0, R32(w3)
mov $0, R32(w0)
mov w1, -16(rp,n,8)
L(mul_2_entry_3):
mul v1
add %rax, w2
mov -8(up,n,8), %rax
adc %rdx, w3
mov $0, R32(w1)
mul v0
add %rax, w2
mov -8(up,n,8), %rax
adc %rdx, w3
adc R32(w1), R32(w0) C adc $0, w0
L(mul_2_entry_2):
mul v1
add %rax, w3
mov w2, -8(rp,n,8)
adc %rdx, w0
mov (up,n,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
adc $0, R32(w1)
L(mul_2_entry_1):
add $4, n
mov w3, -32(rp,n,8)
js L(mul_2_top)
mov -32(up,n,8), %rax C FIXME: n is constant
mul v1
add %rax, w0
mov w0, (rp)
adc %rdx, w1
mov w1, 8(rp)
add $-2, vn C vn -= 2
jz L(ret)
mov 16(vp), v0
mov 24(vp), v1
lea 16(vp), vp C vp += 2
lea 16(rp), rp C rp += 2
jmp *outer_addr
C ===========================================================
C addmul_2 for remaining vp's
C in the following prologues, we reuse un to store the
C adjusted value of n that is reloaded on each iteration
L(addmul_outer_0):
add $3, un
lea 0(%rip), outer_addr
mov un, n
mov -24(up,un,8), %rax
mul v0
mov %rax, w0
mov -24(up,un,8), %rax
mov %rdx, w1
xor R32(w2), R32(w2)
jmp L(addmul_entry_0)
L(addmul_outer_1):
mov un, n
mov (up,un,8), %rax
mul v0
mov %rax, w3
mov (up,un,8), %rax
mov %rdx, w0
xor R32(w1), R32(w1)
jmp L(addmul_entry_1)
L(addmul_outer_2):
add $1, un
lea 0(%rip), outer_addr
mov un, n
mov -8(up,un,8), %rax
mul v0
xor R32(w0), R32(w0)
mov %rax, w2
xor R32(w1), R32(w1)
mov %rdx, w3
mov -8(up,un,8), %rax
jmp L(addmul_entry_2)
L(addmul_outer_3):
add $2, un
lea 0(%rip), outer_addr
mov un, n
mov -16(up,un,8), %rax
xor R32(w3), R32(w3)
mul v0
mov %rax, w1
mov -16(up,un,8), %rax
mov %rdx, w2
jmp L(addmul_entry_3)
C this loop is 19 c/loop = 2.375 c/l on K8, for all up/rp alignments
ALIGN(16)
L(addmul_top):
add w3, -32(rp,n,8)
adc %rax, w0
mov -24(up,n,8), %rax
adc %rdx, w1
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov -24(up,n,8), %rax
adc %rdx, w1
adc R32(w2), R32(w2) C adc $0, w2
L(addmul_entry_0):
mul v1
xor R32(w3), R32(w3)
add w0, -24(rp,n,8)
adc %rax, w1
mov -16(up,n,8), %rax
adc %rdx, w2
mul v0
add %rax, w1
mov -16(up,n,8), %rax
adc %rdx, w2
adc $0, R32(w3)
L(addmul_entry_3):
mul v1
add w1, -16(rp,n,8)
adc %rax, w2
mov -8(up,n,8), %rax
adc %rdx, w3
mul v0
xor R32(w0), R32(w0)
add %rax, w2
adc %rdx, w3
mov $0, R32(w1)
mov -8(up,n,8), %rax
adc R32(w1), R32(w0) C adc $0, w0
L(addmul_entry_2):
mul v1
add w2, -8(rp,n,8)
adc %rax, w3
adc %rdx, w0
mov (up,n,8), %rax
mul v0
add %rax, w3
mov (up,n,8), %rax
adc %rdx, w0
adc $0, R32(w1)
L(addmul_entry_1):
mul v1
add $4, n
js L(addmul_top)
add w3, -8(rp)
adc %rax, w0
mov w0, (rp)
adc %rdx, w1
mov w1, 8(rp)
add $-2, vn C vn -= 2
jz L(ret)
lea 16(rp), rp C rp += 2
lea 16(vp), vp C vp += 2
mov (vp), v0
mov 8(vp), v1
jmp *outer_addr
ALIGN(16)
L(ret): pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,425 +0,0 @@
dnl AMD64 mpn_mullo_basecase.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C The inner loops of this code are the result of running a code generation and
C optimisation tool suite written by David Harvey and Torbjorn Granlund.
C NOTES
C * There is a major stupidity in that we call mpn_mul_1 initially, for a
C large trip count. Instead, we should start with mul_2 for any operand
C size congruence class.
C * Stop iterating addmul_2 earlier, falling into straight-line triangle code
C for the last 2-3 iterations.
C * Perhaps implement n=4 special code.
C * The reload of the outer loop jump address hurts branch preditiction.
C * The addmul_2 loop ends with an MUL whose high part is not used upon loop
C exit.
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp_param', `%rdx')
define(`n', `%rcx')
define(`vp', `%r11')
define(`outer_addr', `%r8')
define(`j', `%r9')
define(`v0', `%r13')
define(`v1', `%r14')
define(`w0', `%rbx')
define(`w1', `%r15')
define(`w2', `%rbp')
define(`w3', `%r10')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mullo_basecase)
FUNC_ENTRY(4)
cmp $4, n
jge L(gen)
mov (up), %rax C u0
mov (vp_param), %r8 C v0
lea L(tab)(%rip), %r9
ifdef(`PIC',
` movslq (%r9,%rcx,4), %r10
add %r10, %r9
jmp *%r9
',`
jmp *(%r9,n,8)
')
JUMPTABSECT
ALIGN(8)
L(tab): JMPENT( L(tab), L(tab)) C not allowed
JMPENT( L(1), L(tab)) C 1
JMPENT( L(2), L(tab)) C 2
JMPENT( L(3), L(tab)) C 3
dnl JMPENT( L(0m4), L(tab)) C 4
dnl JMPENT( L(1m4), L(tab)) C 5
dnl JMPENT( L(2m4), L(tab)) C 6
dnl JMPENT( L(3m4), L(tab)) C 7
dnl JMPENT( L(0m4), L(tab)) C 8
dnl JMPENT( L(1m4), L(tab)) C 9
dnl JMPENT( L(2m4), L(tab)) C 10
dnl JMPENT( L(3m4), L(tab)) C 11
TEXT
L(1): imul %r8, %rax
mov %rax, (rp)
FUNC_EXIT()
ret
L(2): mov 8(vp_param), %r11
imul %rax, %r11 C u0 x v1
mul %r8 C u0 x v0
mov %rax, (rp)
imul 8(up), %r8 C u1 x v0
lea (%r11, %rdx), %rax
add %r8, %rax
mov %rax, 8(rp)
FUNC_EXIT()
ret
L(3): mov 8(vp_param), %r9 C v1
mov 16(vp_param), %r11
mul %r8 C u0 x v0 -> <r1,r0>
mov %rax, (rp) C r0
mov (up), %rax C u0
mov %rdx, %rcx C r1
mul %r9 C u0 x v1 -> <r2,r1>
imul 8(up), %r9 C u1 x v1 -> r2
mov 16(up), %r10
imul %r8, %r10 C u2 x v0 -> r2
add %rax, %rcx
adc %rdx, %r9
add %r10, %r9
mov 8(up), %rax C u1
mul %r8 C u1 x v0 -> <r2,r1>
add %rax, %rcx
adc %rdx, %r9
mov %r11, %rax
imul (up), %rax C u0 x v2 -> r2
add %rax, %r9
mov %rcx, 8(rp)
mov %r9, 16(rp)
FUNC_EXIT()
ret
L(0m4):
L(1m4):
L(2m4):
L(3m4):
L(gen): push %rbx
push %rbp
push %r13
push %r14
push %r15
mov (up), %rax
mov (vp_param), v0
mov vp_param, vp
lea (rp,n,8), rp
lea (up,n,8), up
neg n
mul v0
test $1, R8(n)
jz L(mul_2)
L(mul_1):
lea -8(rp), rp
lea -8(up), up
test $2, R8(n)
jnz L(mul_1_prologue_3)
L(mul_1_prologue_2): C n = 7, 11, 15, ...
lea -1(n), j
lea L(addmul_outer_1)(%rip), outer_addr
mov %rax, w0
mov %rdx, w1
xor R32(w2), R32(w2)
xor R32(w3), R32(w3)
mov 16(up,n,8), %rax
jmp L(mul_1_entry_2)
L(mul_1_prologue_3): C n = 5, 9, 13, ...
lea 1(n), j
lea L(addmul_outer_3)(%rip), outer_addr
mov %rax, w2
mov %rdx, w3
xor R32(w0), R32(w0)
jmp L(mul_1_entry_0)
ALIGN(16)
L(mul_1_top):
mov w0, -16(rp,j,8)
add %rax, w1
mov (up,j,8), %rax
adc %rdx, w2
xor R32(w0), R32(w0)
mul v0
mov w1, -8(rp,j,8)
add %rax, w2
adc %rdx, w3
L(mul_1_entry_0):
mov 8(up,j,8), %rax
mul v0
mov w2, (rp,j,8)
add %rax, w3
adc %rdx, w0
mov 16(up,j,8), %rax
mul v0
mov w3, 8(rp,j,8)
xor R32(w2), R32(w2) C zero
mov w2, w3 C zero
add %rax, w0
mov 24(up,j,8), %rax
mov w2, w1 C zero
adc %rdx, w1
L(mul_1_entry_2):
mul v0
add $4, j
js L(mul_1_top)
mov w0, -16(rp)
add %rax, w1
mov w1, -8(rp)
adc %rdx, w2
imul (up), v0
add v0, w2
mov w2, (rp)
add $1, n
jz L(ret)
mov 8(vp), v0
mov 16(vp), v1
lea 16(up), up
lea 8(vp), vp
lea 24(rp), rp
jmp *outer_addr
L(mul_2):
mov 8(vp), v1
test $2, R8(n)
jz L(mul_2_prologue_3)
ALIGN(16)
L(mul_2_prologue_1):
lea 0(n), j
mov %rax, w3
mov %rdx, w0
xor R32(w1), R32(w1)
mov (up,n,8), %rax
lea L(addmul_outer_3)(%rip), outer_addr
jmp L(mul_2_entry_1)
ALIGN(16)
L(mul_2_prologue_3):
lea 2(n), j
mov $0, R32(w3)
mov %rax, w1
mov (up,n,8), %rax
mov %rdx, w2
lea L(addmul_outer_1)(%rip), outer_addr
jmp L(mul_2_entry_3)
ALIGN(16)
L(mul_2_top):
mov -32(up,j,8), %rax
mul v1
add %rax, w0
adc %rdx, w1
mov -24(up,j,8), %rax
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov -24(up,j,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1
add %rax, w1
mov w0, -24(rp,j,8)
adc %rdx, w2
mov -16(up,j,8), %rax
mul v0
mov $0, R32(w3)
add %rax, w1
adc %rdx, w2
mov -16(up,j,8), %rax
adc $0, R32(w3)
L(mul_2_entry_3):
mov $0, R32(w0)
mov w1, -16(rp,j,8)
mul v1
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
mov $0, R32(w1)
mul v0
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
adc R32(w1), R32(w0)
mul v1
add %rax, w3
mov w2, -8(rp,j,8)
adc %rdx, w0
mov (up,j,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
adc $0, R32(w1)
L(mul_2_entry_1):
add $4, j
mov w3, -32(rp,j,8)
js L(mul_2_top)
imul -16(up), v1
add v1, w0
imul -8(up), v0
add v0, w0
mov w0, -8(rp)
add $2, n
jz L(ret)
mov 16(vp), v0
mov 24(vp), v1
lea 16(vp), vp
lea 16(rp), rp
jmp *outer_addr
L(addmul_outer_1):
lea -2(n), j
mov -16(up,n,8), %rax
mul v0
mov %rax, w3
mov -16(up,n,8), %rax
mov %rdx, w0
xor R32(w1), R32(w1)
lea L(addmul_outer_3)(%rip), outer_addr
jmp L(addmul_entry_1)
L(addmul_outer_3):
lea 0(n), j
mov -16(up,n,8), %rax
xor R32(w3), R32(w3)
mul v0
mov %rax, w1
mov -16(up,n,8), %rax
mov %rdx, w2
lea L(addmul_outer_1)(%rip), outer_addr
jmp L(addmul_entry_3)
ALIGN(16)
L(addmul_top):
add w3, -32(rp,j,8)
adc %rax, w0
mov -24(up,j,8), %rax
adc %rdx, w1
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov -24(up,j,8), %rax
adc %rdx, w1
adc R32(w2), R32(w2)
mul v1
xor R32(w3), R32(w3)
add w0, -24(rp,j,8)
adc %rax, w1
mov -16(up,j,8), %rax
adc %rdx, w2
mul v0
add %rax, w1
mov -16(up,j,8), %rax
adc %rdx, w2
adc $0, R32(w3)
L(addmul_entry_3):
mul v1
add w1, -16(rp,j,8)
adc %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
mul v0
xor R32(w0), R32(w0)
add %rax, w2
adc %rdx, w3
mov $0, R32(w1)
mov -8(up,j,8), %rax
adc R32(w1), R32(w0)
mul v1
add w2, -8(rp,j,8)
adc %rax, w3
adc %rdx, w0
mov (up,j,8), %rax
mul v0
add %rax, w3
mov (up,j,8), %rax
adc %rdx, w0
adc $0, R32(w1)
L(addmul_entry_1):
mul v1
add $4, j
js L(addmul_top)
add w3, -32(rp)
adc %rax, w0
imul -24(up), v0
add v0, w0
add w0, -24(rp)
add $2, n
jns L(ret)
lea 16(vp), vp
mov (vp), v0
mov 8(vp), v1
lea -16(up), up
jmp *outer_addr
L(ret): pop %r15
pop %r14
pop %r13
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,548 +0,0 @@
dnl AMD64 mpn_mulmid_basecase
dnl Contributed by David Harvey.
dnl Copyright 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C K8,K9: 2.375 (2.5 when un - vn is "small")
C K10: ?
C P4: ?
C P6-15: ?
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`un_param',`%rdx')
define(`vp_param',`%rcx')
define(`vn', `%r8')
define(`v0', `%r12')
define(`v1', `%r9')
define(`w0', `%rbx')
define(`w1', `%rcx')
define(`w2', `%rbp')
define(`w3', `%r10')
define(`n', `%r11')
define(`outer_addr', `%r14')
define(`un', `%r13')
define(`vp', `%r15')
define(`vp_inner', `%r10')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mulmid_basecase)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8d ')
push %rbx
push %rbp
push %r12
push %r13
push %r14
push %r15
mov vp_param, vp
C use un for row length (= un_param - vn + 1)
lea 1(un_param), un
sub vn, un
lea (rp,un,8), rp
cmp $4, un C TODO: needs tuning
jc L(diagonal)
lea (up,un_param,8), up
test $1, vn
jz L(mul_2)
C ===========================================================
C mul_1 for vp[0] if vn is odd
L(mul_1):
mov R32(un), R32(w0)
neg un
mov (up,un,8), %rax
mov (vp), v0
mul v0
and $-4, un C round down to multiple of 4
mov un, n
and $3, R32(w0)
jz L(mul_1_prologue_0)
cmp $2, R32(w0)
jc L(mul_1_prologue_1)
jz L(mul_1_prologue_2)
L(mul_1_prologue_3):
mov %rax, w3
mov %rdx, w0
lea L(addmul_prologue_3)(%rip), outer_addr
jmp L(mul_1_entry_3)
ALIGN(16)
L(mul_1_prologue_0):
mov %rax, w2
mov %rdx, w3 C note already w0 == 0
lea L(addmul_prologue_0)(%rip), outer_addr
jmp L(mul_1_entry_0)
ALIGN(16)
L(mul_1_prologue_1):
add $4, n
mov %rax, w1
mov %rdx, w2
mov $0, R32(w3)
mov (up,n,8), %rax
lea L(addmul_prologue_1)(%rip), outer_addr
jmp L(mul_1_entry_1)
ALIGN(16)
L(mul_1_prologue_2):
mov %rax, w0
mov %rdx, w1
mov 24(up,n,8), %rax
mov $0, R32(w2)
mov $0, R32(w3)
lea L(addmul_prologue_2)(%rip), outer_addr
jmp L(mul_1_entry_2)
C this loop is 10 c/loop = 2.5 c/l on K8
ALIGN(16)
L(mul_1_top):
mov w0, -16(rp,n,8)
add %rax, w1
mov (up,n,8), %rax
adc %rdx, w2
L(mul_1_entry_1):
mov $0, R32(w0)
mul v0
mov w1, -8(rp,n,8)
add %rax, w2
adc %rdx, w3
L(mul_1_entry_0):
mov 8(up,n,8), %rax
mul v0
mov w2, (rp,n,8)
add %rax, w3
adc %rdx, w0
L(mul_1_entry_3):
mov 16(up,n,8), %rax
mul v0
mov w3, 8(rp,n,8)
mov $0, R32(w2) C zero
mov w2, w3 C zero
add %rax, w0
mov 24(up,n,8), %rax
mov w2, w1 C zero
adc %rdx, w1
L(mul_1_entry_2):
mul v0
add $4, n
js L(mul_1_top)
mov w0, -16(rp)
add %rax, w1
mov w1, -8(rp)
mov w2, 8(rp) C zero last limb of output
adc %rdx, w2
mov w2, (rp)
dec vn
jz L(ret)
lea -8(up), up
lea 8(vp), vp
mov un, n
mov (vp), v0
mov 8(vp), v1
jmp *outer_addr
C ===========================================================
C mul_2 for vp[0], vp[1] if vn is even
ALIGN(16)
L(mul_2):
mov R32(un), R32(w0)
neg un
mov -8(up,un,8), %rax
mov (vp), v0
mov 8(vp), v1
mul v1
and $-4, un C round down to multiple of 4
mov un, n
and $3, R32(w0)
jz L(mul_2_prologue_0)
cmp $2, R32(w0)
jc L(mul_2_prologue_1)
jz L(mul_2_prologue_2)
L(mul_2_prologue_3):
mov %rax, w1
mov %rdx, w2
lea L(addmul_prologue_3)(%rip), outer_addr
jmp L(mul_2_entry_3)
ALIGN(16)
L(mul_2_prologue_0):
mov %rax, w0
mov %rdx, w1
lea L(addmul_prologue_0)(%rip), outer_addr
jmp L(mul_2_entry_0)
ALIGN(16)
L(mul_2_prologue_1):
mov %rax, w3
mov %rdx, w0
mov $0, R32(w1)
lea L(addmul_prologue_1)(%rip), outer_addr
jmp L(mul_2_entry_1)
ALIGN(16)
L(mul_2_prologue_2):
mov %rax, w2
mov %rdx, w3
mov $0, R32(w0)
mov 16(up,n,8), %rax
lea L(addmul_prologue_2)(%rip), outer_addr
jmp L(mul_2_entry_2)
C this loop is 18 c/loop = 2.25 c/l on K8
ALIGN(16)
L(mul_2_top):
mov -8(up,n,8), %rax
mul v1
add %rax, w0
adc %rdx, w1
L(mul_2_entry_0):
mov $0, R32(w2)
mov (up,n,8), %rax
mul v0
add %rax, w0
mov (up,n,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1
add %rax, w1
mov w0, (rp,n,8)
adc %rdx, w2
L(mul_2_entry_3):
mov 8(up,n,8), %rax
mul v0
mov $0, R32(w3)
add %rax, w1
adc %rdx, w2
mov $0, R32(w0)
adc $0, R32(w3)
mov 8(up,n,8), %rax
mov w1, 8(rp,n,8)
mul v1
add %rax, w2
mov 16(up,n,8), %rax
adc %rdx, w3
L(mul_2_entry_2):
mov $0, R32(w1)
mul v0
add %rax, w2
mov 16(up,n,8), %rax
adc %rdx, w3
adc $0, R32(w0)
mul v1
add %rax, w3
mov w2, 16(rp,n,8)
adc %rdx, w0
L(mul_2_entry_1):
mov 24(up,n,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
adc $0, R32(w1)
add $4, n
mov w3, -8(rp,n,8)
jnz L(mul_2_top)
mov w0, (rp)
mov w1, 8(rp)
sub $2, vn
jz L(ret)
lea 16(vp), vp
lea -16(up), up
mov un, n
mov (vp), v0
mov 8(vp), v1
jmp *outer_addr
C ===========================================================
C addmul_2 for remaining vp's
ALIGN(16)
L(addmul_prologue_0):
mov -8(up,n,8), %rax
mul v1
mov %rax, w1
mov %rdx, w2
mov $0, R32(w3)
jmp L(addmul_entry_0)
ALIGN(16)
L(addmul_prologue_1):
mov 16(up,n,8), %rax
mul v1
mov %rax, w0
mov %rdx, w1
mov $0, R32(w2)
mov 24(up,n,8), %rax
jmp L(addmul_entry_1)
ALIGN(16)
L(addmul_prologue_2):
mov 8(up,n,8), %rax
mul v1
mov %rax, w3
mov %rdx, w0
mov $0, R32(w1)
jmp L(addmul_entry_2)
ALIGN(16)
L(addmul_prologue_3):
mov (up,n,8), %rax
mul v1
mov %rax, w2
mov %rdx, w3
mov $0, R32(w0)
mov $0, R32(w1)
jmp L(addmul_entry_3)
C this loop is 19 c/loop = 2.375 c/l on K8
ALIGN(16)
L(addmul_top):
mov $0, R32(w3)
add %rax, w0
mov -8(up,n,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1
add w0, -8(rp,n,8)
adc %rax, w1
adc %rdx, w2
L(addmul_entry_0):
mov (up,n,8), %rax
mul v0
add %rax, w1
mov (up,n,8), %rax
adc %rdx, w2
adc $0, R32(w3)
mul v1
add w1, (rp,n,8)
mov $0, R32(w1)
adc %rax, w2
mov $0, R32(w0)
adc %rdx, w3
L(addmul_entry_3):
mov 8(up,n,8), %rax
mul v0
add %rax, w2
mov 8(up,n,8), %rax
adc %rdx, w3
adc $0, R32(w0)
mul v1
add w2, 8(rp,n,8)
adc %rax, w3
adc %rdx, w0
L(addmul_entry_2):
mov 16(up,n,8), %rax
mul v0
add %rax, w3
mov 16(up,n,8), %rax
adc %rdx, w0
adc $0, R32(w1)
mul v1
add w3, 16(rp,n,8)
nop C don't ask...
adc %rax, w0
mov $0, R32(w2)
mov 24(up,n,8), %rax
adc %rdx, w1
L(addmul_entry_1):
mul v0
add $4, n
jnz L(addmul_top)
add %rax, w0
adc %rdx, w1
adc $0, R32(w2)
add w0, -8(rp)
adc w1, (rp)
adc w2, 8(rp)
sub $2, vn
jz L(ret)
lea 16(vp), vp
lea -16(up), up
mov un, n
mov (vp), v0
mov 8(vp), v1
jmp *outer_addr
C ===========================================================
C accumulate along diagonals if un - vn is small
ALIGN(16)
L(diagonal):
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
xor R32(w2), R32(w2)
neg un
mov R32(vn), %eax
and $3, %eax
jz L(diag_prologue_0)
cmp $2, %eax
jc L(diag_prologue_1)
jz L(diag_prologue_2)
L(diag_prologue_3):
lea -8(vp), vp
mov vp, vp_inner
add $1, vn
mov vn, n
lea L(diag_entry_3)(%rip), outer_addr
jmp L(diag_entry_3)
L(diag_prologue_0):
mov vp, vp_inner
mov vn, n
lea 0(%rip), outer_addr
mov -8(up,n,8), %rax
jmp L(diag_entry_0)
L(diag_prologue_1):
lea 8(vp), vp
mov vp, vp_inner
add $3, vn
mov vn, n
lea 0(%rip), outer_addr
mov -8(vp_inner), %rax
jmp L(diag_entry_1)
L(diag_prologue_2):
lea -16(vp), vp
mov vp, vp_inner
add $2, vn
mov vn, n
lea 0(%rip), outer_addr
mov 16(vp_inner), %rax
jmp L(diag_entry_2)
C this loop is 10 c/loop = 2.5 c/l on K8
ALIGN(16)
L(diag_top):
add %rax, w0
adc %rdx, w1
mov -8(up,n,8), %rax
adc $0, w2
L(diag_entry_0):
mulq (vp_inner)
add %rax, w0
adc %rdx, w1
adc $0, w2
L(diag_entry_3):
mov -16(up,n,8), %rax
mulq 8(vp_inner)
add %rax, w0
mov 16(vp_inner), %rax
adc %rdx, w1
adc $0, w2
L(diag_entry_2):
mulq -24(up,n,8)
add %rax, w0
mov 24(vp_inner), %rax
adc %rdx, w1
lea 32(vp_inner), vp_inner
adc $0, w2
L(diag_entry_1):
mulq -32(up,n,8)
sub $4, n
jnz L(diag_top)
add %rax, w0
adc %rdx, w1
adc $0, w2
mov w0, (rp,un,8)
inc un
jz L(diag_end)
mov vn, n
mov vp, vp_inner
lea 8(up), up
mov w1, w0
mov w2, w1
xor R32(w2), R32(w2)
jmp *outer_addr
L(diag_end):
mov w1, (rp)
mov w2, 8(rp)
L(ret): pop %r15
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,327 +0,0 @@
dnl AMD64 mpn_redc_1 -- Montgomery reduction with a one-limb modular inverse.
dnl Copyright 2004, 2008, 2011, 2012 Free Software Foundation, Inc.
dnl
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or
dnl modify it under the terms of the GNU Lesser General Public License as
dnl published by the Free Software Foundation; either version 3 of the
dnl License, or (at your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
dnl Lesser General Public License for more details.
dnl
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C cycles/limb
C AMD K8,K9 2.5
C AMD K10 2.5
C Intel P4 ?
C Intel core2 5.3
C Intel corei ?
C Intel atom ?
C VIA nano ?
C TODO
C * Handle certain sizes, e.g., 1, 2, 3, 4, 8, with single-loop code.
C The code for 1, 2, 3, 4 should perhaps be completely register based.
C * Perhaps align outer loops.
C * We could software pipeline the IMUL stuff, by putting it before the
C outer loops and before the end of the outer loops. The last outer
C loop iteration would then compute an unneeded product, but it is at
C least not a stray read from up[], since it is at up[n].
C * Make a tail call to mpn_add_n.
C INPUT PARAMETERS
define(`rp', `%rdi') C rcx
define(`up', `%rsi') C rdx
define(`mp_param',`%rdx') C r8
define(`n', `%rcx') C r9
define(`invm', `%r8') C stack
define(`mp', `%r13')
define(`i', `%r11')
define(`nneg', `%r12')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_redc_1)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8 ')
push %rbp
push %rbx
push %r12
push %r13
push %r14
lea (mp_param,n,8), mp C mp += n
lea (up,n,8), up C up += n
mov n, nneg
neg nneg
mov R32(n), R32(%rax)
and $3, R32(%rax)
jz L(b0)
cmp $2, R32(%rax)
jz L(b2)
jg L(b3)
L(b1): C lea (mp), mp
lea -16(up), up
L(o1): mov nneg, i
mov 16(up,nneg,8), %rbp C up[0]
imul invm, %rbp
mov (mp,i,8), %rax
xor R32(%rbx), R32(%rbx)
mul %rbp
add $1, i
jnz 1f
add %rax, 8(up,i,8)
adc $0, %rdx
mov %rdx, %r14
jmp L(n1)
1: mov %rax, %r9
mov (mp,i,8), %rax
mov %rdx, %r14
jmp L(mi1)
ALIGN(16)
L(lo1): add %r10, (up,i,8)
adc %rax, %r9
mov (mp,i,8), %rax
adc %rdx, %r14
L(mi1): xor R32(%r10), R32(%r10)
mul %rbp
add %r9, 8(up,i,8)
adc %rax, %r14
adc %rdx, %rbx
mov 8(mp,i,8), %rax
mul %rbp
add %r14, 16(up,i,8)
adc %rax, %rbx
adc %rdx, %r10
mov 16(mp,i,8), %rax
mul %rbp
xor R32(%r9), R32(%r9)
xor R32(%r14), R32(%r14)
add %rbx, 24(up,i,8)
adc %rax, %r10
mov 24(mp,i,8), %rax
adc %rdx, %r9
xor R32(%rbx), R32(%rbx)
mul %rbp
add $4, i
js L(lo1)
L(ed1): add %r10, (up)
adc %rax, %r9
adc %rdx, %r14
xor R32(%r10), R32(%r10)
add %r9, 8(up)
adc $0, %r14
L(n1): mov %r14, 16(up,nneg,8) C up[0]
add $8, up
dec n
jnz L(o1)
lea 16(up,nneg,8), up
jmp L(common)
L(b0): C lea (mp), mp
lea -16(up), up
L(o0): mov nneg, i
mov 16(up,nneg,8), %rbp C up[0]
imul invm, %rbp
mov (mp,i,8), %rax
xor R32(%r10), R32(%r10)
mul %rbp
mov %rax, %r14
mov %rdx, %rbx
jmp L(mi0)
ALIGN(16)
L(lo0): add %r10, (up,i,8)
adc %rax, %r9
mov (mp,i,8), %rax
adc %rdx, %r14
xor R32(%r10), R32(%r10)
mul %rbp
add %r9, 8(up,i,8)
adc %rax, %r14
adc %rdx, %rbx
L(mi0): mov 8(mp,i,8), %rax
mul %rbp
add %r14, 16(up,i,8)
adc %rax, %rbx
adc %rdx, %r10
mov 16(mp,i,8), %rax
mul %rbp
xor R32(%r9), R32(%r9)
xor R32(%r14), R32(%r14)
add %rbx, 24(up,i,8)
adc %rax, %r10
mov 24(mp,i,8), %rax
adc %rdx, %r9
xor R32(%rbx), R32(%rbx)
mul %rbp
add $4, i
js L(lo0)
L(ed0): add %r10, (up)
adc %rax, %r9
adc %rdx, %r14
xor R32(%r10), R32(%r10)
add %r9, 8(up)
adc $0, %r14
mov %r14, 16(up,nneg,8) C up[0]
add $8, up
dec n
jnz L(o0)
lea 16(up,nneg,8), up
jmp L(common)
L(b3): lea -8(mp), mp
lea -24(up), up
L(o3): mov nneg, i
mov 24(up,nneg,8), %rbp C up[0]
imul invm, %rbp
mov 8(mp,i,8), %rax
mul %rbp
mov %rax, %rbx
mov %rdx, %r10
jmp L(mi3)
ALIGN(16)
L(lo3): add %r10, (up,i,8)
adc %rax, %r9
mov (mp,i,8), %rax
adc %rdx, %r14
xor R32(%r10), R32(%r10)
mul %rbp
add %r9, 8(up,i,8)
adc %rax, %r14
adc %rdx, %rbx
mov 8(mp,i,8), %rax
mul %rbp
add %r14, 16(up,i,8)
adc %rax, %rbx
adc %rdx, %r10
L(mi3): mov 16(mp,i,8), %rax
mul %rbp
xor R32(%r9), R32(%r9)
xor R32(%r14), R32(%r14)
add %rbx, 24(up,i,8)
adc %rax, %r10
mov 24(mp,i,8), %rax
adc %rdx, %r9
xor R32(%rbx), R32(%rbx)
mul %rbp
add $4, i
js L(lo3)
L(ed3): add %r10, 8(up)
adc %rax, %r9
adc %rdx, %r14
xor R32(%r10), R32(%r10)
add %r9, 16(up)
adc $0, %r14
mov %r14, 24(up,nneg,8) C up[0]
add $8, up
dec n
jnz L(o3)
lea 24(up,nneg,8), up
jmp L(common)
L(b2): lea -16(mp), mp
lea -32(up), up
L(o2): mov nneg, i
mov 32(up,nneg,8), %rbp C up[0]
imul invm, %rbp
mov 16(mp,i,8), %rax
mul %rbp
xor R32(%r14), R32(%r14)
mov %rax, %r10
mov 24(mp,i,8), %rax
mov %rdx, %r9
jmp L(mi2)
ALIGN(16)
L(lo2): add %r10, (up,i,8)
adc %rax, %r9
mov (mp,i,8), %rax
adc %rdx, %r14
xor R32(%r10), R32(%r10)
mul %rbp
add %r9, 8(up,i,8)
adc %rax, %r14
adc %rdx, %rbx
mov 8(mp,i,8), %rax
mul %rbp
add %r14, 16(up,i,8)
adc %rax, %rbx
adc %rdx, %r10
mov 16(mp,i,8), %rax
mul %rbp
xor R32(%r9), R32(%r9)
xor R32(%r14), R32(%r14)
add %rbx, 24(up,i,8)
adc %rax, %r10
mov 24(mp,i,8), %rax
adc %rdx, %r9
L(mi2): xor R32(%rbx), R32(%rbx)
mul %rbp
add $4, i
js L(lo2)
L(ed2): add %r10, 16(up)
adc %rax, %r9
adc %rdx, %r14
xor R32(%r10), R32(%r10)
add %r9, 24(up)
adc $0, %r14
mov %r14, 32(up,nneg,8) C up[0]
add $8, up
dec n
jnz L(o2)
lea 32(up,nneg,8), up
L(common):
C cy = mpn_add_n (rp, up, up - n, n);
C rdi rsi rdx rcx STD
C rcx rdx r8 r9 DOS
IFSTD(` lea (up,nneg,8), %rdx ') C rdx = up - n [up entry value]
IFSTD(` mov nneg, %rcx ')
IFSTD(` neg %rcx ') C rcx = -nneg = n
IFDOS(` lea (up,nneg,8), %r8 ') C r8 = up - n
IFDOS(` mov up, %rdx ') C rdx = up
IFDOS(` mov nneg, %r9 ')
IFDOS(` neg %r9 ') C r9 = -nneg = n
IFDOS(` mov rp, %rcx ') C rcx = rp
CALL( mpn_add_n)
pop %r14
pop %r13
pop %r12
pop %rbx
pop %rbp
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,796 +0,0 @@
dnl AMD64 mpn_sqr_basecase.
dnl Contributed to the GNU project by Torbjorn Granlund.
dnl Copyright 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C The inner loops of this code are the result of running a code generation and
C optimization tool suite written by David Harvey and Torbjorn Granlund.
C NOTES
C * There is a major stupidity in that we call mpn_mul_1 initially, for a
C large trip count. Instead, we should follow the generic/sqr_basecase.c
C code which uses addmul_2s from the start, conditionally leaving a 1x1
C multiply to the end. (In assembly code, one would stop invoking
C addmul_2s loops when perhaps 3x2s respectively a 2x2s remains.)
C * Another stupidity is in the sqr_diag_addlsh1 code. It does not need to
C save/restore carry, instead it can propagate into the high product word.
C * Align more labels, should shave off a few cycles.
C * We can safely use 32-bit size operations, since operands with (2^32)
C limbs will lead to non-termination in practice.
C * The jump table could probably be optimized, at least for non-pic.
C * The special code for n <= 4 was quickly written. It is probably too
C large and unnecessarily slow.
C * Consider combining small cases code so that the n=k-1 code jumps into the
C middle of the n=k code.
C * Avoid saving registers for small cases code.
C * Needed variables:
C n r11 input size
C i r8 work left, initially n
C j r9 inner loop count
C r15 unused
C v0 r13
C v1 r14
C rp rdi
C up rsi
C w0 rbx
C w1 rcx
C w2 rbp
C w3 r10
C tp r12
C lo rax
C hi rdx
C rsp
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`n_param', `%rdx')
define(`n', `%r11')
define(`tp', `%r12')
define(`i', `%r8')
define(`j', `%r9')
define(`v0', `%r13')
define(`v1', `%r14')
define(`w0', `%rbx')
define(`w1', `%rcx')
define(`w2', `%rbp')
define(`w3', `%r10')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_sqr_basecase)
FUNC_ENTRY(3)
mov R32(n_param), R32(%rcx)
mov R32(n_param), R32(n) C free original n register (rdx)
add $-40, %rsp
and $3, R32(%rcx)
cmp $4, R32(n_param)
lea 4(%rcx), %r8
mov %rbx, 32(%rsp)
mov %rbp, 24(%rsp)
mov %r12, 16(%rsp)
mov %r13, 8(%rsp)
mov %r14, (%rsp)
cmovg %r8, %rcx
lea L(tab)(%rip), %rax
ifdef(`PIC',
` movslq (%rax,%rcx,4), %r10
add %r10, %rax
jmp *%rax
',`
jmp *(%rax,%rcx,8)
')
JUMPTABSECT
ALIGN(8)
L(tab): JMPENT( L(4), L(tab))
JMPENT( L(1), L(tab))
JMPENT( L(2), L(tab))
JMPENT( L(3), L(tab))
JMPENT( L(0m4), L(tab))
JMPENT( L(1m4), L(tab))
JMPENT( L(2m4), L(tab))
JMPENT( L(3m4), L(tab))
TEXT
L(1): mov (up), %rax
mul %rax
add $40, %rsp
mov %rax, (rp)
mov %rdx, 8(rp)
FUNC_EXIT()
ret
L(2): mov (up), %rax
mov %rax, %r8
mul %rax
mov 8(up), %r11
mov %rax, (rp)
mov %r11, %rax
mov %rdx, %r9
mul %rax
add $40, %rsp
mov %rax, %r10
mov %r11, %rax
mov %rdx, %r11
mul %r8
xor %r8, %r8
add %rax, %r9
adc %rdx, %r10
adc %r8, %r11
add %rax, %r9
mov %r9, 8(rp)
adc %rdx, %r10
mov %r10, 16(rp)
adc %r8, %r11
mov %r11, 24(rp)
FUNC_EXIT()
ret
L(3): mov (up), %rax
mov %rax, %r10
mul %rax
mov 8(up), %r11
mov %rax, (rp)
mov %r11, %rax
mov %rdx, 8(rp)
mul %rax
mov 16(up), %rcx
mov %rax, 16(rp)
mov %rcx, %rax
mov %rdx, 24(rp)
mul %rax
mov %rax, 32(rp)
mov %rdx, 40(rp)
mov %r11, %rax
mul %r10
mov %rax, %r8
mov %rcx, %rax
mov %rdx, %r9
mul %r10
xor %r10, %r10
add %rax, %r9
mov %r11, %rax
mov %r10, %r11
adc %rdx, %r10
mul %rcx
add $40, %rsp
add %rax, %r10
adc %r11, %rdx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %rdx, %rdx
adc %r11, %r11
add %r8, 8(rp)
adc %r9, 16(rp)
adc %r10, 24(rp)
adc %rdx, 32(rp)
adc %r11, 40(rp)
FUNC_EXIT()
ret
L(4): mov (up), %rax
mov %rax, %r11
mul %rax
mov 8(up), %rbx
mov %rax, (rp)
mov %rbx, %rax
mov %rdx, 8(rp)
mul %rax
mov %rax, 16(rp)
mov %rdx, 24(rp)
mov 16(up), %rax
mul %rax
mov %rax, 32(rp)
mov %rdx, 40(rp)
mov 24(up), %rax
mul %rax
mov %rax, 48(rp)
mov %rbx, %rax
mov %rdx, 56(rp)
mul %r11
add $32, %rsp
mov %rax, %r8
mov %rdx, %r9
mov 16(up), %rax
mul %r11
xor %r10, %r10
add %rax, %r9
adc %rdx, %r10
mov 24(up), %rax
mul %r11
xor %r11, %r11
add %rax, %r10
adc %rdx, %r11
mov 16(up), %rax
mul %rbx
xor %rcx, %rcx
add %rax, %r10
adc %rdx, %r11
adc $0, %rcx
mov 24(up), %rax
mul %rbx
pop %rbx
add %rax, %r11
adc %rdx, %rcx
mov 16(up), %rdx
mov 24(up), %rax
mul %rdx
add %rax, %rcx
adc $0, %rdx
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
adc %rcx, %rcx
mov $0, R32(%rax)
adc %rdx, %rdx
adc %rax, %rax
add %r8, 8(rp)
adc %r9, 16(rp)
adc %r10, 24(rp)
adc %r11, 32(rp)
adc %rcx, 40(rp)
adc %rdx, 48(rp)
adc %rax, 56(rp)
FUNC_EXIT()
ret
L(0m4):
lea -16(rp,n,8), tp C point tp in middle of result operand
mov (up), v0
mov 8(up), %rax
lea (up,n,8), up C point up at end of input operand
lea -4(n), i
C Function mpn_mul_1_m3(tp, up - i, i, up[-i - 1])
xor R32(j), R32(j)
sub n, j
mul v0
xor R32(w2), R32(w2)
mov %rax, w0
mov 16(up,j,8), %rax
mov %rdx, w3
jmp L(L3)
ALIGN(16)
L(mul_1_m3_top):
add %rax, w2
mov w3, (tp,j,8)
mov (up,j,8), %rax
adc %rdx, w1
xor R32(w0), R32(w0)
mul v0
xor R32(w3), R32(w3)
mov w2, 8(tp,j,8)
add %rax, w1
adc %rdx, w0
mov 8(up,j,8), %rax
mov w1, 16(tp,j,8)
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov 16(up,j,8), %rax
adc %rdx, w3
L(L3): xor R32(w1), R32(w1)
mul v0
add %rax, w3
mov 24(up,j,8), %rax
adc %rdx, w2
mov w0, 24(tp,j,8)
mul v0
add $4, j
js L(mul_1_m3_top)
add %rax, w2
mov w3, (tp)
adc %rdx, w1
mov w2, 8(tp)
mov w1, 16(tp)
lea eval(2*8)(tp), tp C tp += 2
lea -8(up), up
jmp L(dowhile)
L(1m4):
lea 8(rp,n,8), tp C point tp in middle of result operand
mov (up), v0 C u0
mov 8(up), %rax C u1
lea 8(up,n,8), up C point up at end of input operand
lea -3(n), i
C Function mpn_mul_2s_m0(tp, up - i, i, up - i - 1)
lea -3(n), j
neg j
mov %rax, v1 C u1
mul v0 C u0 * u1
mov %rdx, w1
xor R32(w2), R32(w2)
mov %rax, 8(rp)
jmp L(m0)
ALIGN(16)
L(mul_2_m0_top):
mul v1
add %rax, w0
adc %rdx, w1
mov -24(up,j,8), %rax
mov $0, R32(w2)
mul v0
add %rax, w0
mov -24(up,j,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1 C v1 * u0
add %rax, w1
mov w0, -24(tp,j,8)
adc %rdx, w2
L(m0): mov -16(up,j,8), %rax C u2, u6 ...
mul v0 C u0 * u2
mov $0, R32(w3)
add %rax, w1
adc %rdx, w2
mov -16(up,j,8), %rax
adc $0, R32(w3)
mov $0, R32(w0)
mov w1, -16(tp,j,8)
mul v1
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
mov $0, R32(w1)
mul v0
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
adc $0, R32(w0)
mul v1
add %rax, w3
mov w2, -8(tp,j,8)
adc %rdx, w0
L(m2x): mov (up,j,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
adc $0, R32(w1)
add $4, j
mov -32(up,j,8), %rax
mov w3, -32(tp,j,8)
js L(mul_2_m0_top)
mul v1
add %rax, w0
adc %rdx, w1
mov w0, -8(tp)
mov w1, (tp)
lea -16(up), up
lea eval(3*8-24)(tp), tp C tp += 3
jmp L(dowhile_end)
L(2m4):
lea -16(rp,n,8), tp C point tp in middle of result operand
mov (up), v0
mov 8(up), %rax
lea (up,n,8), up C point up at end of input operand
lea -4(n), i
C Function mpn_mul_1_m1(tp, up - (i - 1), i - 1, up[-i])
lea -2(n), j
neg j
mul v0
mov %rax, w2
mov (up,j,8), %rax
mov %rdx, w1
jmp L(L1)
ALIGN(16)
L(mul_1_m1_top):
add %rax, w2
mov w3, (tp,j,8)
mov (up,j,8), %rax
adc %rdx, w1
L(L1): xor R32(w0), R32(w0)
mul v0
xor R32(w3), R32(w3)
mov w2, 8(tp,j,8)
add %rax, w1
adc %rdx, w0
mov 8(up,j,8), %rax
mov w1, 16(tp,j,8)
xor R32(w2), R32(w2)
mul v0
add %rax, w0
mov 16(up,j,8), %rax
adc %rdx, w3
xor R32(w1), R32(w1)
mul v0
add %rax, w3
mov 24(up,j,8), %rax
adc %rdx, w2
mov w0, 24(tp,j,8)
mul v0
add $4, j
js L(mul_1_m1_top)
add %rax, w2
mov w3, (tp)
adc %rdx, w1
mov w2, 8(tp)
mov w1, 16(tp)
lea eval(2*8)(tp), tp C tp += 2
lea -8(up), up
jmp L(dowhile_mid)
L(3m4):
lea 8(rp,n,8), tp C point tp in middle of result operand
mov (up), v0 C u0
mov 8(up), %rax C u1
lea 8(up,n,8), up C point up at end of input operand
lea -5(n), i
C Function mpn_mul_2s_m2(tp, up - i + 1, i - 1, up - i)
lea -1(n), j
neg j
mov %rax, v1 C u1
mul v0 C u0 * u1
mov %rdx, w3
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
mov %rax, 8(rp)
jmp L(m2)
ALIGN(16)
L(mul_2_m2_top):
mul v1
add %rax, w0
adc %rdx, w1
mov -24(up,j,8), %rax
mov $0, R32(w2)
mul v0
add %rax, w0
mov -24(up,j,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1 C v1 * u0
add %rax, w1
mov w0, -24(tp,j,8)
adc %rdx, w2
mov -16(up,j,8), %rax
mul v0
mov $0, R32(w3)
add %rax, w1
adc %rdx, w2
mov -16(up,j,8), %rax
adc $0, R32(w3)
mov $0, R32(w0)
mov w1, -16(tp,j,8)
mul v1
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
mov $0, R32(w1)
mul v0
add %rax, w2
mov -8(up,j,8), %rax
adc %rdx, w3
adc $0, R32(w0)
mul v1
add %rax, w3
mov w2, -8(tp,j,8)
adc %rdx, w0
L(m2): mov (up,j,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
adc $0, R32(w1)
add $4, j
mov -32(up,j,8), %rax
mov w3, -32(tp,j,8)
js L(mul_2_m2_top)
mul v1
add %rax, w0
adc %rdx, w1
mov w0, -8(tp)
mov w1, (tp)
lea -16(up), up
jmp L(dowhile_mid)
L(dowhile):
C Function mpn_addmul_2s_m2(tp, up - (i - 1), i - 1, up - i)
lea 4(i), j
neg j
mov 16(up,j,8), v0
mov 24(up,j,8), v1
mov 24(up,j,8), %rax
mul v0
xor R32(w3), R32(w3)
add %rax, 24(tp,j,8)
adc %rdx, w3
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
jmp L(am2)
ALIGN(16)
L(addmul_2_m2_top):
add w3, (tp,j,8)
adc %rax, w0
mov 8(up,j,8), %rax
adc %rdx, w1
mov $0, R32(w2)
mul v0
add %rax, w0
mov 8(up,j,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1 C v1 * u0
add w0, 8(tp,j,8)
adc %rax, w1
adc %rdx, w2
mov 16(up,j,8), %rax
mov $0, R32(w3)
mul v0 C v0 * u1
add %rax, w1
mov 16(up,j,8), %rax
adc %rdx, w2
adc $0, R32(w3)
mul v1 C v1 * u1
add w1, 16(tp,j,8)
adc %rax, w2
mov 24(up,j,8), %rax
adc %rdx, w3
mul v0
mov $0, R32(w0)
add %rax, w2
adc %rdx, w3
mov $0, R32(w1)
mov 24(up,j,8), %rax
adc $0, R32(w0)
mul v1
add w2, 24(tp,j,8)
adc %rax, w3
adc %rdx, w0
L(am2): mov 32(up,j,8), %rax
mul v0
add %rax, w3
mov 32(up,j,8), %rax
adc %rdx, w0
adc $0, R32(w1)
mul v1
add $4, j
js L(addmul_2_m2_top)
add w3, (tp)
adc %rax, w0
adc %rdx, w1
mov w0, 8(tp)
mov w1, 16(tp)
lea eval(2*8)(tp), tp C tp += 2
add $-2, R32(i) C i -= 2
L(dowhile_mid):
C Function mpn_addmul_2s_m0(tp, up - (i - 1), i - 1, up - i)
lea 2(i), j
neg j
mov (up,j,8), v0
mov 8(up,j,8), v1
mov 8(up,j,8), %rax
mul v0
xor R32(w1), R32(w1)
add %rax, 8(tp,j,8)
adc %rdx, w1
xor R32(w2), R32(w2)
jmp L(20)
ALIGN(16)
L(addmul_2_m0_top):
add w3, (tp,j,8)
adc %rax, w0
mov 8(up,j,8), %rax
adc %rdx, w1
mov $0, R32(w2)
mul v0
add %rax, w0
mov 8(up,j,8), %rax
adc %rdx, w1
adc $0, R32(w2)
mul v1 C v1 * u0
add w0, 8(tp,j,8)
adc %rax, w1
adc %rdx, w2
L(20): mov 16(up,j,8), %rax
mov $0, R32(w3)
mul v0 C v0 * u1
add %rax, w1
mov 16(up,j,8), %rax
adc %rdx, w2
adc $0, R32(w3)
mul v1 C v1 * u1
add w1, 16(tp,j,8)
adc %rax, w2
mov 24(up,j,8), %rax
adc %rdx, w3
mul v0
mov $0, R32(w0)
add %rax, w2
adc %rdx, w3
mov $0, R32(w1)
mov 24(up,j,8), %rax
adc $0, R32(w0)
mul v1
add w2, 24(tp,j,8)
adc %rax, w3
adc %rdx, w0
mov 32(up,j,8), %rax
mul v0
add %rax, w3
mov 32(up,j,8), %rax
adc %rdx, w0
adc $0, R32(w1)
mul v1
add $4, j
js L(addmul_2_m0_top)
add w3, (tp)
adc %rax, w0
adc %rdx, w1
mov w0, 8(tp)
mov w1, 16(tp)
lea eval(2*8)(tp), tp C tp += 2
L(dowhile_end):
add $-2, R32(i) C i -= 2
jne L(dowhile)
C Function mpn_addmul_2s_2
mov -16(up), v0
mov -8(up), v1
mov -8(up), %rax
mul v0
xor R32(w3), R32(w3)
add %rax, -8(tp)
adc %rdx, w3
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
mov (up), %rax
mul v0
add %rax, w3
mov (up), %rax
adc %rdx, w0
mul v1
add w3, (tp)
adc %rax, w0
adc %rdx, w1
mov w0, 8(tp)
mov w1, 16(tp)
C Function mpn_sqr_diag_addlsh1
lea -4(n,n), j
mov 8(rp), %r11
lea -8(up), up
lea (rp,j,8), rp
neg j
mov (up,j,4), %rax
mul %rax
test $2, R8(j)
jnz L(odd)
L(evn): add %r11, %r11
sbb R32(%rbx), R32(%rbx) C save CF
add %rdx, %r11
mov %rax, (rp,j,8)
jmp L(d0)
L(odd): add %r11, %r11
sbb R32(%rbp), R32(%rbp) C save CF
add %rdx, %r11
mov %rax, (rp,j,8)
lea -2(j), j
jmp L(d1)
ALIGN(16)
L(top): mov (up,j,4), %rax
mul %rax
add R32(%rbp), R32(%rbp) C restore carry
adc %rax, %r10
adc %rdx, %r11
mov %r10, (rp,j,8)
L(d0): mov %r11, 8(rp,j,8)
mov 16(rp,j,8), %r10
adc %r10, %r10
mov 24(rp,j,8), %r11
adc %r11, %r11
nop
sbb R32(%rbp), R32(%rbp) C save CF
mov 8(up,j,4), %rax
mul %rax
add R32(%rbx), R32(%rbx) C restore carry
adc %rax, %r10
adc %rdx, %r11
mov %r10, 16(rp,j,8)
L(d1): mov %r11, 24(rp,j,8)
mov 32(rp,j,8), %r10
adc %r10, %r10
mov 40(rp,j,8), %r11
adc %r11, %r11
sbb R32(%rbx), R32(%rbx) C save CF
add $4, j
js L(top)
mov (up), %rax
mul %rax
add R32(%rbp), R32(%rbp) C restore carry
adc %rax, %r10
adc %rdx, %r11
mov %r10, (rp)
mov %r11, 8(rp)
mov 16(rp), %r10
adc %r10, %r10
sbb R32(%rbp), R32(%rbp) C save CF
neg R32(%rbp)
mov 8(up), %rax
mul %rax
add R32(%rbx), R32(%rbx) C restore carry
adc %rax, %r10
adc %rbp, %rdx
mov %r10, 16(rp)
mov %rdx, 24(rp)
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,115 +0,0 @@
dnl AMD64 mpn_tabselect.
dnl Copyright 2011, 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU Lesser General Public License as published
dnl by the Free Software Foundation; either version 3 of the License, or (at
dnl your option) any later version.
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
dnl License for more details.
dnl You should have received a copy of the GNU Lesser General Public License
dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C AMD K8,K9 2.5
C AMD K10 2.5
C AMD bobcat 3.5
C Intel P4 4
C Intel core2 2.33
C Intel NHM 2.5
C Intel SBR 2.2
C Intel atom 5
C VIA nano 3.5
C NOTES
C * This has not been tuned for any specific processor. Its speed should not
C be too bad, though.
C * Using SSE2/AVX2 could result in many-fold speedup.
C mpn_tabselect (mp_limb_t *rp, mp_limb_t *tp, mp_size_t n, mp_size_t nents, mp_size_t which)
define(`rp', `%rdi')
define(`tp', `%rsi')
define(`n', `%rdx')
define(`nents', `%rcx')
define(`which', `%r8')
define(`i', `%rbp')
define(`maskp', `%r11')
define(`maskn', `%r12')
C rax rbx rcx rdx rdi rsi rbp (rsp) r8 r9 r10 r11 r12 r13 r14 r15
C nents n rp tab which
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_tabselect)
FUNC_ENTRY(4)
IFDOS(` mov 56(%rsp), %r8d ')
push %rbx
push %rbp
push %r12
lea (rp,n,8), rp
lea (tp,n,8), tp
sub nents, which
L(outer):
lea (which,nents), %rax
neg %rax C set CF iff 'which' != k
sbb maskn, maskn
mov maskn, maskp
not maskp
mov n, i
neg i
test $1, R32(n)
je L(top)
mov (tp,i,8), %rax
and maskp, %rax
mov (rp,i,8), %r9
and maskn, %r9
or %r9, %rax
mov %rax, (rp,i,8)
add $1, i
jns L(end)
ALIGN(16)
L(top): mov (tp,i,8), %rax
mov 8(tp,i,8), %rbx
and maskp, %rax
and maskp, %rbx
mov (rp,i,8), %r9
mov 8(rp,i,8), %r10
and maskn, %r9
and maskn, %r10
or %r9, %rax
or %r10, %rbx
mov %rax, (rp,i,8)
mov %rbx, 8(rp,i,8)
add $2, i
js L(top)
L(end): lea (tp,n,8), tp
dec nents
jne L(outer)
L(outer_end):
pop %r12
pop %rbp
pop %rbx
FUNC_EXIT()
ret
EPILOGUE()

View File

@ -1,34 +0,0 @@
Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
Z8000 MPN SUBROUTINES
This directory contains mpn functions for the Zilog Z8000.
STATUS
This code is old and has not been used for a long time.
mpn/z8000 uses a 16-bit limb, it's possible this doesn't really work, on
account of various bits of C code assuming limb>=long and of course long is
invariably at least 32 bits.

View File

@ -1,51 +0,0 @@
! Z8000 __gmpn_add_n -- Add two limb vectors of equal, non-zero length.
! Copyright 1993, 1994, 2000 Free Software Foundation, Inc.
! This file is part of the GNU MP Library.
! 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 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 Lesser General Public License
! along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
! INPUT PARAMETERS
! res_ptr r7
! s1_ptr r6
! s2_ptr r5
! size r4
! If we are really crazy, we can use push to write a few result words
! backwards, using push just because it is faster than reg+disp. We'd
! then add 2x the number of words written to r7...
unseg
.text
even
global ___gmpn_add_n
___gmpn_add_n:
pop r0,@r6
pop r1,@r5
add r0,r1
ld @r7,r0
dec r4
jr eq,Lend
Loop: pop r0,@r6
pop r1,@r5
adc r0,r1
inc r7,#2
ld @r7,r0
dec r4
jr ne,Loop
Lend: ld r2,r4 ! use 0 already in r4
adc r2,r2
ret t

View File

@ -1,21 +0,0 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
Copyright 1991, 1993, 1994, 2001 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
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 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 Lesser General Public License
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#define GMP_LIMB_BITS 16
#define BYTES_PER_MP_LIMB 2

Some files were not shown because too many files have changed in this diff Show More