[Gmp-commit] /var/hg/gmp: 3 new changesets
mercurial at gmplib.org
mercurial at gmplib.org
Sat Mar 10 17:05:35 CET 2012
details: /var/hg/gmp/rev/3eab63f084a9
changeset: 14744:3eab63f084a9
user: Torbjorn Granlund <tege at gmplib.org>
date: Sat Mar 10 15:39:19 2012 +0100
description:
Whitespace cleanup.
details: /var/hg/gmp/rev/f46fca94e815
changeset: 14745:f46fca94e815
user: Torbjorn Granlund <tege at gmplib.org>
date: Sat Mar 10 16:39:19 2012 +0100
description:
(mpn_addmul_2): Make static.
details: /var/hg/gmp/rev/a257b54f7e95
changeset: 14746:a257b54f7e95
user: Torbjorn Granlund <tege at gmplib.org>
date: Sat Mar 10 17:05:28 2012 +0100
description:
Add 7 more fat functions.
diffstat:
configure.in | 19 ++++++++++---------
gmp-impl.h | 38 +++++++++++++++++++++++++++++++++++++-
mpn/generic/mul_basecase.c | 1 -
mpn/generic/redc_2.c | 3 ++-
mpn/x86/fat/fat.c | 17 ++++++++++++++++-
mpn/x86/fat/fat_entry.asm | 2 +-
mpn/x86/fat/mullo_basecase.c | 21 +++++++++++++++++++++
mpn/x86/fat/redc_1.c | 21 +++++++++++++++++++++
mpn/x86/fat/redc_2.c | 21 +++++++++++++++++++++
mpn/x86/x86-defs.m4 | 7 +++++++
mpn/x86_64/fat/fat.c | 7 +++++++
mpn/x86_64/fat/fat_entry.asm | 23 +++++++++++------------
mpn/x86_64/fat/redc_2.c | 21 +++++++++++++++++++++
mpn/x86_64/x86_64-defs.m4 | 7 +++++++
tests/mpn/t-fat.c | 11 ++++++++++-
15 files changed, 192 insertions(+), 27 deletions(-)
diffs (truncated from 543 to 300 lines):
diff -r b87429c76b40 -r a257b54f7e95 configure.in
--- a/configure.in Thu Mar 08 22:45:34 2012 +0100
+++ b/configure.in Sat Mar 10 17:05:28 2012 +0100
@@ -4,7 +4,7 @@
define(GMP_COPYRIGHT,[[
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -1916,6 +1916,12 @@
gcc_cflags_cpu=""
gcc_cflags_arch=""
+ fat_functions="add_n addmul_1 bdiv_dbm1c com copyd copyi dive_1 divrem_1
+ gcd_1 lshift lshiftc mod_1 mod_1_1 mod_1_1_cps mod_1_2
+ mod_1_2_cps mod_1_4 mod_1_4_cps mod_34lsub1 mode1o mul_1
+ mul_basecase mullo_basecase pre_divrem_1 pre_mod_1 redc_1
+ redc_2 rshift sqr_basecase sub_n submul_1"
+
if test "$abi" = 32; then
extra_functions="$extra_functions fat fat_entry"
path="x86/fat x86"
@@ -1932,14 +1938,9 @@
extra_functions_64="$extra_functions_64 fat fat_entry"
path_64="x86_64/fat x86_64"
fat_path="x86_64 x86_64/fat x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bobcat x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr x86_64/atom x86_64/nano"
+ fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
fi
- fat_functions="add_n addmul_1 bdiv_dbm1c com copyd copyi
- dive_1 divrem_1 gcd_1 lshift lshiftc mod_1
- mod_1_1 mod_1_1_cps mod_1_2 mod_1_2_cps mod_1_4 mod_1_4_cps
- mod_34lsub1 mode1o
- mul_1 mul_basecase pre_divrem_1 pre_mod_1 rshift
- sqr_basecase sub_n submul_1"
fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD
SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD
BMOD_1_TO_MOD_1_THRESHOLD"
@@ -3605,9 +3606,9 @@
case "$host" in
*-*-mingw* | *-*-cygwin)
if test x$ABI = x64 ; then
- AC_MSG_NOTICE([If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.])
+ AC_MSG_NOTICE([If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.])
else
- AC_MSG_NOTICE([If wine is installed, use make check TESTS_ENVIRONMENT=wine.])
+ AC_MSG_NOTICE([If wine is installed, use make check TESTS_ENVIRONMENT=wine.])
fi
;;
esac
diff -r b87429c76b40 -r a257b54f7e95 gmp-impl.h
--- a/gmp-impl.h Thu Mar 08 22:45:34 2012 +0100
+++ b/gmp-impl.h Sat Mar 10 17:05:28 2012 +0100
@@ -58,8 +58,14 @@
they're not called directly. */
#define DECL_add_n(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
+#define DECL_addlsh1_n(name) \
+ DECL_add_n (name)
+#define DECL_addlsh2_n(name) \
+ DECL_add_n (name)
#define DECL_addmul_1(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
+#define DECL_addmul_2(name) \
+ __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_com(name) \
@@ -102,16 +108,24 @@
DECL_addmul_1 (name)
#define DECL_mul_basecase(name) \
__GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)
+#define DECL_mullo_basecase(name) \
+ __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
#define DECL_preinv_divrem_1(name) \
__GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)
#define DECL_preinv_mod_1(name) \
__GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)
+#define DECL_redc_1(name) \
+ __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
+#define DECL_redc_2(name) \
+ __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)
#define DECL_rshift(name) \
DECL_lshift (name)
#define DECL_sqr_basecase(name) \
__GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t)
#define DECL_sub_n(name) \
DECL_add_n (name)
+#define DECL_sublsh1_n(name) \
+ DECL_add_n (name)
#define DECL_submul_1(name) \
DECL_addmul_1 (name)
@@ -787,8 +801,10 @@
#define mpn_addmul_1c __MPN(addmul_1c)
__GMP_DECLSPEC mp_limb_t mpn_addmul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+#ifndef mpn_addmul_2 /* if not done with cpuvec in a fat binary */
#define mpn_addmul_2 __MPN(addmul_2)
__GMP_DECLSPEC mp_limb_t mpn_addmul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+#endif
#define mpn_addmul_3 __MPN(addmul_3)
__GMP_DECLSPEC mp_limb_t mpn_addmul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
@@ -814,8 +830,10 @@
/* mpn_addlsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+2*{b,n}, and
returns the carry out (0, 1 or 2). Use _ip1 when a=c. */
+#ifndef mpn_addlsh1_n /* if not done with cpuvec in a fat binary */
#define mpn_addlsh1_n __MPN(addlsh1_n)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#endif
#define mpn_addlsh1_nc __MPN(addlsh1_nc)
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
#if HAVE_NATIVE_mpn_addlsh1_n && ! HAVE_NATIVE_mpn_addlsh1_n_ip1
@@ -833,10 +851,12 @@
__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
#endif
+#ifndef mpn_addlsh2_n /* if not done with cpuvec in a fat binary */
/* mpn_addlsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+4*{b,n}, and
returns the carry out (0, ..., 4). Use _ip1 when a=c. */
#define mpn_addlsh2_n __MPN(addlsh2_n)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#endif
#define mpn_addlsh2_nc __MPN(addlsh2_nc)
__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
#if HAVE_NATIVE_mpn_addlsh2_n && ! HAVE_NATIVE_mpn_addlsh2_n_ip1
@@ -875,10 +895,12 @@
__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
#endif
+#ifndef mpn_sublsh1_n /* if not done with cpuvec in a fat binary */
/* mpn_sublsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-2*{b,n}, and
returns the borrow out (0, 1 or 2). Use _ip1 when a=c. */
#define mpn_sublsh1_n __MPN(sublsh1_n)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#endif
#define mpn_sublsh1_nc __MPN(sublsh1_nc)
__GMP_DECLSPEC mp_limb_t mpn_sublsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
#if HAVE_NATIVE_mpn_sublsh1_n && ! HAVE_NATIVE_mpn_sublsh1_n_ip1
@@ -1056,8 +1078,10 @@
#define mpn_mullo_n __MPN(mullo_n)
__GMP_DECLSPEC void mpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#ifndef mpn_mullo_basecase /* if not done with cpuvec in a fat binary */
#define mpn_mullo_basecase __MPN(mullo_basecase)
__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);
@@ -1079,11 +1103,16 @@
#define mpn_submul_1c __MPN(submul_1c)
__GMP_DECLSPEC mp_limb_t mpn_submul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+#ifndef mpn_redc_1 /* if not done with cpuvec in a fat binary */
#define mpn_redc_1 __MPN(redc_1)
__GMP_DECLSPEC mp_limb_t mpn_redc_1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
+#endif
+
+#ifndef mpn_redc_2 /* if not done with cpuvec in a fat binary */
#define mpn_redc_2 __MPN(redc_2)
__GMP_DECLSPEC mp_limb_t mpn_redc_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+#endif
+
#define mpn_redc_n __MPN(redc_n)
__GMP_DECLSPEC void mpn_redc_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
@@ -4444,7 +4473,10 @@
in mpn/x86/x86-defs.m4. Be sure to update that when changing here. */
struct cpuvec_t {
DECL_add_n ((*add_n));
+ DECL_addlsh1_n ((*addlsh1_n));
+ DECL_addlsh2_n ((*addlsh2_n));
DECL_addmul_1 ((*addmul_1));
+ DECL_addmul_2 ((*addmul_2));
DECL_bdiv_dbm1c ((*bdiv_dbm1c));
DECL_com ((*com));
DECL_copyd ((*copyd));
@@ -4465,11 +4497,15 @@
DECL_modexact_1c_odd ((*modexact_1c_odd));
DECL_mul_1 ((*mul_1));
DECL_mul_basecase ((*mul_basecase));
+ DECL_mullo_basecase ((*mullo_basecase));
DECL_preinv_divrem_1 ((*preinv_divrem_1));
DECL_preinv_mod_1 ((*preinv_mod_1));
+ DECL_redc_1 ((*redc_1));
+ DECL_redc_2 ((*redc_2));
DECL_rshift ((*rshift));
DECL_sqr_basecase ((*sqr_basecase));
DECL_sub_n ((*sub_n));
+ DECL_sublsh1_n ((*sublsh1_n));
DECL_submul_1 ((*submul_1));
int initialized;
mp_size_t mul_toom22_threshold;
diff -r b87429c76b40 -r a257b54f7e95 mpn/generic/mul_basecase.c
--- a/mpn/generic/mul_basecase.c Thu Mar 08 22:45:34 2012 +0100
+++ b/mpn/generic/mul_basecase.c Sat Mar 10 17:05:28 2012 +0100
@@ -4,7 +4,6 @@
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002 Free Software
Foundation, Inc.
diff -r b87429c76b40 -r a257b54f7e95 mpn/generic/redc_2.c
--- a/mpn/generic/redc_2.c Thu Mar 08 22:45:34 2012 +0100
+++ b/mpn/generic/redc_2.c Sat Mar 10 17:05:28 2012 +0100
@@ -34,7 +34,8 @@
/* For testing purposes, define our own mpn_addmul_2 if there is none already
available. */
#ifndef HAVE_NATIVE_mpn_addmul_2
-mp_limb_t
+#undef mpn_addmul_2
+static mp_limb_t
mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp)
{
rp[n] = mpn_addmul_1 (rp, up, n, vp[0]);
diff -r b87429c76b40 -r a257b54f7e95 mpn/x86/fat/fat.c
--- a/mpn/x86/fat/fat.c Thu Mar 08 22:45:34 2012 +0100
+++ b/mpn/x86/fat/fat.c Sat Mar 10 17:05:28 2012 +0100
@@ -128,7 +128,10 @@
struct cpuvec_t __gmpn_cpuvec = {
__MPN(add_n_init),
+ 0,
+ 0,
__MPN(addmul_1_init),
+ 0,
__MPN(bdiv_dbm1c_init),
__MPN(com_init),
__MPN(copyd_init),
@@ -149,11 +152,15 @@
__MPN(modexact_1c_odd_init),
__MPN(mul_1_init),
__MPN(mul_basecase_init),
+ __MPN(mullo_basecase_init),
__MPN(preinv_divrem_1_init),
__MPN(preinv_mod_1_init),
+ __MPN(redc_1_init),
+ __MPN(redc_2_init),
__MPN(rshift_init),
__MPN(sqr_basecase_init),
__MPN(sub_n_init),
+ 0,
__MPN(submul_1_init),
0
};
@@ -283,7 +290,15 @@
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
break;
- case 15:
+ case 15: /* k8 */
+ case 16: /* k10 */
+ case 17: /* "fam 11h", mix of k8 and k10 */
+ case 18: /* k10 (llano) */
+ case 19:
+ case 20: /* bobcat */
+ case 21: /* bulldozer */
+ case 22:
+ case 23:
TRACE (printf (" x86_64\n"));
goto athlon;
}
diff -r b87429c76b40 -r a257b54f7e95 mpn/x86/fat/fat_entry.asm
--- a/mpn/x86/fat/fat_entry.asm Thu Mar 08 22:45:34 2012 +0100
+++ b/mpn/x86/fat/fat_entry.asm Sat Mar 10 17:05:28 2012 +0100
@@ -118,7 +118,7 @@
L(fat_init):
C al __gmpn_cpuvec byte offset
- movsbl %al, %eax
+ movzbl %al, %eax
pushl %eax
ifdef(`PIC',`
diff -r b87429c76b40 -r a257b54f7e95 mpn/x86/fat/mullo_basecase.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mpn/x86/fat/mullo_basecase.c Sat Mar 10 17:05:28 2012 +0100
@@ -0,0 +1,21 @@
+/* Fat binary fallback mpn_mullo_basecase.
+
+Copyright 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
More information about the gmp-commit
mailing list