[BACK]Return to lshift.asm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpn / sparc32

Annotation of OpenXM_contrib/gmp/mpn/sparc32/lshift.asm, Revision 1.1.1.2

1.1       maekawa     1: dnl  SPARC mpn_lshift -- Shift a number left.
                      2:
1.1.1.2 ! ohara       3: dnl  Copyright 1995, 1996, 2000 Free Software Foundation, Inc.
1.1       maekawa     4:
                      5: dnl  This file is part of the GNU MP Library.
                      6:
                      7: dnl  The GNU MP Library is free software; you can redistribute it and/or modify
                      8: dnl  it under the terms of the GNU Lesser General Public License as published
                      9: dnl  by the Free Software Foundation; either version 2.1 of the License, or (at
                     10: dnl  your option) any later version.
                     11:
                     12: dnl  The GNU MP Library is distributed in the hope that it will be useful, but
                     13: dnl  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
                     14: dnl  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
                     15: dnl  License for more details.
                     16:
                     17: dnl  You should have received a copy of the GNU Lesser General Public License
                     18: dnl  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
                     19: dnl  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
                     20: dnl  MA 02111-1307, USA.
                     21:
                     22:
                     23: include(`../config.m4')
                     24:
                     25: C INPUT PARAMETERS
                     26: C res_ptr      %o0
                     27: C src_ptr      %o1
                     28: C size         %o2
                     29: C cnt          %o3
                     30:
                     31: ASM_START()
                     32: PROLOGUE(mpn_lshift)
                     33:        sll     %o2,2,%g1
                     34:        add     %o1,%g1,%o1     C make %o1 point at end of src
                     35:        ld      [%o1-4],%g2     C load first limb
                     36:        sub     %g0,%o3,%o5     C negate shift count
                     37:        add     %o0,%g1,%o0     C make %o0 point at end of res
                     38:        add     %o2,-1,%o2
                     39:        andcc   %o2,4-1,%g4     C number of limbs in first loop
                     40:        srl     %g2,%o5,%g1     C compute function result
                     41:        be      L(0)            C if multiple of 4 limbs, skip first loop
                     42:        st      %g1,[%sp+80]
                     43:
                     44:        sub     %o2,%g4,%o2     C adjust count for main loop
                     45:
                     46: L(loop0):
                     47:        ld      [%o1-8],%g3
                     48:        add     %o0,-4,%o0
                     49:        add     %o1,-4,%o1
                     50:        addcc   %g4,-1,%g4
                     51:        sll     %g2,%o3,%o4
                     52:        srl     %g3,%o5,%g1
                     53:        mov     %g3,%g2
                     54:        or      %o4,%g1,%o4
                     55:        bne     L(loop0)
                     56:         st     %o4,[%o0+0]
                     57:
                     58: L(0):  tst     %o2
                     59:        be      L(end)
                     60:         nop
                     61:
                     62: L(loop):
                     63:        ld      [%o1-8],%g3
                     64:        add     %o0,-16,%o0
                     65:        addcc   %o2,-4,%o2
                     66:        sll     %g2,%o3,%o4
                     67:        srl     %g3,%o5,%g1
                     68:
                     69:        ld      [%o1-12],%g2
                     70:        sll     %g3,%o3,%g4
                     71:        or      %o4,%g1,%o4
                     72:        st      %o4,[%o0+12]
                     73:        srl     %g2,%o5,%g1
                     74:
                     75:        ld      [%o1-16],%g3
                     76:        sll     %g2,%o3,%o4
                     77:        or      %g4,%g1,%g4
                     78:        st      %g4,[%o0+8]
                     79:        srl     %g3,%o5,%g1
                     80:
                     81:        ld      [%o1-20],%g2
                     82:        sll     %g3,%o3,%g4
                     83:        or      %o4,%g1,%o4
                     84:        st      %o4,[%o0+4]
                     85:        srl     %g2,%o5,%g1
                     86:
                     87:        add     %o1,-16,%o1
                     88:        or      %g4,%g1,%g4
                     89:        bne     L(loop)
                     90:         st     %g4,[%o0+0]
                     91:
                     92: L(end):        sll     %g2,%o3,%g2
                     93:        st      %g2,[%o0-4]
                     94:        retl
                     95:        ld      [%sp+80],%o0
                     96: EPILOGUE(mpn_lshift)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>