Annotation of sys/arch/m68k/fpsp/sto_res.sa, Revision 1.1
1.1 ! nbrk 1: * $OpenBSD: sto_res.sa,v 1.3 2003/11/07 10:36:10 miod Exp $
! 2: * $NetBSD: sto_res.sa,v 1.3 1994/10/26 07:50:14 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: * sto_res.sa 3.1 12/10/90
! 36: *
! 37: * Takes the result and puts it in where the user expects it.
! 38: * Library functions return result in fp0. If fp0 is not the
! 39: * users destination register then fp0 is moved to the
! 40: * correct floating-point destination register. fp0 and fp1
! 41: * are then restored to the original contents.
! 42: *
! 43: * Input: result in fp0,fp1
! 44: *
! 45: * d2 & a0 should be kept unmodified
! 46: *
! 47: * Output: moves the result to the true destination reg or mem
! 48: *
! 49: * Modifies: destination floating point register
! 50: *
! 51:
! 52: STO_RES IDNT 2,1 Motorola 040 Floating Point Software Package
! 53:
! 54:
! 55: section 8
! 56:
! 57: include fpsp.h
! 58:
! 59: xdef sto_cos
! 60: sto_cos:
! 61: bfextu CMDREG1B(a6){13:3},d0 ;extract cos destination
! 62: cmpi.b #3,d0 ;check for fp0/fp1 cases
! 63: ble.b c_fp0123
! 64: fmovem.x fp1,-(a7)
! 65: moveq.l #7,d1
! 66: sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
! 67: clr.l d0
! 68: bset.l d1,d0 ;d0 is dynamic register mask
! 69: fmovem.x (a7)+,d0
! 70: rts
! 71: c_fp0123:
! 72: tst.b d0
! 73: beq.b c_is_fp0
! 74: cmpi.b #1,d0
! 75: beq.b c_is_fp1
! 76: cmpi.b #2,d0
! 77: beq.b c_is_fp2
! 78: c_is_fp3:
! 79: fmovem.x fp1,USER_FP3(a6)
! 80: rts
! 81: c_is_fp2:
! 82: fmovem.x fp1,USER_FP2(a6)
! 83: rts
! 84: c_is_fp1:
! 85: fmovem.x fp1,USER_FP1(a6)
! 86: rts
! 87: c_is_fp0:
! 88: fmovem.x fp1,USER_FP0(a6)
! 89: rts
! 90:
! 91:
! 92: xdef sto_res
! 93: sto_res:
! 94: bfextu CMDREG1B(a6){6:3},d0 ;extract destination register
! 95: cmpi.b #3,d0 ;check for fp0/fp1 cases
! 96: ble.b fp0123
! 97: fmovem.x fp0,-(a7)
! 98: moveq.l #7,d1
! 99: sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
! 100: clr.l d0
! 101: bset.l d1,d0 ;d0 is dynamic register mask
! 102: fmovem.x (a7)+,d0
! 103: rts
! 104: fp0123:
! 105: tst.b d0
! 106: beq.b is_fp0
! 107: cmpi.b #1,d0
! 108: beq.b is_fp1
! 109: cmpi.b #2,d0
! 110: beq.b is_fp2
! 111: is_fp3:
! 112: fmovem.x fp0,USER_FP3(a6)
! 113: rts
! 114: is_fp2:
! 115: fmovem.x fp0,USER_FP2(a6)
! 116: rts
! 117: is_fp1:
! 118: fmovem.x fp0,USER_FP1(a6)
! 119: rts
! 120: is_fp0:
! 121: fmovem.x fp0,USER_FP0(a6)
! 122: rts
! 123:
! 124: end
CVSweb