Annotation of sys/arch/m68k/fpsp/DYADIC.GCC, Revision 1.1
1.1 ! nbrk 1: * $OpenBSD: DYADIC.GCC,v 1.2 1996/05/29 21:05:19 niklas Exp $
! 2: * $NetBSD: DYADIC.GCC,v 1.2 1994/10/26 07:48:27 cgd Exp $
! 3:
! 4: * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
! 5: * M68000 Hi-Performance Microprocessor Division
! 6: * M68040 Software Package
! 7: *
! 8: * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
! 9: * All rights reserved.
! 10: *
! 11: * THE SOFTWARE is provided on an "AS IS" basis and without warranty.
! 12: * To the maximum extent permitted by applicable law,
! 13: * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
! 14: * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
! 15: * PARTICULAR PURPOSE and any warranty against infringement with
! 16: * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
! 17: * and any accompanying written materials.
! 18: *
! 19: * To the maximum extent permitted by applicable law,
! 20: * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
! 21: * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
! 22: * PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
! 23: * OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
! 24: * SOFTWARE. Motorola assumes no responsibility for the maintenance
! 25: * and support of the SOFTWARE.
! 26: *
! 27: * You are hereby granted a copyright license to use, modify, and
! 28: * distribute the SOFTWARE so long as this entire notice is retained
! 29: * without alteration in any modified and/or redistributed versions,
! 30: * and that such modified versions are clearly identified as such.
! 31: * No licenses are granted by implication, estoppel or otherwise
! 32: * under any patents or trademarks of Motorola, Inc.
! 33:
! 34: *
! 35: * DYADIC.GCC --- DYADIC template for GCC compiler
! 36: *
! 37: * This is based on the generic template. The only difference is that
! 38: * GCC does not need the d0-d1/a0-a1 registers saved.
! 39: *
! 40: * Customizations:
! 41: * 2. Likewise, don't save FP0/FP1 if they are scratch
! 42: * registers.
! 43: * 3. Delete updating of the fpsr if you only care about
! 44: * the result.
! 45: * 5. Move the result to d0/d1 if the compiler is that old.
! 46: *
! 47:
! 48: xref _OPa_
! 49: xref tag
! 50:
! 51: xdef _OPs_
! 52: _OPs_:
! 53: link a6,#-LOCAL_SIZE
! 54: fmovem.x fp0-fp3,USER_FP0(a6)
! 55: fmove.l fpsr,USER_FPSR(a6)
! 56: fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
! 57: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
! 58: *
! 59: * copy, convert and tag input arguments
! 60: *
! 61: fmove.s 8(a6),fp0
! 62: fmove.x fp0,FPTEMP(a6)
! 63: lea FPTEMP(a6),a0
! 64: bsr tag
! 65: move.b d0,DTAG(a6)
! 66:
! 67: fmove.s 12(a6),fp0
! 68: fmove.x fp0,ETEMP(a6)
! 69: lea ETEMP(a6),a0
! 70: bsr tag
! 71: move.b d0,STAG(a6)
! 72:
! 73: bsr _OPa_
! 74:
! 75: fmove.l fpsr,d0 ; update status register
! 76: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
! 77: swap.w d0
! 78: or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
! 79: swap.w d0
! 80: fmove.l d0,fpsr
! 81: *
! 82: * Result is now in FP0
! 83: *
! 84: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
! 85: unlk a6
! 86: rts
! 87:
! 88: xdef _OPd_
! 89: _OPd_:
! 90: link a6,#-LOCAL_SIZE
! 91: fmovem.x fp0-fp3,USER_FP0(a6)
! 92: fmove.l fpsr,USER_FPSR(a6)
! 93: fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
! 94: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
! 95: *
! 96: * copy, convert and tag input arguments
! 97: *
! 98: fmove.d 8(a6),fp0
! 99: fmove.x fp0,FPTEMP(a6)
! 100: lea FPTEMP(a6),a0
! 101: bsr tag
! 102: move.b d0,DTAG(a6)
! 103:
! 104: fmove.d 16(a6),fp0
! 105: fmove.x fp0,ETEMP(a6)
! 106: lea ETEMP(a6),a0
! 107: bsr tag
! 108: move.b d0,STAG(a6)
! 109:
! 110: bsr _OPa_
! 111:
! 112: fmove.l fpsr,d0 ; update status register
! 113: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
! 114: swap.w d0
! 115: or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
! 116: swap.w d0
! 117: fmove.l d0,fpsr
! 118: *
! 119: * Result is now in FP0
! 120: *
! 121: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
! 122: unlk a6
! 123: rts
! 124:
! 125: xdef _OPx_
! 126: _OPx_:
! 127: link a6,#-LOCAL_SIZE
! 128: fmovem.x fp0-fp3,USER_FP0(a6)
! 129: fmove.l fpsr,USER_FPSR(a6)
! 130: fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
! 131: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
! 132: *
! 133: * copy, convert and tag input arguments
! 134: *
! 135: fmove.x 8(a6),fp0
! 136: fmove.x fp0,FPTEMP(a6)
! 137: lea FPTEMP(a6),a0
! 138: bsr tag
! 139: move.b d0,DTAG(a6)
! 140:
! 141: fmove.x 20(a6),fp0
! 142: fmove.x fp0,ETEMP(a6)
! 143: lea ETEMP(a6),a0
! 144: bsr tag
! 145: move.b d0,STAG(a6)
! 146:
! 147: bsr _OPa_
! 148:
! 149: fmove.l fpsr,d0 ; update status register
! 150: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
! 151: swap.w d0
! 152: or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
! 153: swap.w d0
! 154: fmove.l d0,fpsr
! 155: *
! 156: * Result is now in FP0
! 157: *
! 158: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
! 159: unlk a6
! 160: rts
! 161:
CVSweb