1/* mc68020 __mpn_submul_1 -- Multiply a limb vector with a limb and subtract 2 the result from a second limb vector. 3 4Copyright (C) 1992, 1994, 1996, 1998 Free Software Foundation, Inc. 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 Lesser General Public License as published by 10the Free Software Foundation; either version 2.1 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 Lesser General Public 16License for more details. 17 18You should have received a copy of the GNU Lesser General Public License 19along with the GNU MP Library; see the file COPYING.LIB. If not, write to 20the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 21MA 02111-1307, USA. */ 22 23/* 24 INPUT PARAMETERS 25 res_ptr (sp + 4) 26 s1_ptr (sp + 8) 27 s1_size (sp + 12) 28 s2_limb (sp + 16) 29*/ 30 31#include "sysdep.h" 32#include "asm-syntax.h" 33 34 TEXT 35ENTRY(__mpn_submul_1) 36 37#define res_ptr a0 38#define s1_ptr a1 39#define s1_size d2 40#define s2_limb d4 41 42/* Save used registers on the stack. */ 43 moveml R(d2)-R(d5),MEM_PREDEC(sp) 44 45/* Copy the arguments to registers. Better use movem? */ 46 movel MEM_DISP(sp,20),R(res_ptr) 47 movel MEM_DISP(sp,24),R(s1_ptr) 48 movel MEM_DISP(sp,28),R(s1_size) 49 movel MEM_DISP(sp,32),R(s2_limb) 50 51 eorw #1,R(s1_size) 52 clrl R(d1) 53 clrl R(d5) 54 lsrl #1,R(s1_size) 55 bcc L(L1) 56 subql #1,R(s1_size) 57 subl R(d0),R(d0) /* (d0,cy) <= (0,0) */ 58 59L(Loop:) 60 movel MEM_POSTINC(s1_ptr),R(d3) 61 mulul R(s2_limb),R(d1):R(d3) 62 addxl R(d0),R(d3) 63 addxl R(d5),R(d1) 64 subl R(d3),MEM_POSTINC(res_ptr) 65L(L1:) movel MEM_POSTINC(s1_ptr),R(d3) 66 mulul R(s2_limb),R(d0):R(d3) 67 addxl R(d1),R(d3) 68 addxl R(d5),R(d0) 69 subl R(d3),MEM_POSTINC(res_ptr) 70 71 dbf R(s1_size),L(Loop) 72 addxl R(d5),R(d0) 73 subl #0x10000,R(s1_size) 74 bcc L(Loop) 75 76/* Restore used registers from stack frame. */ 77 moveml MEM_POSTINC(sp),R(d2)-R(d5) 78 79 rts 80END(__mpn_submul_1) 81