Annotation of OpenXM_contrib/gmp/mpn/m68k/mc68020/aorsmul_1.asm, Revision 1.1.1.1
1.1 ohara 1: dnl mc68020 mpn_addmul_1, mpn_submul_1 -- add or subtract mpn multiple.
2: dnl
3: dnl cycles/limb
4: dnl 68040: 20.5
5:
6: dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001 Free Software Foundation,
7: dnl Inc.
8: dnl
9: dnl This file is part of the GNU MP Library.
10: dnl
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.
15: dnl
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.
20: dnl
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.
25:
26: include(`../config.m4')
27:
28:
29: ifdef(`OPERATION_addmul_1',`
30: define(M4_inst, addl)
31: define(M4_function_1, mpn_addmul_1)
32: ',`ifdef(`OPERATION_submul_1',`
33: define(M4_inst, subl)
34: define(M4_function_1, mpn_submul_1)
35: ',
36: `m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1
37: ')')')
38:
39:
40: C INPUT PARAMETERS
41: C res_ptr (sp + 4)
42: C s1_ptr (sp + 8)
43: C s1_size (sp + 12)
44: C s2_limb (sp + 16)
45:
46: define(res_ptr, `a0')
47: define(s1_ptr, `a1')
48: define(s1_size, `d2')
49: define(s2_limb, `d4')
50:
51:
52: PROLOGUE(M4_function_1)
53:
54: C Save used registers on the stack.
55: moveml d2-d5, M(-,sp)
56:
57: C Copy the arguments to registers. Better use movem?
58: movel M(sp,20), res_ptr
59: movel M(sp,24), s1_ptr
60: movel M(sp,28), s1_size
61: movel M(sp,32), s2_limb
62:
63: eorw #1, s1_size
64: clrl d1
65: clrl d5
66: lsrl #1, s1_size
67: bcc L(L1)
68: subql #1, s1_size
69: subl d0, d0 C (d0,cy) <= (0,0)
70:
71: L(Loop):
72: movel M(s1_ptr,+), d3
73: mulul s2_limb, d1:d3
74: addxl d0, d3
75: addxl d5, d1
76: M4_inst d3, M(res_ptr,+)
77: L(L1): movel M(s1_ptr,+), d3
78: mulul s2_limb, d0:d3
79: addxl d1, d3
80: addxl d5, d0
81: M4_inst d3, M(res_ptr,+)
82:
83: dbf s1_size, L(Loop)
84: addxl d5, d0
85: subl #0x10000, s1_size
86: bcc L(Loop)
87:
88: C Restore used registers from stack frame.
89: moveml M(sp,+), d2-d5
90:
91: rts
92:
93: EPILOGUE(M4_function_1)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>