github.com/aergoio/aergo@v1.3.1/libtool/src/gmp-6.1.2/mpn/m68k/mc68020/aorsmul_1.asm (about) 1 dnl mc68020 mpn_addmul_1, mpn_submul_1 -- add or subtract mpn multiple. 2 3 dnl Copyright 1992, 1994, 1996, 1999-2002, 2011 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: 25 35 36 ifdef(`OPERATION_addmul_1',` 37 define(M4_inst, addl) 38 define(M4_function_1, mpn_addmul_1) 39 ',`ifdef(`OPERATION_submul_1',` 40 define(M4_inst, subl) 41 define(M4_function_1, mpn_submul_1) 42 ', 43 `m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1 44 ')')') 45 46 47 C INPUT PARAMETERS 48 C res_ptr (sp + 4) 49 C s1_ptr (sp + 8) 50 C s1_size (sp + 12) 51 C s2_limb (sp + 16) 52 53 define(res_ptr, `a0') 54 define(s1_ptr, `a1') 55 define(s1_size, `d2') 56 define(s2_limb, `d4') 57 58 MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1) 59 60 PROLOGUE(M4_function_1) 61 62 C Save used registers on the stack. 63 moveml d2-d5, M(-,sp) 64 65 C Copy the arguments to registers. Better use movem? 66 movel M(sp,20), res_ptr 67 movel M(sp,24), s1_ptr 68 movel M(sp,28), s1_size 69 movel M(sp,32), s2_limb 70 71 eorw #1, s1_size 72 clrl d1 73 clrl d5 74 lsrl #1, s1_size 75 bcc L(L1) 76 subql #1, s1_size 77 subl d0, d0 C (d0,cy) <= (0,0) 78 79 L(Loop): 80 movel M(s1_ptr,+), d3 81 mulul s2_limb, d1:d3 82 addxl d0, d3 83 addxl d5, d1 84 M4_inst d3, M(res_ptr,+) 85 L(L1): movel M(s1_ptr,+), d3 86 mulul s2_limb, d0:d3 87 addxl d1, d3 88 addxl d5, d0 89 M4_inst d3, M(res_ptr,+) 90 91 dbf s1_size, L(Loop) 92 addxl d5, d0 93 subl #0x10000, s1_size 94 bcc L(Loop) 95 96 C Restore used registers from stack frame. 97 moveml M(sp,+), d2-d5 98 99 rts 100 101 EPILOGUE(M4_function_1)