From a89a14ef5da44684a16b204e7a70460cc8c4922a Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 21 Jun 2024 23:36:36 +0200 Subject: Basic constant folding implementation --- .../gmp-6.3.0/mpn/sparc32/ultrasparct1/add_n.asm | 70 ++++++++++ .../mpn/sparc32/ultrasparct1/addmul_1.asm | 90 ++++++++++++ .../mpn/sparc32/ultrasparct1/gmp-mparam.h | 153 +++++++++++++++++++++ .../gmp-6.3.0/mpn/sparc32/ultrasparct1/mul_1.asm | 83 +++++++++++ .../mpn/sparc32/ultrasparct1/sqr_diagonal.asm | 55 ++++++++ .../gmp-6.3.0/mpn/sparc32/ultrasparct1/sub_n.asm | 70 ++++++++++ .../mpn/sparc32/ultrasparct1/submul_1.asm | 91 ++++++++++++ 7 files changed, 612 insertions(+) create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/add_n.asm create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/addmul_1.asm create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/gmp-mparam.h create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/mul_1.asm create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sqr_diagonal.asm create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sub_n.asm create mode 100644 vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/submul_1.asm (limited to 'vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1') diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/add_n.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/add_n.asm new file mode 100644 index 0000000..c781596 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/add_n.asm @@ -0,0 +1,70 @@ +dnl SPARC T1 32-bit mpn_add_n. + +dnl Copyright 2010 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 INPUT PARAMETERS +define(`rp', %o0) +define(`ap', %o1) +define(`bp', %o2) +define(`n', %o3) +define(`cy', %o4) + +define(`i', %o3) + +MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc) + +ASM_START() +PROLOGUE(mpn_add_nc) + b L(ent) + srl cy, 0, cy C strip any bogus high bits +EPILOGUE() + +PROLOGUE(mpn_add_n) + mov 0, cy +L(ent): srl n, 0, n C strip any bogus high bits + sll n, 2, n + add ap, n, ap + add bp, n, bp + add rp, n, rp + neg n, i + +L(top): lduw [ap+i], %g1 + lduw [bp+i], %g2 + add %g1, %g2, %g3 + add %g3, cy, %g3 + stw %g3, [rp+i] + add i, 4, i + brnz i, L(top) + srlx %g3, 32, cy + + retl + mov cy, %o0 C return value +EPILOGUE() diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/addmul_1.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/addmul_1.asm new file mode 100644 index 0000000..89da186 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/addmul_1.asm @@ -0,0 +1,90 @@ +dnl SPARC T1 32-bit mpn_addmul_1. + +dnl Contributed to the GNU project by David Miller. + +dnl Copyright 2010, 2013 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 UltraSPARC T1: 24 +C UltraSPARC T2: 19 +C UltraSPARC T3: 19 +C UltraSPARC T4: 5 + +C INPUT PARAMETERS +define(`rp', `%i0') +define(`up', `%i1') +define(`n', `%i2') +define(`v0', `%i3') + +ASM_START() +PROLOGUE(mpn_addmul_1) + save %sp, -96, %sp + srl n, 0, %o4 + srl v0, 0, %g1 + subcc %o4, 1, %o4 + be L(final_one) + clr %o5 + +L(top): lduw [up+0], %l0 + lduw [rp+0], %l2 + lduw [up+4], %l1 + lduw [rp+4], %l3 + mulx %l0, %g1, %g3 + add up, 8, up + mulx %l1, %g1, %o3 + sub %o4, 2, %o4 + add rp, 8, rp + add %l2, %g3, %g3 + add %o5, %g3, %g3 + stw %g3, [rp-8] + srlx %g3, 32, %o5 + add %l3, %o3, %o3 + add %o5, %o3, %o3 + stw %o3, [rp-4] + brgz %o4, L(top) + srlx %o3, 32, %o5 + + brlz,pt %o4, L(done) + nop + +L(final_one): + lduw [up+0], %l0 + lduw [rp+0], %l2 + mulx %l0, %g1, %g3 + add %l2, %g3, %g3 + add %o5, %g3, %g3 + stw %g3, [rp+0] + srlx %g3, 32, %o5 + +L(done): + ret + restore %o5, 0, %o0 +EPILOGUE() diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/gmp-mparam.h b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/gmp-mparam.h new file mode 100644 index 0000000..6f9d5a4 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/gmp-mparam.h @@ -0,0 +1,153 @@ +/* UltraSPARC T 32-bit gmp-mparam.h -- Compiler/machine parameter header file. + +Copyright 1991, 1993, 1994, 2000-2011 Free Software Foundation, Inc. + +This file is part of the GNU MP Library. + +The GNU MP Library is free software; you can redistribute it and/or modify +it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + +or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + +or both in parallel, as here. + +The GNU MP Library is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received copies of the GNU General Public License and the +GNU Lesser General Public License along with the GNU MP Library. If not, +see https://www.gnu.org/licenses/. */ + +#define DIVREM_1_NORM_THRESHOLD 0 /* always */ +#define DIVREM_1_UNNORM_THRESHOLD 3 +#define MOD_1_1P_METHOD 2 +#define MOD_1_NORM_THRESHOLD 0 /* always */ +#define MOD_1_UNNORM_THRESHOLD 0 /* always */ +#define MOD_1N_TO_MOD_1_1_THRESHOLD 9 +#define MOD_1U_TO_MOD_1_1_THRESHOLD 10 +#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */ +#define MOD_1_2_TO_MOD_1_4_THRESHOLD 21 +#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 22 +#define USE_PREINV_DIVREM_1 1 +#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */ +#define DIVEXACT_1_THRESHOLD 0 /* always */ +#define BMOD_1_TO_MOD_1_THRESHOLD 35 + +#define MUL_TOOM22_THRESHOLD 14 +#define MUL_TOOM33_THRESHOLD 98 +#define MUL_TOOM44_THRESHOLD 166 +#define MUL_TOOM6H_THRESHOLD 226 +#define MUL_TOOM8H_THRESHOLD 333 + +#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97 +#define MUL_TOOM32_TO_TOOM53_THRESHOLD 139 +#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97 +#define MUL_TOOM42_TO_TOOM63_THRESHOLD 98 +#define MUL_TOOM43_TO_TOOM54_THRESHOLD 120 + +#define SQR_BASECASE_THRESHOLD 6 +#define SQR_TOOM2_THRESHOLD 34 +#define SQR_TOOM3_THRESHOLD 110 +#define SQR_TOOM4_THRESHOLD 178 +#define SQR_TOOM6_THRESHOLD 240 +#define SQR_TOOM8_THRESHOLD 333 + +#define MULMID_TOOM42_THRESHOLD 22 + +#define MULMOD_BNM1_THRESHOLD 9 +#define SQRMOD_BNM1_THRESHOLD 13 + +#define MUL_FFT_MODF_THRESHOLD 280 /* k = 5 */ +#define MUL_FFT_TABLE3 \ + { { 280, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \ + { 9, 5}, { 19, 6}, { 13, 7}, { 7, 6}, \ + { 17, 7}, { 9, 6}, { 20, 7}, { 11, 6}, \ + { 23, 7}, { 13, 8}, { 7, 7}, { 21, 8}, \ + { 11, 7}, { 25, 9}, { 7, 8}, { 15, 7}, \ + { 33, 8}, { 19, 7}, { 41, 8}, { 23, 7}, \ + { 49, 8}, { 27, 9}, { 15, 8}, { 31, 7}, \ + { 63, 8}, { 39, 9}, { 23, 8}, { 47,10}, \ + { 15, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \ + { 79, 9}, { 47,10}, { 31, 9}, { 79,10}, \ + { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \ + { 255,10}, { 79, 9}, { 159, 8}, { 319,10}, \ + { 95, 9}, { 191, 8}, { 383,11}, { 63,10}, \ + { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \ + { 159, 9}, { 319,10}, { 175,11}, { 95,10}, \ + { 191, 9}, { 383,12}, { 4096,13}, { 8192,14}, \ + { 16384,15}, { 32768,16} } +#define MUL_FFT_TABLE3_SIZE 66 +#define MUL_FFT_THRESHOLD 3712 + +#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */ +#define SQR_FFT_TABLE3 \ + { { 240, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \ + { 13, 7}, { 7, 6}, { 17, 7}, { 9, 6}, \ + { 20, 7}, { 11, 6}, { 23, 7}, { 13, 8}, \ + { 7, 7}, { 19, 8}, { 11, 7}, { 25, 9}, \ + { 7, 8}, { 15, 7}, { 33, 8}, { 19, 7}, \ + { 39, 8}, { 23, 7}, { 47, 8}, { 27, 9}, \ + { 15, 8}, { 39, 9}, { 23, 8}, { 47,10}, \ + { 15, 9}, { 31, 8}, { 63, 9}, { 39, 8}, \ + { 79, 9}, { 47,10}, { 31, 9}, { 63, 8}, \ + { 127, 9}, { 71, 8}, { 143, 9}, { 79,10}, \ + { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \ + { 255, 9}, { 143,10}, { 79, 9}, { 159, 8}, \ + { 319, 9}, { 175,10}, { 95, 9}, { 191, 8}, \ + { 383, 9}, { 207,11}, { 63,10}, { 127, 9}, \ + { 255,10}, { 143, 9}, { 287,10}, { 159, 9}, \ + { 319,10}, { 175,11}, { 95,10}, { 191, 9}, \ + { 383,10}, { 207,12}, { 4096,13}, { 8192,14}, \ + { 16384,15}, { 32768,16} } +#define SQR_FFT_TABLE3_SIZE 70 +#define SQR_FFT_THRESHOLD 2624 + +#define MULLO_BASECASE_THRESHOLD 0 /* always */ +#define MULLO_DC_THRESHOLD 51 +#define MULLO_MUL_N_THRESHOLD 6633 + +#define DC_DIV_QR_THRESHOLD 51 +#define DC_DIVAPPR_Q_THRESHOLD 202 +#define DC_BDIV_QR_THRESHOLD 47 +#define DC_BDIV_Q_THRESHOLD 124 + +#define INV_MULMOD_BNM1_THRESHOLD 26 +#define INV_NEWTON_THRESHOLD 266 +#define INV_APPR_THRESHOLD 222 + +#define BINV_NEWTON_THRESHOLD 296 +#define REDC_1_TO_REDC_N_THRESHOLD 59 + +#define MU_DIV_QR_THRESHOLD 1334 +#define MU_DIVAPPR_Q_THRESHOLD 1499 +#define MUPI_DIV_QR_THRESHOLD 116 +#define MU_BDIV_QR_THRESHOLD 1057 +#define MU_BDIV_Q_THRESHOLD 1334 + +#define POWM_SEC_TABLE 6,35,213,724,2618 + +#define MATRIX22_STRASSEN_THRESHOLD 15 +#define HGCD_THRESHOLD 84 +#define HGCD_APPR_THRESHOLD 101 +#define HGCD_REDUCE_THRESHOLD 1437 +#define GCD_DC_THRESHOLD 372 +#define GCDEXT_DC_THRESHOLD 253 +#define JACOBI_BASE_METHOD 2 + +#define GET_STR_DC_THRESHOLD 12 +#define GET_STR_PRECOMPUTE_THRESHOLD 27 +#define SET_STR_DC_THRESHOLD 399 +#define SET_STR_PRECOMPUTE_THRESHOLD 885 + +#define FAC_DSC_THRESHOLD 179 +#define FAC_ODD_THRESHOLD 29 diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/mul_1.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/mul_1.asm new file mode 100644 index 0000000..0239cd2 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/mul_1.asm @@ -0,0 +1,83 @@ +dnl SPARC T1 32-bit mpn_mul_1. + +dnl Contributed to the GNU project by David Miller. + +dnl Copyright 2010, 2013 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 UltraSPARC T1: 20 +C UltraSPARC T2: 18 +C UltraSPARC T3: 18 +C UltraSPARC T4: 4 + +C INPUT PARAMETERS +define(`rp', `%o0') +define(`up', `%o1') +define(`n', `%o2') +define(`v0', `%o3') + +ASM_START() +PROLOGUE(mpn_mul_1) + srl n, 0, n + srl v0, 0, v0 + subcc n, 1, n + be L(final_one) + clr %o5 + +L(top): lduw [up+0], %g1 + lduw [up+4], %g2 + mulx %g1, v0, %g3 + add up, 8, up + mulx %g2, v0, %o4 + sub n, 2, n + add rp, 8, rp + add %o5, %g3, %g3 + stw %g3, [rp-8] + srlx %g3, 32, %o5 + add %o5, %o4, %o4 + stw %o4, [rp-4] + brgz n, L(top) + srlx %o4, 32, %o5 + + brlz,pt n, L(done) + nop + +L(final_one): + lduw [up+0], %g1 + mulx %g1, v0, %g3 + add %o5, %g3, %g3 + stw %g3, [rp+0] + srlx %g3, 32, %o5 + +L(done): + retl + mov %o5, %o0 +EPILOGUE() diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sqr_diagonal.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sqr_diagonal.asm new file mode 100644 index 0000000..3b906ef --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sqr_diagonal.asm @@ -0,0 +1,55 @@ +dnl SPARC T1 32-bit mpn_sqr_diagonal. + +dnl Copyright 2010 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 INPUT PARAMETERS +define(`rp', `%o0') +define(`up', `%o1') +define(`n', `%o2') + +ASM_START() +PROLOGUE(mpn_sqr_diagonal) + deccc n C n-- + nop + +L(top): lduw [up+0], %g1 + add up, 4, up C up++ + mulx %g1, %g1, %g3 + stw %g3, [rp+0] + srlx %g3, 32, %g4 + stw %g4, [rp+4] + add rp, 8, rp C rp += 2 + bnz %icc, L(top) + deccc n C n-- + + retl + nop +EPILOGUE() diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sub_n.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sub_n.asm new file mode 100644 index 0000000..946bc3f --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/sub_n.asm @@ -0,0 +1,70 @@ +dnl SPARC T1 32-bit mpn_sub_n. + +dnl Copyright 2010 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 INPUT PARAMETERS +define(`rp', %o0) +define(`ap', %o1) +define(`bp', %o2) +define(`n', %o3) +define(`cy', %o4) + +define(`i', %o3) + +MULFUNC_PROLOGUE(mpn_sub_n mpn_sub_nc) + +ASM_START() +PROLOGUE(mpn_sub_nc) + b L(ent) + srl cy, 0, cy C strip any bogus high bits +EPILOGUE() + +PROLOGUE(mpn_sub_n) + mov 0, cy +L(ent): srl n, 0, n C strip any bogus high bits + sll n, 2, n + add ap, n, ap + add bp, n, bp + add rp, n, rp + neg n, i + +L(top): lduw [ap+i], %g1 + lduw [bp+i], %g2 + sub %g1, %g2, %g3 + sub %g3, cy, %g3 + stw %g3, [rp+i] + add i, 4, i + brnz i, L(top) + srlx %g3, 63, cy + + retl + mov cy, %o0 C return value +EPILOGUE() diff --git a/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/submul_1.asm b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/submul_1.asm new file mode 100644 index 0000000..8920070 --- /dev/null +++ b/vendor/gmp-6.3.0/mpn/sparc32/ultrasparct1/submul_1.asm @@ -0,0 +1,91 @@ +dnl SPARC T1 32-bit mpn_submul_1. + +dnl Contributed to the GNU project by David Miller. + +dnl Copyright 2010, 2013 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 UltraSPARC T1: 24 +C UltraSPARC T2: 19 +C UltraSPARC T3: 19 +C UltraSPARC T4: 5 + +C INPUT PARAMETERS +define(`rp', `%i0') +define(`up', `%i1') +define(`n', `%i2') +define(`v0', `%i3') + +ASM_START() +PROLOGUE(mpn_submul_1) + save %sp, -96, %sp + srl n, 0, %o4 + srl v0, 0, %g1 + subcc %o4, 1, %o4 + be L(final_one) + subcc %g0, 0, %o5 + +L(top): lduw [up+0], %l0 + lduw [rp+0], %l2 + lduw [up+4], %l1 + lduw [rp+4], %l3 + mulx %l0, %g1, %g3 + add up, 8, up + mulx %l1, %g1, %o3 + sub %o4, 2, %o4 + add rp, 8, rp + addx %o5, %g3, %g3 + srlx %g3, 32, %o5 + subcc %l2, %g3, %g3 + stw %g3, [rp-8] + addx %o5, %o3, %o3 + srlx %o3, 32, %o5 + subcc %l3, %o3, %o3 + brgz %o4, L(top) + stw %o3, [rp-4] + + brlz,pt %o4, L(done) + nop + +L(final_one): + lduw [up+0], %l0 + lduw [rp+0], %l2 + mulx %l0, %g1, %g3 + addx %o5, %g3, %g3 + srlx %g3, 32, %o5 + subcc %l2, %g3, %g3 + stw %g3, [rp+0] + +L(done): + addx %o5, 0, %o5 + ret + restore %o5, 0, %o0 +EPILOGUE() -- cgit v1.2.3