Annotation of sys/arch/m68k/fpsp/MONADIC.GCC, Revision 1.1.1.1
1.1 nbrk 1: * $OpenBSD: MONADIC.GCC,v 1.2 1996/05/29 21:05:22 niklas Exp $
2: * $NetBSD: MONADIC.GCC,v 1.2 1994/10/26 07:48:40 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: * MONADIC.GCC --- MONADIC 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 handling 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 tag
49: xref _OPr_
50: xref _OPz_
51: xref _OPi_
52: xref _OPn_
53: xref _OPm_
54:
55: xdef _OPs_
56: _OPs_:
57: link a6,#-LOCAL_SIZE
58: fmovem.x fp0-fp3,USER_FP0(a6)
59: fmove.l fpsr,USER_FPSR(a6)
60: fmove.l fpcr,USER_FPCR(a6)
61: fmove.l fpcr,d1 ; user's rounding mode/precision
62: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
63: *
64: * copy, convert and tag input argument
65: *
66: fmove.s 8(a6),fp0
67: fmove.x fp0,ETEMP(a6)
68: lea ETEMP(a6),a0
69: bsr tag
70: move.b d0,STAG(a6)
71: tst.b d0
72: bne.b _TMP_2
73: bsr _OPr_ ; normalized (regular) number
74: bra.b _TMP_6
75: _TMP_2:
76: cmp.b #$20,d0 ; zero?
77: bne.b _TMP_3
78: bsr _OPz_
79: bra.b _TMP_6
80: _TMP_3:
81: cmp.b #$40,d0 ; infinity?
82: bne.b _TMP_4
83: bsr _OPi_
84: bra.b _TMP_6
85: _TMP_4:
86: cmp.b #$60,d0 ; NaN?
87: bne.b _TMP_5
88: bsr _OPn_
89: bra.b _TMP_6
90: _TMP_5:
91: bsr _OPm_ ; assuming a denorm...
92:
93: _TMP_6:
94: fmove.l fpsr,d0 ; update status register
95: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
96: fmove.l d0,fpsr
97: *
98: * Result is now in FP0
99: *
100: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
101: fmove.l USER_FPCR(a6),fpcr ; fpcr restored
102: unlk a6
103: rts
104:
105: xdef _OPd_
106: _OPd_:
107: link a6,#-LOCAL_SIZE
108: fmovem.x fp0-fp3,USER_FP0(a6)
109: fmove.l fpsr,USER_FPSR(a6)
110: fmove.l fpcr,USER_FPCR(a6)
111: fmove.l fpcr,d1 ; user's rounding mode/precision
112: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
113: *
114: * copy, convert and tag input argument
115: *
116: fmove.d 8(a6),fp0
117: fmove.x fp0,ETEMP(a6)
118: lea ETEMP(a6),a0
119: bsr tag
120: move.b d0,STAG(a6)
121: tst.b d0
122: bne.b _TMP_7
123: bsr _OPr_ ; normalized (regular) number
124: bra.b _TMP_B
125: _TMP_7:
126: cmp.b #$20,d0 ; zero?
127: bne.b _TMP_8
128: bsr _OPz_
129: bra.b _TMP_B
130: _TMP_8:
131: cmp.b #$40,d0 ; infinity?
132: bne.b _TMP_9
133: bsr _OPi_
134: bra.b _TMP_B
135: _TMP_9:
136: cmp.b #$60,d0 ; NaN?
137: bne.b _TMP_A
138: bsr _OPn_
139: bra.b _TMP_B
140: _TMP_A:
141: bsr _OPm_ ; assuming a denorm...
142:
143: _TMP_B:
144: fmove.l fpsr,d0 ; update status register
145: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
146: fmove.l d0,fpsr
147: *
148: * Result is now in FP0
149: *
150: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
151: fmove.l USER_FPCR(a6),fpcr ; fpcr restored
152: unlk a6
153: rts
154:
155: xdef _OPx_
156: _OPx_:
157: link a6,#-LOCAL_SIZE
158: fmovem.x fp0-fp3,USER_FP0(a6)
159: fmove.l fpsr,USER_FPSR(a6)
160: fmove.l fpcr,USER_FPCR(a6)
161: fmove.l fpcr,d1 ; user's rounding mode/precision
162: fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
163: *
164: * copy, convert and tag input argument
165: *
166: fmove.x 8(a6),fp0
167: fmove.x fp0,ETEMP(a6)
168: lea ETEMP(a6),a0
169: bsr tag
170: move.b d0,STAG(a6)
171: tst.b d0
172: bne.b _TMP_C
173: bsr _OPr_ ; normalized (regular) number
174: bra.b _TMP_G
175: _TMP_C:
176: cmp.b #$20,d0 ; zero?
177: bne.b _TMP_D
178: bsr _OPz_
179: bra.b _TMP_G
180: _TMP_D:
181: cmp.b #$40,d0 ; infinity?
182: bne.b _TMP_E
183: bsr _OPi_
184: bra.b _TMP_G
185: _TMP_E:
186: cmp.b #$60,d0 ; NaN?
187: bne.b _TMP_F
188: bsr _OPn_
189: bra.b _TMP_G
190: _TMP_F:
191: bsr _OPm_ ; assuming a denorm...
192:
193: _TMP_G:
194: fmove.l fpsr,d0 ; update status register
195: or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
196: fmove.l d0,fpsr
197: *
198: * Result is now in FP0
199: *
200: fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
201: fmove.l USER_FPCR(a6),fpcr ; fpcr restored
202: unlk a6
203: rts
204:
CVSweb