1 /* mc68020 __mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
2 store difference in a third limb vector.
4 Copyright (C) 1992, 1994, 1996 Free Software Foundation, Inc.
6 This file is part of the GNU MP Library.
8 The GNU MP Library is free software; you can redistribute it and/or modify
9 it under the terms of the GNU Library General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or (at your
11 option) any later version.
13 The GNU MP Library is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
16 License for more details.
18 You should have received a copy of the GNU Library General Public License
19 along with the GNU MP Library; see the file COPYING.LIB. If not, write to
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
21 MA 02111-1307, USA. */
32 #include "asm-syntax.h"
36 GLOBL C_SYMBOL_NAME(__mpn_sub_n)
38 C_SYMBOL_NAME(__mpn_sub_n:)
40 /* Save used registers on the stack. */
41 movel R(d2),MEM_PREDEC(sp)
42 movel R(a2),MEM_PREDEC(sp)
44 /* Copy the arguments to registers. Better use movem? */
45 movel MEM_DISP(sp,12),R(a2)
46 movel MEM_DISP(sp,16),R(a0)
47 movel MEM_DISP(sp,20),R(a1)
48 movel MEM_DISP(sp,24),R(d2)
53 subql #1,R(d2) /* clears cy as side effect */
56 movel MEM_POSTINC(a0),R(d0)
57 movel MEM_POSTINC(a1),R(d1)
59 movel R(d0),MEM_POSTINC(a2)
60 L(L1:) movel MEM_POSTINC(a0),R(d0)
61 movel MEM_POSTINC(a1),R(d1)
63 movel R(d0),MEM_POSTINC(a2)
65 dbf R(d2),L(Loop) /* loop until 16 lsb of %4 == -1 */
66 subxl R(d0),R(d0) /* d0 <= -cy; save cy as 0 or -1 in d0 */
69 addl R(d0),R(d0) /* restore cy */
75 /* Restore used registers from stack frame. */
76 movel MEM_POSTINC(sp),R(a2)
77 movel MEM_POSTINC(sp),R(d2)