sto_res.sa revision 1.3.32.1 1 * $NetBSD: sto_res.sa,v 1.3.32.1 2000/11/20 20:11:37 bouyer Exp $
2
3 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
4 * M68000 Hi-Performance Microprocessor Division
5 * M68040 Software Package
6 *
7 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
8 * All rights reserved.
9 *
10 * THE SOFTWARE is provided on an "AS IS" basis and without warranty.
11 * To the maximum extent permitted by applicable law,
12 * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
13 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
14 * PARTICULAR PURPOSE and any warranty against infringement with
15 * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
16 * and any accompanying written materials.
17 *
18 * To the maximum extent permitted by applicable law,
19 * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
20 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
21 * PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
22 * OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
23 * SOFTWARE. Motorola assumes no responsibility for the maintenance
24 * and support of the SOFTWARE.
25 *
26 * You are hereby granted a copyright license to use, modify, and
27 * distribute the SOFTWARE so long as this entire notice is retained
28 * without alteration in any modified and/or redistributed versions,
29 * and that such modified versions are clearly identified as such.
30 * No licenses are granted by implication, estoppel or otherwise
31 * under any patents or trademarks of Motorola, Inc.
32
33 *
34 * sto_res.sa 3.1 12/10/90
35 *
36 * Takes the result and puts it in where the user expects it.
37 * Library functions return result in fp0. If fp0 is not the
38 * users destination register then fp0 is moved to the
39 * correct floating-point destination register. fp0 and fp1
40 * are then restored to the original contents.
41 *
42 * Input: result in fp0,fp1
43 *
44 * d2 & a0 should be kept unmodified
45 *
46 * Output: moves the result to the true destination reg or mem
47 *
48 * Modifies: destination floating point register
49 *
50
51 STO_RES IDNT 2,1 Motorola 040 Floating Point Software Package
52
53
54 section 8
55
56 include fpsp.h
57
58 xdef sto_cos
59 sto_cos:
60 bfextu CMDREG1B(a6){13:3},d0 ;extract cos destination
61 cmpi.b #3,d0 ;check for fp0/fp1 cases
62 ble.b c_fp0123
63 fmovem.x fp1,-(a7)
64 moveq.l #7,d1
65 sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
66 clr.l d0
67 bset.l d1,d0 ;d0 is dynamic register mask
68 fmovem.x (a7)+,d0
69 rts
70 c_fp0123:
71 tst.b d0
72 beq.b c_is_fp0
73 cmpi.b #1,d0
74 beq.b c_is_fp1
75 cmpi.b #2,d0
76 beq.b c_is_fp2
77 c_is_fp3:
78 fmovem.x fp1,USER_FP3(a6)
79 rts
80 c_is_fp2:
81 fmovem.x fp1,USER_FP2(a6)
82 rts
83 c_is_fp1:
84 fmovem.x fp1,USER_FP1(a6)
85 rts
86 c_is_fp0:
87 fmovem.x fp1,USER_FP0(a6)
88 rts
89
90
91 xdef sto_res
92 sto_res:
93 bfextu CMDREG1B(a6){6:3},d0 ;extract destination register
94 cmpi.b #3,d0 ;check for fp0/fp1 cases
95 ble.b fp0123
96 fmovem.x fp0,-(a7)
97 moveq.l #7,d1
98 sub.l d0,d1 ;d1 = 7- (dest. reg. no.)
99 clr.l d0
100 bset.l d1,d0 ;d0 is dynamic register mask
101 fmovem.x (a7)+,d0
102 rts
103 fp0123:
104 tst.b d0
105 beq.b is_fp0
106 cmpi.b #1,d0
107 beq.b is_fp1
108 cmpi.b #2,d0
109 beq.b is_fp2
110 is_fp3:
111 fmovem.x fp0,USER_FP3(a6)
112 rts
113 is_fp2:
114 fmovem.x fp0,USER_FP2(a6)
115 rts
116 is_fp1:
117 fmovem.x fp0,USER_FP1(a6)
118 rts
119 is_fp0:
120 fmovem.x fp0,USER_FP0(a6)
121 rts
122
123 end
124