1dnl SPARC v9 mpn_lshift 2 3dnl Copyright 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. 4 5dnl This file is part of the GNU MP Library. 6 7dnl The GNU MP Library is free software; you can redistribute it and/or modify 8dnl it under the terms of the GNU Lesser General Public License as published 9dnl by the Free Software Foundation; either version 3 of the License, or (at 10dnl your option) any later version. 11 12dnl The GNU MP Library is distributed in the hope that it will be useful, but 13dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 15dnl License for more details. 16 17dnl You should have received a copy of the GNU Lesser General Public License 18dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. 19 20 21include(`../config.m4') 22 23C cycles/limb 24C UltraSPARC 1&2: 2 25C UltraSPARC 3: 3.25 26 27C INPUT PARAMETERS 28define(`rp',`%i0') 29define(`up',`%i1') 30define(`n',`%i2') 31define(`cnt',`%i3') 32 33define(`u0',`%l0') 34define(`u1',`%l2') 35define(`u2',`%l4') 36define(`u3',`%l6') 37 38define(`tnc',`%i4') 39 40define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe 41define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe 42 43ASM_START() 44 REGISTER(%g2,#scratch) 45 REGISTER(%g3,#scratch) 46PROLOGUE(mpn_lshift) 47 save %sp,-160,%sp 48 49 sllx n,3,%g1 50 sub %g0,cnt,tnc C negate shift count 51 add up,%g1,up C make %o1 point at end of src 52 add rp,%g1,rp C make %o0 point at end of res 53 ldx [up-8],u3 C load first limb 54 subcc n,5,n 55 srlx u3,tnc,%i5 C compute function result 56 sllx u3,cnt,%g3 57 bl,pn %icc,.Lend1234 58 fanop 59 60 subcc n,4,n 61 ldx [up-16],u0 62 ldx [up-24],u1 63 add up,-32,up 64 ldx [up-0],u2 65 ldx [up-8],u3 66 srlx u0,tnc,%g2 67 68 bl,pn %icc,.Lend5678 69 fanop 70 71 b,a .Loop 72 .align 16 73.Loop: 74 sllx u0,cnt,%g1 75 or %g3,%g2,%g3 76 ldx [up-16],u0 77 fanop 78C -- 79 srlx u1,tnc,%g2 80 subcc n,4,n 81 stx %g3,[rp-8] 82 fanop 83C -- 84 sllx u1,cnt,%g3 85 or %g1,%g2,%g1 86 ldx [up-24],u1 87 fanop 88C -- 89 srlx u2,tnc,%g2 90 stx %g1,[rp-16] 91 add up,-32,up 92 fanop 93C -- 94 sllx u2,cnt,%g1 95 or %g3,%g2,%g3 96 ldx [up-0],u2 97 fanop 98C -- 99 srlx u3,tnc,%g2 100 stx %g3,[rp-24] 101 add rp,-32,rp 102 fanop 103C -- 104 sllx u3,cnt,%g3 105 or %g1,%g2,%g1 106 ldx [up-8],u3 107 fanop 108C -- 109 srlx u0,tnc,%g2 110 stx %g1,[rp-0] 111 bge,pt %icc,.Loop 112 fanop 113C -- 114.Lend5678: 115 sllx u0,cnt,%g1 116 or %g3,%g2,%g3 117 srlx u1,tnc,%g2 118 stx %g3,[rp-8] 119 sllx u1,cnt,%g3 120 or %g1,%g2,%g1 121 srlx u2,tnc,%g2 122 stx %g1,[rp-16] 123 sllx u2,cnt,%g1 124 or %g3,%g2,%g3 125 srlx u3,tnc,%g2 126 stx %g3,[rp-24] 127 add rp,-32,rp 128 sllx u3,cnt,%g3 C carry... 129 or %g1,%g2,%g1 130 stx %g1,[rp-0] 131 132.Lend1234: 133 addcc n,4,n 134 bz,pn %icc,.Lret 135 fanop 136.Loop0: 137 add rp,-8,rp 138 subcc n,1,n 139 ldx [up-16],u3 140 add up,-8,up 141 srlx u3,tnc,%g2 142 or %g3,%g2,%g3 143 stx %g3,[rp] 144 sllx u3,cnt,%g3 145 bnz,pt %icc,.Loop0 146 fanop 147.Lret: 148 stx %g3,[rp-8] 149 mov %i5,%i0 150 ret 151 restore 152EPILOGUE(mpn_lshift) 153