dnl AMD64 mpn_gcd_1 -- mpn by 1 gcd.
dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
dnl Granlund.
dnl Copyright 2000, 2001, 2002, 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')
C K8: 6.75 cycles/bit (approx) 1x1 gcd
C 10.0 cycles/limb Nx1 reduction (modexact_1_odd)
dnl Reduce using x%y if x is more than DIV_THRESHOLD bits bigger than y,
dnl where x is the larger of the two. See tune/README for more.
dnl
dnl div at 80 cycles compared to the gcd at about 7 cycles/bitpair
dnl suggests 80/7*2=23
deflit(DIV_THRESHOLD, 23)
C table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
deflit(MAXSHIFT, 6)
deflit(MASK, eval((1<