Annotation of OpenXM_contrib/gmp/mpn/m68k/aors_n.asm, Revision 1.1.1.1
1.1 ohara 1: dnl mc68020 mpn_add_n, mpn_sub_n -- add or subtract limb vectors
2: dnl
3: dnl cycles/limb
4: dnl 68040: 4.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_add_n',`
30: define(M4_inst, addxl)
31: define(M4_function_n, mpn_add_n)
32: ',`ifdef(`OPERATION_sub_n',`
33: define(M4_inst, subxl)
34: define(M4_function_n, mpn_sub_n)
35: ',
36: `m4_error(`Need OPERATION_add_n or OPERATION_sub_n
37: ')')')
38:
39: MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
40:
41:
42: C INPUT PARAMETERS
43: C res_ptr (sp + 4)
44: C s1_ptr (sp + 8)
45: C s2_ptr (sp + 16)
46: C size (sp + 12)
47:
48:
49: PROLOGUE(M4_function_n)
50:
51: C Save used registers on the stack.
52: movel d2, M(-,sp)
53: movel a2, M(-,sp)
54:
55: C Copy the arguments to registers. Better use movem?
56: movel M(sp,12), a2
57: movel M(sp,16), a0
58: movel M(sp,20), a1
59: movel M(sp,24), d2
60:
61: eorw #1, d2
62: lsrl #1, d2
63: bcc L(L1)
64: subql #1, d2 C clears cy as side effect
65:
66: L(Loop):
67: movel M(a0,+), d0
68: movel M(a1,+), d1
69: M4_inst d1, d0
70: movel d0, M(a2,+)
71: L(L1): movel M(a0,+), d0
72: movel M(a1,+), d1
73: M4_inst d1, d0
74: movel d0, M(a2,+)
75:
76: dbf d2, L(Loop) C loop until 16 lsb of %4 == -1
77: subxl d0, d0 C d0 <= -cy; save cy as 0 or -1 in d0
78: subl #0x10000, d2
79: bcs L(L2)
80: addl d0, d0 C restore cy
81: bra L(Loop)
82:
83: L(L2):
84: negl d0
85:
86: C Restore used registers from stack frame.
87: movel M(sp,+), a2
88: movel M(sp,+), d2
89:
90: rts
91:
92: EPILOGUE(M4_function_n)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>