| 1 |
dnl SPARC T3/T4/T5 mpn_modexact_1c_odd. |
| 2 |
|
| 3 |
dnl Contributed to the GNU project by Torbjörn Granlund. |
| 4 |
|
| 5 |
dnl Copyright 2013 Free Software Foundation, Inc. |
| 6 |
|
| 7 |
dnl This file is part of the GNU MP Library. |
| 8 |
dnl |
| 9 |
dnl The GNU MP Library is free software; you can redistribute it and/or modify |
| 10 |
dnl it under the terms of either: |
| 11 |
dnl |
| 12 |
dnl * the GNU Lesser General Public License as published by the Free |
| 13 |
dnl Software Foundation; either version 3 of the License, or (at your |
| 14 |
dnl option) any later version. |
| 15 |
dnl |
| 16 |
dnl or |
| 17 |
dnl |
| 18 |
dnl * the GNU General Public License as published by the Free Software |
| 19 |
dnl Foundation; either version 2 of the License, or (at your option) any |
| 20 |
dnl later version. |
| 21 |
dnl |
| 22 |
dnl or both in parallel, as here. |
| 23 |
dnl |
| 24 |
dnl The GNU MP Library is distributed in the hope that it will be useful, but |
| 25 |
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
| 26 |
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
| 27 |
dnl for more details. |
| 28 |
dnl |
| 29 |
dnl You should have received copies of the GNU General Public License and the |
| 30 |
dnl GNU Lesser General Public License along with the GNU MP Library. If not, |
| 31 |
dnl see https://www.gnu.org/licenses/. |
| 32 |
|
| 33 |
include(`../config.m4') |
| 34 |
|
| 35 |
C cycles/limb |
| 36 |
C UltraSPARC T3: 30 |
| 37 |
C UltraSPARC T4/T5: 26 |
| 38 |
|
| 39 |
C INPUT PARAMETERS |
| 40 |
define(`ap', `%o0') |
| 41 |
define(`n', `%o1') |
| 42 |
define(`d', `%o2') |
| 43 |
define(`cy', `%o3') |
| 44 |
|
| 45 |
define(`dinv',`%o5') |
| 46 |
define(`a0', `%g1') |
| 47 |
|
| 48 |
ASM_START() |
| 49 |
REGISTER(%g2,#scratch) |
| 50 |
REGISTER(%g3,#scratch) |
| 51 |
PROLOGUE(mpn_modexact_1c_odd) |
| 52 |
srlx d, 1, %g1 |
| 53 |
and %g1, 127, %g1 |
| 54 |
|
| 55 |
LEA64(binvert_limb_table, g2, g4) |
| 56 |
ldub [%g2+%g1], %g1 |
| 57 |
add %g1, %g1, %g2 |
| 58 |
mulx %g1, %g1, %g1 |
| 59 |
mulx %g1, d, %g1 |
| 60 |
sub %g2, %g1, %g2 |
| 61 |
add %g2, %g2, %g1 |
| 62 |
mulx %g2, %g2, %g2 |
| 63 |
mulx %g2, d, %g2 |
| 64 |
sub %g1, %g2, %g1 |
| 65 |
add %g1, %g1, %o5 |
| 66 |
mulx %g1, %g1, %g1 |
| 67 |
mulx %g1, d, %g1 |
| 68 |
sub %o5, %g1, dinv |
| 69 |
add n, -1, n |
| 70 |
|
| 71 |
L(top): ldx [ap], a0 |
| 72 |
add ap, 8, ap |
| 73 |
subcc a0, cy, %g3 |
| 74 |
mulx %g3, dinv, %g5 |
| 75 |
umulxhi(d, %g5, %g5) |
| 76 |
addxc( %g5, %g0, cy) |
| 77 |
brnz,pt n, L(top) |
| 78 |
add n, -1, n |
| 79 |
|
| 80 |
retl |
| 81 |
mov cy, %o0 |
| 82 |
EPILOGUE() |