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