diff options
author | Thomas Voss <mail@thomasvoss.com> | 2024-06-21 23:36:36 +0200 |
---|---|---|
committer | Thomas Voss <mail@thomasvoss.com> | 2024-06-21 23:42:26 +0200 |
commit | a89a14ef5da44684a16b204e7a70460cc8c4922a (patch) | |
tree | b23b4c6b155977909ef508fdae2f48d33d802813 /vendor/gmp-6.3.0/mpn/m68k/mc68020 | |
parent | 1db63fcedab0b288820d66e100b1877b1a5a8851 (diff) |
Basic constant folding implementation
Diffstat (limited to 'vendor/gmp-6.3.0/mpn/m68k/mc68020')
-rw-r--r-- | vendor/gmp-6.3.0/mpn/m68k/mc68020/aorsmul_1.asm | 101 | ||||
-rw-r--r-- | vendor/gmp-6.3.0/mpn/m68k/mc68020/mul_1.asm | 96 | ||||
-rw-r--r-- | vendor/gmp-6.3.0/mpn/m68k/mc68020/udiv.asm | 45 | ||||
-rw-r--r-- | vendor/gmp-6.3.0/mpn/m68k/mc68020/umul.asm | 44 |
4 files changed, 286 insertions, 0 deletions
diff --git a/vendor/gmp-6.3.0/mpn/m68k/mc68020/aorsmul_1.asm b/vendor/gmp-6.3.0/mpn/m68k/mc68020/aorsmul_1.asm new file mode 100644 index 0000000..4ee30ad --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/m68k/mc68020/aorsmul_1.asm @@ -0,0 +1,101 @@ +dnl mc68020 mpn_addmul_1, mpn_submul_1 -- add or subtract mpn multiple. + +dnl Copyright 1992, 1994, 1996, 1999-2002, 2011 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C cycles/limb +C 68040: 25 + +ifdef(`OPERATION_addmul_1',` + define(M4_inst, addl) + define(M4_function_1, mpn_addmul_1) +',`ifdef(`OPERATION_submul_1',` + define(M4_inst, subl) + define(M4_function_1, mpn_submul_1) +', +`m4_error(`Need OPERATION_addmul_1 or OPERATION_submul_1 +')')') + + +C INPUT PARAMETERS +C res_ptr (sp + 4) +C s1_ptr (sp + 8) +C s1_size (sp + 12) +C s2_limb (sp + 16) + +define(res_ptr, `a0') +define(s1_ptr, `a1') +define(s1_size, `d2') +define(s2_limb, `d4') + +MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1) + +PROLOGUE(M4_function_1) + +C Save used registers on the stack. + moveml d2-d5, M(-,sp) + +C Copy the arguments to registers. Better use movem? + movel M(sp,20), res_ptr + movel M(sp,24), s1_ptr + movel M(sp,28), s1_size + movel M(sp,32), s2_limb + + eorw #1, s1_size + clrl d1 + clrl d5 + lsrl #1, s1_size + bcc L(L1) + subql #1, s1_size + subl d0, d0 C (d0,cy) <= (0,0) + +L(Loop): + movel M(s1_ptr,+), d3 + mulul s2_limb, d1:d3 + addxl d0, d3 + addxl d5, d1 + M4_inst d3, M(res_ptr,+) +L(L1): movel M(s1_ptr,+), d3 + mulul s2_limb, d0:d3 + addxl d1, d3 + addxl d5, d0 + M4_inst d3, M(res_ptr,+) + + dbf s1_size, L(Loop) + addxl d5, d0 + subl #0x10000, s1_size + bcc L(Loop) + +C Restore used registers from stack frame. + moveml M(sp,+), d2-d5 + + rts + +EPILOGUE(M4_function_1) diff --git a/vendor/gmp-6.3.0/mpn/m68k/mc68020/mul_1.asm b/vendor/gmp-6.3.0/mpn/m68k/mc68020/mul_1.asm new file mode 100644 index 0000000..f5fbb30 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/m68k/mc68020/mul_1.asm @@ -0,0 +1,96 @@ +dnl mc68020 mpn_mul_1 -- mpn by limb multiply + +dnl Copyright 1992, 1994, 1996, 1999-2002 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + +C cycles/limb +C 68040: 24 + +C INPUT PARAMETERS +C res_ptr (sp + 4) +C s1_ptr (sp + 8) +C s1_size (sp + 12) +C s2_limb (sp + 16) + + +define(res_ptr, `a0') +define(s1_ptr, `a1') +define(s1_size, `d2') +define(s2_limb, `d4') + + +PROLOGUE(mpn_mul_1) + +C Save used registers on the stack. + moveml d2-d4, M(-,sp) + +C movel d2, M(-,sp) +C movel d3, M(-,sp) +C movel d4, M(-,sp) + +C Copy the arguments to registers. Better use movem? + movel M(sp,16), res_ptr + movel M(sp,20), s1_ptr + movel M(sp,24), s1_size + movel M(sp,28), s2_limb + + eorw #1, s1_size + clrl d1 + lsrl #1, s1_size + bcc L(L1) + subql #1, s1_size + subl d0, d0 C (d0,cy) <= (0,0) + +L(Loop): + movel M(s1_ptr,+), d3 + mulul s2_limb, d1:d3 + addxl d0, d3 + movel d3, M(res_ptr,+) +L(L1): movel M(s1_ptr,+), d3 + mulul s2_limb, d0:d3 + addxl d1, d3 + movel d3, M(res_ptr,+) + + dbf s1_size, L(Loop) + clrl d3 + addxl d3, d0 + subl #0x10000, s1_size + bcc L(Loop) + +C Restore used registers from stack frame. + moveml M(sp,+), d2-d4 + +C movel M(sp,+),d4 +C movel M(sp,+),d3 +C movel M(sp,+),d2 + + rts + +EPILOGUE(mpn_mul_1) diff --git a/vendor/gmp-6.3.0/mpn/m68k/mc68020/udiv.asm b/vendor/gmp-6.3.0/mpn/m68k/mc68020/udiv.asm new file mode 100644 index 0000000..aadeab9 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/m68k/mc68020/udiv.asm @@ -0,0 +1,45 @@ +dnl mc68020 mpn_udiv_qrnnd -- 2x1 limb division + +dnl Copyright 1999-2001 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + + +C mp_limb_t mpn_udiv_qrnnd (mp_limb_t *rp, +C mp_limb_t nh, mp_limb_t nl, mp_limb_t d); +C + +PROLOGUE(mpn_udiv_qrnnd) + movel M(sp,4), a0 C rp + movel M(sp,8), d1 C nh + movel M(sp,12), d0 C nl + divul M(sp,16), d1:d0 + movel d1, M(a0) C r + rts +EPILOGUE(mpn_udiv_qrnnd) diff --git a/vendor/gmp-6.3.0/mpn/m68k/mc68020/umul.asm b/vendor/gmp-6.3.0/mpn/m68k/mc68020/umul.asm new file mode 100644 index 0000000..f19314e --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/m68k/mc68020/umul.asm @@ -0,0 +1,44 @@ +dnl mc68020 mpn_umul_ppmm -- limb by limb multiplication + +dnl Copyright 1999-2001 Free Software Foundation, Inc. + +dnl This file is part of the GNU MP Library. +dnl +dnl The GNU MP Library is free software; you can redistribute it and/or modify +dnl it under the terms of either: +dnl +dnl * the GNU Lesser General Public License as published by the Free +dnl Software Foundation; either version 3 of the License, or (at your +dnl option) any later version. +dnl +dnl or +dnl +dnl * the GNU General Public License as published by the Free Software +dnl Foundation; either version 2 of the License, or (at your option) any +dnl later version. +dnl +dnl or both in parallel, as here. +dnl +dnl The GNU MP Library is distributed in the hope that it will be useful, but +dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +dnl for more details. +dnl +dnl You should have received copies of the GNU General Public License and the +dnl GNU Lesser General Public License along with the GNU MP Library. If not, +dnl see https://www.gnu.org/licenses/. + +include(`../config.m4') + + +C mp_limb_t mpn_umul_ppmm (mp_limb_t *lp, mp_limb_t x, mp_limb_t y); +C + +PROLOGUE(mpn_umul_ppmm) + movel M(sp,4), a0 C lp + movel M(sp,8), d1 C x + movel M(sp,12), d0 C y + mulul d0, d0:d1 + movel d1, M(a0) C low + rts +EPILOGUE(mpn_umul_ppmm) |