From 573b91127359a4c4d7fd5d0155d1e7492e42a20e Mon Sep 17 00:00:00 2001 From: jasonmoxham Date: Sun, 23 Aug 2009 22:20:49 +0000 Subject: [PATCH] New asm functions K8/K10 mpn_addlsh_n mpn_sublsh_n and carry-in varients --- config.in | 2 + configure.in | 2 + gmp-impl.h | 6 ++ mpn/asm-defs.m4 | 2 + mpn/x86_64/k8/addlsh_n.asm | 118 +++++++++++++++++++++++++++++++++++ mpn/x86_64/k8/sublsh_n.asm | 123 +++++++++++++++++++++++++++++++++++++ 6 files changed, 253 insertions(+) create mode 100644 mpn/x86_64/k8/addlsh_n.asm create mode 100644 mpn/x86_64/k8/sublsh_n.asm diff --git a/config.in b/config.in index d13cc752..cf1b79fc 100644 --- a/config.in +++ b/config.in @@ -214,6 +214,7 @@ MA 02110-1301, USA. #undef HAVE_NATIVE_mpn_addadd_n #undef HAVE_NATIVE_mpn_addlsh1_n #undef HAVE_NATIVE_mpn_addlsh_n +#undef HAVE_NATIVE_mpn_addlsh_nc #undef HAVE_NATIVE_mpn_addmul_1c #undef HAVE_NATIVE_mpn_addmul_2 #undef HAVE_NATIVE_mpn_addmul_3 @@ -273,6 +274,7 @@ MA 02110-1301, USA. #undef HAVE_NATIVE_mpn_subadd_n #undef HAVE_NATIVE_mpn_sublsh1_n #undef HAVE_NATIVE_mpn_sublsh_n +#undef HAVE_NATIVE_mpn_sublsh_nc #undef HAVE_NATIVE_mpn_submul_1c #undef HAVE_NATIVE_mpn_umul_ppmm #undef HAVE_NATIVE_mpn_umul_ppmm_r diff --git a/configure.in b/configure.in index e5f7c756..f9de492a 100644 --- a/configure.in +++ b/configure.in @@ -2962,6 +2962,7 @@ AH_VERBATIM([HAVE_NATIVE], #undef HAVE_NATIVE_mpn_addadd_n #undef HAVE_NATIVE_mpn_addlsh1_n #undef HAVE_NATIVE_mpn_addlsh_n +#undef HAVE_NATIVE_mpn_addlsh_nc #undef HAVE_NATIVE_mpn_addmul_1c #undef HAVE_NATIVE_mpn_addmul_2 #undef HAVE_NATIVE_mpn_addmul_3 @@ -3021,6 +3022,7 @@ AH_VERBATIM([HAVE_NATIVE], #undef HAVE_NATIVE_mpn_subadd_n #undef HAVE_NATIVE_mpn_sublsh1_n #undef HAVE_NATIVE_mpn_sublsh_n +#undef HAVE_NATIVE_mpn_sublsh_nc #undef HAVE_NATIVE_mpn_submul_1c #undef HAVE_NATIVE_mpn_umul_ppmm #undef HAVE_NATIVE_mpn_umul_ppmm_r diff --git a/gmp-impl.h b/gmp-impl.h index 5502526d..76250caa 100644 --- a/gmp-impl.h +++ b/gmp-impl.h @@ -823,6 +823,12 @@ __GMP_DECLSPEC mp_limb_t mpn_addlsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr #define mpn_sublsh_n __MPN(sublsh_n) __GMP_DECLSPEC mp_limb_t mpn_sublsh_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,unsigned int)); +#define mpn_addlsh_nc __MPN(addlsh_nc) +__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,unsigned int, mp_limb_t)); + +#define mpn_sublsh_nc __MPN(sublsh_nc) +__GMP_DECLSPEC mp_limb_t mpn_sublsh_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,unsigned int, mp_limb_t)); + /* mpn_rsh1add_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} + {b,n}) >> 1, and returns the bit rshifted out (0 or 1). */ #define mpn_rsh1add_n __MPN(rsh1add_n) diff --git a/mpn/asm-defs.m4 b/mpn/asm-defs.m4 index f3fbea60..7701fa96 100644 --- a/mpn/asm-defs.m4 +++ b/mpn/asm-defs.m4 @@ -1316,6 +1316,7 @@ define_mpn(add_n) define_mpn(add_nc) define_mpn(addadd_n) define_mpn(addlsh_n) +define_mpn(addlsh_nc) define_mpn(addlsh1_n) define_mpn(addmul_1) define_mpn(addmul_1c) @@ -1404,6 +1405,7 @@ define_mpn(sub_err1_n) define_mpn(sub_err2_n) define_mpn(sub_n) define_mpn(sublsh_n) +define_mpn(sublsh_nc) define_mpn(sublsh1_n) define_mpn(sqrtrem) define_mpn(store) diff --git a/mpn/x86_64/k8/addlsh_n.asm b/mpn/x86_64/k8/addlsh_n.asm new file mode 100644 index 00000000..33a77861 --- /dev/null +++ b/mpn/x86_64/k8/addlsh_n.asm @@ -0,0 +1,118 @@ +dnl AMD64 mpn_addlsh_n + +dnl Copyright 2009 Jason Moxham + +dnl This file is part of the MPIR Library. + +dnl The MPIR 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 2.1 of the License, or (at +dnl your option) any later version. + +dnl The MPIR 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 MPIR Library; see the file COPYING.LIB. If not, write +dnl to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +dnl Boston, MA 02110-1301, USA. + +include(`../config.m4') + +C carry+(xp,n)= (yp,n) + (zp,n)<