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