Annotation of OpenXM_contrib/pari-2.2/src/kernel/sparcv8/level0_sparcv8_micro.S, Revision 1.1
1.1 ! noro 1: /* $Id: level0_sparcv8_micro.S,v 1.2 2000/11/03 21:00:27 karim Exp $
! 2:
! 3: Copyright (C) 2000 The PARI group.
! 4:
! 5: This file is part of the PARI/GP package.
! 6:
! 7: PARI/GP is free software; you can redistribute it and/or modify it under the
! 8: terms of the GNU General Public License as published by the Free Software
! 9: Foundation. It is distributed in the hope that it will be useful, but WITHOUT
! 10: ANY WARRANTY WHATSOEVER.
! 11:
! 12: Check the License for details. You should have received a copy of it, along
! 13: with the package; see the file 'COPYING'. If not, write to the Free Software
! 14: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
! 15:
! 16: /* This file defines some "level 0" kernel functions for SPARC V8 */
! 17: /* These are optimised for MicroSparc */
! 18: /* The following symbols are defined in this file : */
! 19: /* divll bfffo (& tabshi) */
! 20: /* But divll has to use hiremainder, so it is different when */
! 21: /* hiremainder is inline or not */
! 22: /* If libpari.so is compiled with gcc, you should compile all */
! 23: /* files with gcc */
! 24:
! 25: #if defined(NO_UNDERSCORE) || defined(linux)
! 26: # define C(entrypoint) entrypoint
! 27: #elif defined(sun) || defined(NeXT)
! 28: # ifdef __STDC__
! 29: # define C(entrypoint) _##entrypoint
! 30: # else
! 31: # define C(entrypoint) _/**/entrypoint
! 32: # endif
! 33: #endif
! 34: #if defined(sun) || defined(linux)
! 35: # define GLOBL .global
! 36: #elif defined(NeXT)
! 37: # define GLOBL .globl
! 38: #endif
! 39:
! 40: #if defined(sun) || defined(linux)
! 41: .seg "data"
! 42: .align 4
! 43: C(tabshi): .word 4,3,2,2,1,1,1,1,0,0,0,0,0,0,0,0
! 44:
! 45: .seg "text"
! 46: #elif defined(NeXT)
! 47: .data
! 48: .align 3
! 49: C(tabshi):
! 50: .long 4
! 51: .long 3
! 52: .long 2
! 53: .long 2
! 54: .long 1
! 55: .long 1
! 56: .long 1
! 57: .long 1
! 58: .long 0
! 59: .long 0
! 60: .long 0
! 61: .long 0
! 62: .long 0
! 63: .long 0
! 64: .long 0
! 65: .long 0
! 66:
! 67: .text
! 68: .align 2
! 69: #endif
! 70: GLOBL C(bfffo),C(divll)
! 71:
! 72: C(bfffo): sethi %hi(0xffff0000),%o1
! 73: andcc %o1,%o0,%g0
! 74: bnz,a 1f
! 75: clr %o2
! 76: sll %o0,16,%o0
! 77: mov 16,%o2
! 78: 1: sethi %hi(0xff000000),%o1
! 79: andcc %o1,%o0,%g0
! 80: bnz 2f
! 81: sethi %hi(0xf0000000),%o1
! 82: sll %o0,8,%o0
! 83: add %o2,8,%o2
! 84: 2: andcc %o1,%o0,%g0
! 85: bnz,a 3f
! 86: srl %o0,28,%o0
! 87: add %o2,4,%o2
! 88: srl %o0,24,%o0
! 89: 3: set C(tabshi),%o3
! 90: sll %o0,2,%o0
! 91: ld [%o3+%o0],%o1
! 92: retl
! 93: add %o2,%o1,%o0
! 94:
! 95: #ifdef __GNUC__
! 96: C(divll): wr %g5,%g0,%y
! 97: #else /* ! __GNUC__ */
! 98: C(divll): sethi %hi(C(hiremainder)),%o4
! 99: ld [%o4+%lo(C(hiremainder))],%o2
! 100: wr %o2,%g0,%y
! 101: #endif
! 102: mov %o0,%o3
! 103: nop
! 104: nop
! 105: udivcc %o0,%o1,%o0
! 106: bvc 1f
! 107: umul %o0,%o1,%o5
! 108: mov 0x2f,%o0
! 109: call C(pari_err),1
! 110: nop
! 111: #ifdef __GNUC__
! 112: 1: retl
! 113: sub %o3,%o5,%g5
! 114: #else /* ! __GNUC__ */
! 115: 1: subcc %o3,%o5,%o2
! 116: retl
! 117: st %o2,[%o4+%lo(C(hiremainder))]
! 118: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>