| 1 |
dnl SPARC v9 mpn_add_n for T3/T4. |
| 2 |
|
| 3 |
dnl Contributed to the GNU project by David Miller. |
| 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: 8 |
| 37 |
C UltraSPARC T4: 3 |
| 38 |
|
| 39 |
C INPUT PARAMETERS |
| 40 |
define(`rp', `%i0') |
| 41 |
define(`up', `%i1') |
| 42 |
define(`vp', `%i2') |
| 43 |
define(`n', `%i3') |
| 44 |
define(`cy', `%i4') |
| 45 |
|
| 46 |
define(`u0_off', `%l2') |
| 47 |
define(`u1_off', `%l3') |
| 48 |
define(`loop_n', `%l6') |
| 49 |
define(`tmp', `%l7') |
| 50 |
|
| 51 |
ASM_START() |
| 52 |
REGISTER(%g2,#scratch) |
| 53 |
REGISTER(%g3,#scratch) |
| 54 |
PROLOGUE(mpn_add_nc) |
| 55 |
save %sp, -176, %sp |
| 56 |
b,a L(ent) |
| 57 |
EPILOGUE() |
| 58 |
PROLOGUE(mpn_add_n) |
| 59 |
save %sp, -176, %sp |
| 60 |
|
| 61 |
mov 0, cy |
| 62 |
L(ent): |
| 63 |
subcc n, 1, n |
| 64 |
be L(final_one) |
| 65 |
cmp %g0, cy |
| 66 |
|
| 67 |
ldx [up + 0], %o4 |
| 68 |
sllx n, 3, tmp |
| 69 |
|
| 70 |
ldx [vp + 0], %o5 |
| 71 |
add up, tmp, u0_off |
| 72 |
|
| 73 |
ldx [up + 8], %g5 |
| 74 |
neg tmp, loop_n |
| 75 |
|
| 76 |
ldx [vp + 8], %g1 |
| 77 |
add u0_off, 8, u1_off |
| 78 |
|
| 79 |
sub loop_n, -(2 * 8), loop_n |
| 80 |
|
| 81 |
brgez,pn loop_n, L(loop_tail) |
| 82 |
add vp, (2 * 8), vp |
| 83 |
|
| 84 |
b,a L(top) |
| 85 |
ALIGN(16) |
| 86 |
L(top): |
| 87 |
addxccc(%o4, %o5, tmp) |
| 88 |
ldx [vp + 0], %o5 |
| 89 |
|
| 90 |
add rp, (2 * 8), rp |
| 91 |
ldx [loop_n + u0_off], %o4 |
| 92 |
|
| 93 |
add vp, (2 * 8), vp |
| 94 |
stx tmp, [rp - 16] |
| 95 |
|
| 96 |
addxccc(%g1, %g5, tmp) |
| 97 |
ldx [vp - 8], %g1 |
| 98 |
|
| 99 |
ldx [loop_n + u1_off], %g5 |
| 100 |
sub loop_n, -(2 * 8), loop_n |
| 101 |
|
| 102 |
brlz loop_n, L(top) |
| 103 |
stx tmp, [rp - 8] |
| 104 |
|
| 105 |
L(loop_tail): |
| 106 |
addxccc(%o4, %o5, %g3) |
| 107 |
add loop_n, u0_off, up |
| 108 |
|
| 109 |
addxccc(%g1, %g5, %g5) |
| 110 |
stx %g3, [rp + 0] |
| 111 |
|
| 112 |
brgz,pt loop_n, L(done) |
| 113 |
stx %g5, [rp + 8] |
| 114 |
|
| 115 |
add rp, (2 * 8), rp |
| 116 |
L(final_one): |
| 117 |
ldx [up+0], %o4 |
| 118 |
ldx [vp+0], %o5 |
| 119 |
addxccc(%o4, %o5, %g3) |
| 120 |
stx %g3, [rp+0] |
| 121 |
|
| 122 |
L(done): |
| 123 |
addxc(%g0, %g0, %i0) |
| 124 |
ret |
| 125 |
restore |
| 126 |
EPILOGUE() |