1 * $NetBSD: MONADIC.GCC,v 1.2 1994/10/26 07:48:40 cgd Exp $
3 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
4 * M68000 Hi-Performance Microprocessor Division
5 * M68040 Software Package
7 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
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.
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.
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.
34 * MONADIC.GCC --- MONADIC template for GCC compiler
36 * This is based on the generic template. The only difference is that
37 * GCC does not need the d0-d1/a0-a1 registers saved.
40 * 2. Likewise, don't save FP0/FP1 if they are scratch
42 * 3. Delete handling of the fpsr if you only care about
44 * 5. Move the result to d0/d1 if the compiler is that old.
57 fmovem.x fp0-fp3,USER_FP0(a6)
58 fmove.l fpsr,USER_FPSR(a6)
59 fmove.l fpcr,USER_FPCR(a6)
60 fmove.l fpcr,d1 ; user's rounding mode/precision
61 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
63 * copy, convert and tag input argument
72 bsr _OPr_ ; normalized (regular) number
80 cmp.b #$40,d0 ; infinity?
90 bsr _OPm_ ; assuming a denorm...
93 fmove.l fpsr,d0 ; update status register
94 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
97 * Result is now in FP0
99 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
100 fmove.l USER_FPCR(a6),fpcr ; fpcr restored
107 fmovem.x fp0-fp3,USER_FP0(a6)
108 fmove.l fpsr,USER_FPSR(a6)
109 fmove.l fpcr,USER_FPCR(a6)
110 fmove.l fpcr,d1 ; user's rounding mode/precision
111 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
113 * copy, convert and tag input argument
116 fmove.x fp0,ETEMP(a6)
122 bsr _OPr_ ; normalized (regular) number
125 cmp.b #$20,d0 ; zero?
130 cmp.b #$40,d0 ; infinity?
140 bsr _OPm_ ; assuming a denorm...
143 fmove.l fpsr,d0 ; update status register
144 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
147 * Result is now in FP0
149 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
150 fmove.l USER_FPCR(a6),fpcr ; fpcr restored
157 fmovem.x fp0-fp3,USER_FP0(a6)
158 fmove.l fpsr,USER_FPSR(a6)
159 fmove.l fpcr,USER_FPCR(a6)
160 fmove.l fpcr,d1 ; user's rounding mode/precision
161 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
163 * copy, convert and tag input argument
166 fmove.x fp0,ETEMP(a6)
172 bsr _OPr_ ; normalized (regular) number
175 cmp.b #$20,d0 ; zero?
180 cmp.b #$40,d0 ; infinity?
190 bsr _OPm_ ; assuming a denorm...
193 fmove.l fpsr,d0 ; update status register
194 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
197 * Result is now in FP0
199 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
200 fmove.l USER_FPCR(a6),fpcr ; fpcr restored