1dnl SPARC mpn_lshift -- Shift a number left. 2 3dnl Copyright 1995, 1996, 2000 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 INPUT PARAMETERS 24C res_ptr %o0 25C src_ptr %o1 26C size %o2 27C cnt %o3 28 29ASM_START() 30PROLOGUE(mpn_lshift) 31 sll %o2,2,%g1 32 add %o1,%g1,%o1 C make %o1 point at end of src 33 ld [%o1-4],%g2 C load first limb 34 sub %g0,%o3,%o5 C negate shift count 35 add %o0,%g1,%o0 C make %o0 point at end of res 36 add %o2,-1,%o2 37 andcc %o2,4-1,%g4 C number of limbs in first loop 38 srl %g2,%o5,%g1 C compute function result 39 be L(0) C if multiple of 4 limbs, skip first loop 40 st %g1,[%sp+80] 41 42 sub %o2,%g4,%o2 C adjust count for main loop 43 44L(loop0): 45 ld [%o1-8],%g3 46 add %o0,-4,%o0 47 add %o1,-4,%o1 48 addcc %g4,-1,%g4 49 sll %g2,%o3,%o4 50 srl %g3,%o5,%g1 51 mov %g3,%g2 52 or %o4,%g1,%o4 53 bne L(loop0) 54 st %o4,[%o0+0] 55 56L(0): tst %o2 57 be L(end) 58 nop 59 60L(loop): 61 ld [%o1-8],%g3 62 add %o0,-16,%o0 63 addcc %o2,-4,%o2 64 sll %g2,%o3,%o4 65 srl %g3,%o5,%g1 66 67 ld [%o1-12],%g2 68 sll %g3,%o3,%g4 69 or %o4,%g1,%o4 70 st %o4,[%o0+12] 71 srl %g2,%o5,%g1 72 73 ld [%o1-16],%g3 74 sll %g2,%o3,%o4 75 or %g4,%g1,%g4 76 st %g4,[%o0+8] 77 srl %g3,%o5,%g1 78 79 ld [%o1-20],%g2 80 sll %g3,%o3,%g4 81 or %o4,%g1,%o4 82 st %o4,[%o0+4] 83 srl %g2,%o5,%g1 84 85 add %o1,-16,%o1 86 or %g4,%g1,%g4 87 bne L(loop) 88 st %g4,[%o0+0] 89 90L(end): sll %g2,%o3,%g2 91 st %g2,[%o0-4] 92 retl 93 ld [%sp+80],%o0 94EPILOGUE(mpn_lshift) 95