1dnl mc68020 mpn_mul_1 -- mpn by limb multiply 2 3dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software 4dnl Foundation, Inc. 5dnl 6dnl This file is part of the GNU MP Library. 7dnl 8dnl The GNU MP Library is free software; you can redistribute it and/or 9dnl modify it under the terms of the GNU Lesser General Public License as 10dnl published by the Free Software Foundation; either version 3 of the 11dnl License, or (at your option) any later version. 12dnl 13dnl The GNU MP Library is distributed in the hope that it will be useful, 14dnl but WITHOUT ANY WARRANTY; without even the implied warranty of 15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16dnl Lesser General Public License for more details. 17dnl 18dnl You should have received a copy of the GNU Lesser General Public License 19dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 20 21include(`../config.m4') 22 23C cycles/limb 24C 68040: 24 25 26C INPUT PARAMETERS 27C res_ptr (sp + 4) 28C s1_ptr (sp + 8) 29C s1_size (sp + 12) 30C s2_limb (sp + 16) 31 32 33define(res_ptr, `a0') 34define(s1_ptr, `a1') 35define(s1_size, `d2') 36define(s2_limb, `d4') 37 38 39PROLOGUE(mpn_mul_1) 40 41C Save used registers on the stack. 42 moveml d2-d4, M(-,sp) 43 44C movel d2, M(-,sp) 45C movel d3, M(-,sp) 46C movel d4, M(-,sp) 47 48C Copy the arguments to registers. Better use movem? 49 movel M(sp,16), res_ptr 50 movel M(sp,20), s1_ptr 51 movel M(sp,24), s1_size 52 movel M(sp,28), s2_limb 53 54 eorw #1, s1_size 55 clrl d1 56 lsrl #1, s1_size 57 bcc L(L1) 58 subql #1, s1_size 59 subl d0, d0 C (d0,cy) <= (0,0) 60 61L(Loop): 62 movel M(s1_ptr,+), d3 63 mulul s2_limb, d1:d3 64 addxl d0, d3 65 movel d3, M(res_ptr,+) 66L(L1): movel M(s1_ptr,+), d3 67 mulul s2_limb, d0:d3 68 addxl d1, d3 69 movel d3, M(res_ptr,+) 70 71 dbf s1_size, L(Loop) 72 clrl d3 73 addxl d3, d0 74 subl #0x10000, s1_size 75 bcc L(Loop) 76 77C Restore used registers from stack frame. 78 moveml M(sp,+), d2-d4 79 80C movel M(sp,+),d4 81C movel M(sp,+),d3 82C movel M(sp,+),d2 83 84 rts 85 86EPILOGUE(mpn_mul_1) 87