]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/m68k/add_n.S
Removed, we can use the generic Linux version.
[thirdparty/glibc.git] / sysdeps / m68k / add_n.S
CommitLineData
2b30df17
RM
1/* mc68020 __mpn_add_n -- Add two limb vectors of the same length > 0 and store
2 sum in a third limb vector.
3
56d7f029 4Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc.
2b30df17
RM
5
6This file is part of the GNU MP Library.
7
8The GNU MP Library is free software; you can redistribute it and/or modify
9it under the terms of the GNU Library General Public License as published by
10the Free Software Foundation; either version 2 of the License, or (at your
11option) any later version.
12
13The GNU MP Library is distributed in the hope that it will be useful, but
14WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16License for more details.
17
18You should have received a copy of the GNU Library General Public License
19along with the GNU MP Library; see the file COPYING.LIB. If not, write to
6c07070b
RM
20the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21MA 02111-1307, USA. */
2b30df17
RM
22
23/*
24 INPUT PARAMETERS
25 res_ptr (sp + 4)
26 s1_ptr (sp + 8)
27 s2_ptr (sp + 16)
28 size (sp + 12)
29*/
30
3de9f02e 31#include "sysdep.h"
2b30df17
RM
32#include "asm-syntax.h"
33
34 TEXT
56d7f029 35ENTRY(__mpn_add_n)
2b30df17 36/* Save used registers on the stack. */
3de9f02e
RM
37 movel R(d2),MEM_PREDEC(sp)
38 movel R(a2),MEM_PREDEC(sp)
2b30df17
RM
39
40/* Copy the arguments to registers. Better use movem? */
3de9f02e
RM
41 movel MEM_DISP(sp,12),R(a2)
42 movel MEM_DISP(sp,16),R(a0)
43 movel MEM_DISP(sp,20),R(a1)
44 movel MEM_DISP(sp,24),R(d2)
45
46 eorw #1,R(d2)
47 lsrl #1,R(d2)
48 bcc L(L1)
49 subql #1,R(d2) /* clears cy as side effect */
50
51L(Loop:)
52 movel MEM_POSTINC(a0),R(d0)
53 movel MEM_POSTINC(a1),R(d1)
54 addxl R(d1),R(d0)
55 movel R(d0),MEM_POSTINC(a2)
56L(L1:) movel MEM_POSTINC(a0),R(d0)
57 movel MEM_POSTINC(a1),R(d1)
58 addxl R(d1),R(d0)
59 movel R(d0),MEM_POSTINC(a2)
60
61 dbf R(d2),L(Loop) /* loop until 16 lsb of %4 == -1 */
62 subxl R(d0),R(d0) /* d0 <= -cy; save cy as 0 or -1 in d0 */
63 subl #0x10000,R(d2)
64 bcs L(L2)
65 addl R(d0),R(d0) /* restore cy */
66 bra L(Loop)
67
68L(L2:)
69 negl R(d0)
2b30df17
RM
70
71/* Restore used registers from stack frame. */
3de9f02e
RM
72 movel MEM_POSTINC(sp),R(a2)
73 movel MEM_POSTINC(sp),R(d2)
2b30df17
RM
74
75 rts
56d7f029 76END(__mpn_add_n)