1 dnl Intel Pentium mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
3 dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
6 dnl This file is part of the GNU MP Library.
8 dnl The GNU MP Library is free software; you can redistribute it and/or
9 dnl modify it under the terms of the GNU Lesser General Public License as
10 dnl published by the Free Software Foundation; either version 3 of the
11 dnl License, or (at your option) any later version.
13 dnl The GNU MP Library is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 dnl Lesser General Public License for more details.
18 dnl You should have received a copy of the GNU Lesser General Public License
19 dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
21 include(`../config.m4')
24 C P5: 2.375 cycles/limb
27 ifdef(`OPERATION_add_n',`
29 define(M4_function_n, mpn_add_n)
30 define(M4_function_nc, mpn_add_nc)
32 ',`ifdef(`OPERATION_sub_n',`
34 define(M4_function_n, mpn_sub_n)
35 define(M4_function_nc, mpn_sub_nc)
37 ',`m4_error(`Need OPERATION_add_n or OPERATION_sub_n
40 MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
43 C mp_limb_t M4_function_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
45 C mp_limb_t M4_function_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
46 C mp_size_t size, mp_limb_t carry);
48 defframe(PARAM_CARRY,20)
49 defframe(PARAM_SIZE, 16)
50 defframe(PARAM_SRC2, 12)
51 defframe(PARAM_SRC1, 8)
52 defframe(PARAM_DST, 4)
56 PROLOGUE(M4_function_nc)
75 testl %ecx,%ecx C zero carry flag
81 shrl $1,%eax C shift bit 0 into carry
87 shrl $1,%eax C shift bit 0 into carry
94 PROLOGUE(M4_function_n)
113 testl %ecx,%ecx C zero carry flag
119 L(oop): movl 28(%edi),%eax C fetch destination cache line
122 L(1): movl (%esi),%eax
131 L(2): movl 8(%esi),%eax
140 L(3): movl 16(%esi),%eax
149 L(4): movl 24(%esi),%eax
166 decl %edx C test %edx w/o clobbering carry