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

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

1.1       maekawa     1: dnl  SPARC mpn_rshift -- Shift a number right.
                      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_rshift)
                     33:        ld      [%o1],%g2       C load first limb
                     34:        sub     %g0,%o3,%o5     C negate shift count
                     35:        add     %o2,-1,%o2
                     36:        andcc   %o2,4-1,%g4     C number of limbs in first loop
                     37:        sll     %g2,%o5,%g1     C compute function result
                     38:        be      L(0)            C if multiple of 4 limbs, skip first loop
                     39:        st      %g1,[%sp+80]
                     40:
                     41:        sub     %o2,%g4,%o2     C adjust count for main loop
                     42:
                     43: L(loop0):
                     44:        ld      [%o1+4],%g3
                     45:        add     %o0,4,%o0
                     46:        add     %o1,4,%o1
                     47:        addcc   %g4,-1,%g4
                     48:        srl     %g2,%o3,%o4
                     49:        sll     %g3,%o5,%g1
                     50:        mov     %g3,%g2
                     51:        or      %o4,%g1,%o4
                     52:        bne     L(loop0)
                     53:         st     %o4,[%o0-4]
                     54:
                     55: L(0):  tst     %o2
                     56:        be      L(end)
                     57:         nop
                     58:
                     59: L(loop):
                     60:        ld      [%o1+4],%g3
                     61:        add     %o0,16,%o0
                     62:        addcc   %o2,-4,%o2
                     63:        srl     %g2,%o3,%o4
                     64:        sll     %g3,%o5,%g1
                     65:
                     66:        ld      [%o1+8],%g2
                     67:        srl     %g3,%o3,%g4
                     68:        or      %o4,%g1,%o4
                     69:        st      %o4,[%o0-16]
                     70:        sll     %g2,%o5,%g1
                     71:
                     72:        ld      [%o1+12],%g3
                     73:        srl     %g2,%o3,%o4
                     74:        or      %g4,%g1,%g4
                     75:        st      %g4,[%o0-12]
                     76:        sll     %g3,%o5,%g1
                     77:
                     78:        ld      [%o1+16],%g2
                     79:        srl     %g3,%o3,%g4
                     80:        or      %o4,%g1,%o4
                     81:        st      %o4,[%o0-8]
                     82:        sll     %g2,%o5,%g1
                     83:
                     84:        add     %o1,16,%o1
                     85:        or      %g4,%g1,%g4
                     86:        bne     L(loop)
                     87:         st     %g4,[%o0-4]
                     88:
                     89: L(end):        srl     %g2,%o3,%g2
                     90:        st      %g2,[%o0-0]
                     91:        retl
                     92:        ld      [%sp+80],%o0
                     93: EPILOGUE(mpn_rshift)

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