Annotation of OpenXM_contrib/gmp/mpn/sparc64/rshift.asm, Revision 1.1.1.2
1.1.1.2 ! ohara 1: dnl SPARC v9 mpn_rshift
1.1 maekawa 2:
1.1.1.2 ! ohara 3: dnl Copyright 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
1.1 maekawa 4:
1.1.1.2 ! ohara 5: dnl This file is part of the GNU MP Library.
1.1 maekawa 6:
1.1.1.2 ! ohara 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 by
! 9: dnl the Free Software Foundation; either version 2.1 of the License, or (at your
! 10: dnl 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.
1.1 maekawa 21:
1.1.1.2 ! ohara 22: include(`../config.m4')
1.1 maekawa 23:
1.1.1.2 ! ohara 24: C INPUT PARAMETERS
! 25: define(`rp',`%i0')
! 26: define(`up',`%i1')
! 27: define(`n',`%i2')
! 28: define(`cnt',`%i3')
! 29:
! 30: define(`u0',`%l0')
! 31: define(`u1',`%l2')
! 32: define(`u2',`%l4')
! 33: define(`u3',`%l6')
1.1 maekawa 34:
1.1.1.2 ! ohara 35: define(`tnc',`%i4')
1.1 maekawa 36:
1.1.1.2 ! ohara 37: define(`fanop',`fitod %f0,%f2') dnl A quasi nop running in the FA pipe
! 38: define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe
1.1 maekawa 39:
40: ASM_START()
1.1.1.2 ! ohara 41: REGISTER(%g2,#scratch)
! 42: REGISTER(%g3,#scratch)
1.1 maekawa 43: PROLOGUE(mpn_rshift)
1.1.1.2 ! ohara 44: save %sp,-160,%sp
! 45:
! 46: sub %g0,cnt,tnc C negate shift count
! 47: ldx [up],u3 C load first limb
! 48: subcc n,5,n
! 49: sllx u3,tnc,%i5 C compute function result
! 50: srlx u3,cnt,%g3
! 51: bl,pn %icc,.Lend1234
! 52: fanop
! 53:
! 54: subcc n,4,n
! 55: ldx [up+8],u0
! 56: ldx [up+16],u1
! 57: add up,32,up
! 58: ldx [up-8],u2
! 59: ldx [up+0],u3
! 60: sllx u0,tnc,%g2
! 61:
! 62: bl,pn %icc,.Lend5678
! 63: fanop
! 64:
! 65: b,a .Loop
! 66: .align 16
! 67: .Loop:
! 68: srlx u0,cnt,%g1
! 69: or %g3,%g2,%g3
! 70: ldx [up+8],u0
! 71: fanop
! 72: C --
! 73: sllx u1,tnc,%g2
! 74: subcc n,4,n
! 75: stx %g3,[rp+0]
! 76: fanop
! 77: C --
! 78: srlx u1,cnt,%g3
! 79: or %g1,%g2,%g1
! 80: ldx [up+16],u1
! 81: fanop
! 82: C --
! 83: sllx u2,tnc,%g2
! 84: stx %g1,[rp+8]
! 85: add up,32,up
! 86: fanop
! 87: C --
! 88: srlx u2,cnt,%g1
! 89: or %g3,%g2,%g3
! 90: ldx [up-8],u2
! 91: fanop
! 92: C --
! 93: sllx u3,tnc,%g2
! 94: stx %g3,[rp+16]
! 95: add rp,32,rp
! 96: fanop
! 97: C --
! 98: srlx u3,cnt,%g3
! 99: or %g1,%g2,%g1
! 100: ldx [up+0],u3
! 101: fanop
! 102: C --
! 103: sllx u0,tnc,%g2
! 104: stx %g1,[rp-8]
! 105: bge,pt %icc,.Loop
! 106: fanop
! 107: C --
! 108: .Lend5678:
! 109: srlx u0,cnt,%g1
! 110: or %g3,%g2,%g3
! 111: sllx u1,tnc,%g2
! 112: stx %g3,[rp+0]
! 113: srlx u1,cnt,%g3
! 114: or %g1,%g2,%g1
! 115: sllx u2,tnc,%g2
! 116: stx %g1,[rp+8]
! 117: srlx u2,cnt,%g1
! 118: or %g3,%g2,%g3
! 119: sllx u3,tnc,%g2
! 120: stx %g3,[rp+16]
! 121: add rp,32,rp
! 122: srlx u3,cnt,%g3 C carry...
! 123: or %g1,%g2,%g1
! 124: stx %g1,[rp-8]
! 125:
! 126: .Lend1234:
! 127: addcc n,4,n
! 128: bz,pn %icc,.Lret
! 129: fanop
! 130: .Loop0:
! 131: add rp,8,rp
! 132: subcc n,1,n
! 133: ldx [up+8],u3
! 134: add up,8,up
! 135: sllx u3,tnc,%g2
! 136: or %g3,%g2,%g3
! 137: stx %g3,[rp-8]
! 138: srlx u3,cnt,%g3
! 139: bnz,pt %icc,.Loop0
! 140: fanop
! 141: .Lret:
! 142: stx %g3,[rp+0]
! 143: mov %i5,%i0
! 144: ret
! 145: restore
1.1 maekawa 146: EPILOGUE(mpn_rshift)
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>