1 dnl Intel Atom mpn_addlshC_n/mpn_sublshC_n -- rp[] = up[] +- (vp[] << C)
3 dnl Contributed to the GNU project by Marco Bodrato.
5 dnl Copyright 2011 Free Software Foundation, Inc.
7 dnl This file is part of the GNU MP Library.
9 dnl The GNU MP Library is free software; you can redistribute it and/or modify
10 dnl it under the terms of either:
12 dnl * the GNU Lesser General Public License as published by the Free
13 dnl Software Foundation; either version 3 of the License, or (at your
14 dnl option) any later version.
18 dnl * the GNU General Public License as published by the Free Software
19 dnl Foundation; either version 2 of the License, or (at your option) any
22 dnl or both in parallel, as here.
24 dnl The GNU MP Library is distributed in the hope that it will be useful, but
25 dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
29 dnl You should have received copies of the GNU General Public License and the
30 dnl GNU Lesser General Public License along with the GNU MP Library. If not,
31 dnl see https://www.gnu.org/licenses/.
33 include(`../config.m4')
35 C mp_limb_t mpn_addlshC_n_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size);
36 C mp_limb_t mpn_addlshC_nc_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
38 C mp_limb_t mpn_sublshC_n_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,);
39 C mp_limb_t mpn_sublshC_nc_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
40 C mp_signed_limb_t borrow);
42 defframe(PARAM_CORB, 16)
43 defframe(PARAM_SIZE, 12)
44 defframe(PARAM_SRC, 8)
45 defframe(PARAM_DST, 4)
47 C mp_limb_t mpn_addlshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
49 C mp_limb_t mpn_addlshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
50 C mp_size_t size, mp_limb_t carry);
51 C mp_limb_t mpn_sublshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
53 C mp_limb_t mpn_sublshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
54 C mp_size_t size, mp_limb_t borrow);
56 C if src1 == dst, _ip1 is used
59 C dst!=src1,src2 dst==src1
63 C P6 model 13 (Dothan)
64 C P4 model 0 (Willamette)
66 C P4 model 2 (Northwood)
67 C P4 model 3 (Prescott)
75 defframe(GPARAM_CORB, 20)
76 defframe(GPARAM_SIZE, 16)
77 defframe(GPARAM_SRC2, 12)
79 dnl re-use parameter space
80 define(SAVE_EBP,`PARAM_SIZE')
81 define(SAVE_EBX,`PARAM_SRC')
82 define(SAVE_UP,`PARAM_DST')
84 define(M, eval(m4_lshift(1,LSH)))
92 PROLOGUE(M4_ip_function_c)
102 PROLOGUE(M4_ip_function)
108 push rp FRAME_pushl()
113 mov PARAM_SIZE, %ebx C size
116 shr %ebx C (size+1)\2
118 jnc L(entry) C size odd
120 add %edx, %edx C size even
124 lea (%ebp,%ecx,M), %eax
130 lea (%ecx,%eax,M), %ebp
136 lea (%eax,%ecx,M), %eax
150 lea (%ecx,%eax,M), %ebp
162 PROLOGUE(M4_function_c)
164 movl GPARAM_CORB, %ecx
172 PROLOGUE(M4_function)
178 push rp FRAME_pushl()
185 mov GPARAM_SIZE, %ebx C size
190 mov GPARAM_SIZE, %eax C size
194 mov GPARAM_SRC2, up C up
195 shr %eax C (size+1)\2
197 mov %eax, GPARAM_SIZE
198 jnc L(entry2) C size odd
200 add %edx, %edx C size even
205 lea (%ebp,%ecx,M), %eax
211 lea (%ecx,%eax,M), %ebp
218 lea (%eax,%ecx,M), %eax
233 lea (%ecx,%eax,M), %ebp