1 dnl Intel Pentium mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
3 dnl P5: 2.375 cycles/limb
6 dnl Copyright (C) 1992, 1994, 1995, 1996, 1999, 2000 Free Software
9 dnl This file is part of the GNU MP Library.
11 dnl The GNU MP Library is free software; you can redistribute it and/or
12 dnl modify it under the terms of the GNU Lesser General Public License as
13 dnl published by the Free Software Foundation; either version 2.1 of the
14 dnl License, or (at your option) any later version.
16 dnl The GNU MP Library is distributed in the hope that it will be useful,
17 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
18 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 dnl Lesser General Public License for more details.
21 dnl You should have received a copy of the GNU Lesser General Public
22 dnl License along with the GNU MP Library; see the file COPYING.LIB. If
23 dnl not, write to the Free Software Foundation, Inc., 59 Temple Place -
24 dnl Suite 330, Boston, MA 02111-1307, USA.
27 include(`../config.m4')
30 ifdef(`OPERATION_add_n',`
32 define(M4_function_n, mpn_add_n)
33 define(M4_function_nc, mpn_add_nc)
35 ',`ifdef(`OPERATION_sub_n',`
37 define(M4_function_n, mpn_sub_n)
38 define(M4_function_nc, mpn_sub_nc)
40 ',`m4_error(`Need OPERATION_add_n or OPERATION_sub_n
43 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
46 C mp_limb_t M4_function_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
48 C mp_limb_t M4_function_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
49 C mp_size_t size, mp_limb_t carry);
51 defframe(PARAM_CARRY,20)
52 defframe(PARAM_SIZE, 16)
53 defframe(PARAM_SRC2, 12)
54 defframe(PARAM_SRC1, 8)
55 defframe(PARAM_DST, 4)
59 PROLOGUE(M4_function_nc)
78 testl %ecx,%ecx C zero carry flag
84 shrl $1,%eax C shift bit 0 into carry
85 jmp LF(M4_function_n,oop)
90 shrl $1,%eax C shift bit 0 into carry
91 jmp LF(M4_function_n,end)
97 PROLOGUE(M4_function_n)
116 testl %ecx,%ecx C zero carry flag
122 L(oop): movl 28(%edi),%eax C fetch destination cache line
125 L(1): movl (%esi),%eax
134 L(2): movl 8(%esi),%eax
143 L(3): movl 16(%esi),%eax
152 L(4): movl 24(%esi),%eax
169 decl %edx C test %edx w/o clobbering carry