| 1 |
dnl SPARC v9 mpn_lshiftc |
| 2 |
|
| 3 |
dnl Copyright 1996, 2000-2003, 2010 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 |
|
| 32 |
include(`../config.m4') |
| 33 |
|
| 34 |
C cycles/limb |
| 35 |
C UltraSPARC 1&2: 3 |
| 36 |
C UltraSPARC 3: 2.67 |
| 37 |
|
| 38 |
C INPUT PARAMETERS |
| 39 |
define(`rp', `%i0') |
| 40 |
define(`up', `%i1') |
| 41 |
define(`n', `%i2') |
| 42 |
define(`cnt',`%i3') |
| 43 |
|
| 44 |
define(`u0', `%l0') |
| 45 |
define(`u1', `%l2') |
| 46 |
define(`u2', `%l4') |
| 47 |
define(`u3', `%l6') |
| 48 |
|
| 49 |
define(`tnc',`%i4') |
| 50 |
|
| 51 |
define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe |
| 52 |
|
| 53 |
ASM_START() |
| 54 |
REGISTER(%g2,#scratch) |
| 55 |
REGISTER(%g3,#scratch) |
| 56 |
PROLOGUE(mpn_lshiftc) |
| 57 |
save %sp,-160,%sp |
| 58 |
|
| 59 |
sllx n,3,%g1 |
| 60 |
sub %g0,cnt,tnc C negate shift count |
| 61 |
add up,%g1,up C make %o1 point at end of src |
| 62 |
add rp,%g1,rp C make %o0 point at end of res |
| 63 |
ldx [up-8],u3 C load first limb |
| 64 |
subcc n,5,n |
| 65 |
srlx u3,tnc,%i5 C compute function result |
| 66 |
bl,pn %xcc,.Lend1234 |
| 67 |
sllx u3,cnt,%g3 |
| 68 |
|
| 69 |
subcc n,4,n |
| 70 |
ldx [up-16],u0 |
| 71 |
ldx [up-24],u1 |
| 72 |
add up,-32,up |
| 73 |
ldx [up-0],u2 |
| 74 |
ldx [up-8],u3 |
| 75 |
srlx u0,tnc,%g2 |
| 76 |
bl,pn %xcc,.Lend5678 |
| 77 |
not %g3, %g3 |
| 78 |
|
| 79 |
b,a .Loop |
| 80 |
ALIGN(16) |
| 81 |
.Loop: |
| 82 |
sllx u0,cnt,%g1 |
| 83 |
andn %g3,%g2,%g3 |
| 84 |
ldx [up-16],u0 |
| 85 |
fanop |
| 86 |
C -- |
| 87 |
srlx u1,tnc,%g2 |
| 88 |
subcc n,4,n |
| 89 |
stx %g3,[rp-8] |
| 90 |
not %g1, %g1 |
| 91 |
C -- |
| 92 |
sllx u1,cnt,%g3 |
| 93 |
andn %g1,%g2,%g1 |
| 94 |
ldx [up-24],u1 |
| 95 |
fanop |
| 96 |
C -- |
| 97 |
srlx u2,tnc,%g2 |
| 98 |
stx %g1,[rp-16] |
| 99 |
add up,-32,up |
| 100 |
not %g3, %g3 |
| 101 |
C -- |
| 102 |
sllx u2,cnt,%g1 |
| 103 |
andn %g3,%g2,%g3 |
| 104 |
ldx [up-0],u2 |
| 105 |
fanop |
| 106 |
C -- |
| 107 |
srlx u3,tnc,%g2 |
| 108 |
stx %g3,[rp-24] |
| 109 |
add rp,-32,rp |
| 110 |
not %g1, %g1 |
| 111 |
C -- |
| 112 |
sllx u3,cnt,%g3 |
| 113 |
andn %g1,%g2,%g1 |
| 114 |
ldx [up-8],u3 |
| 115 |
fanop |
| 116 |
C -- |
| 117 |
srlx u0,tnc,%g2 |
| 118 |
stx %g1,[rp-0] |
| 119 |
bge,pt %xcc,.Loop |
| 120 |
not %g3, %g3 |
| 121 |
C -- |
| 122 |
.Lend5678: |
| 123 |
sllx u0,cnt,%g1 |
| 124 |
andn %g3,%g2,%g3 |
| 125 |
srlx u1,tnc,%g2 |
| 126 |
stx %g3,[rp-8] |
| 127 |
not %g1, %g1 |
| 128 |
sllx u1,cnt,%g3 |
| 129 |
andn %g1,%g2,%g1 |
| 130 |
srlx u2,tnc,%g2 |
| 131 |
stx %g1,[rp-16] |
| 132 |
not %g3, %g3 |
| 133 |
sllx u2,cnt,%g1 |
| 134 |
andn %g3,%g2,%g3 |
| 135 |
srlx u3,tnc,%g2 |
| 136 |
stx %g3,[rp-24] |
| 137 |
add rp,-32,rp |
| 138 |
not %g1, %g1 |
| 139 |
sllx u3,cnt,%g3 C carry... |
| 140 |
andn %g1,%g2,%g1 |
| 141 |
stx %g1,[rp-0] |
| 142 |
|
| 143 |
.Lend1234: |
| 144 |
addcc n,4,n |
| 145 |
bz,pn %xcc,.Lret |
| 146 |
fanop |
| 147 |
.Loop0: |
| 148 |
add rp,-8,rp |
| 149 |
subcc n,1,n |
| 150 |
ldx [up-16],u3 |
| 151 |
add up,-8,up |
| 152 |
srlx u3,tnc,%g2 |
| 153 |
not %g3, %g3 |
| 154 |
andn %g3,%g2,%g3 |
| 155 |
stx %g3,[rp] |
| 156 |
sllx u3,cnt,%g3 |
| 157 |
bnz,pt %xcc,.Loop0 |
| 158 |
fanop |
| 159 |
.Lret: |
| 160 |
not %g3, %g3 |
| 161 |
stx %g3,[rp-8] |
| 162 |
mov %i5,%i0 |
| 163 |
ret |
| 164 |
restore |
| 165 |
EPILOGUE() |