1 dnl AMD64 mpn_add_n, mpn_sub_n
3 dnl Copyright 2003, 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
5 dnl This file is part of the GNU MP Library.
7 dnl The GNU MP Library is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU Lesser General Public License as published
9 dnl by the Free Software Foundation; either version 3 of the License, or (at
10 dnl your option) any later version.
12 dnl The GNU MP Library is distributed in the hope that it will be useful, but
13 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 dnl License for more details.
17 dnl You should have received a copy of the GNU Lesser General Public License
18 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
20 include(`../config.m4')
30 C The inner loop of this code is the result of running a code generation and
31 C optimization tool suite written by David Harvey and Torbjorn Granlund.
38 define(`cy', `%r8') C (only for mpn_add_nc)
40 ifdef(`OPERATION_add_n', `
42 define(func, mpn_add_n)
43 define(func_nc, mpn_add_nc)')
44 ifdef(`OPERATION_sub_n', `
46 define(func, mpn_sub_n)
47 define(func_nc, mpn_sub_nc)')
49 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
58 bt $0, %r8 C cy flag <- carry parameter
75 L(top): ADCSBB (vp), %r8
89 L(mid): mov 16(up), %r10
93 L(end): lea 32(up), up
111 L(0): test R32(%rax), R32(%rax)
130 L(3): mov 16(up), %r10