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 * DYADIC.GEN 1.2 4/30/91
36 * DYADIC.GEN --- generic DYADIC template
38 * This version saves all registers that will be used by the emulation
39 * routines and restores all but FP0 on exit. The FPSR is
40 * updated to reflect the result of the operation. Return value
41 * is placed in FP0 for single, double and extended results.
43 * The package subroutines expect the incoming FPCR to be zeroed
44 * since they need extended precision to work properly. The
45 * 'final' FPCR is expected in USER_FPCR(a6) so that the calculated result
46 * can be properly sized and rounded. Also, if the incoming FPCR
47 * has enabled any exceptions, the exception will be taken on the
48 * final fmovem in this template.
51 * 1. Remove the movem.l at the entry and exit of
52 * each routine if your compiler treats those
53 * registers as scratch.
54 * 2. Likewise, don't save FP0/FP1 if they are scratch
56 * 3. Delete updating of the fpsr if you only care about
58 * 4. Remove the _OPs_ and _OPx_ entry points if your compiler
59 * treats everything as doubles.
60 * 5. Move the result to d0/d1 if the compiler is that old.
69 movem.l d0-d1/a0-a1,USER_DA(a6)
70 fmovem.x fp0-fp3,USER_FP0(a6)
71 fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
72 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
74 * copy, convert and tag input arguments
77 fmove.x fp0,FPTEMP(a6)
90 fmove.l fpsr,d0 ; update status register
91 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
93 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
97 * Result is now in FP0
99 movem.l USER_DA(a6),d0-d1/a0-a1
100 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
107 movem.l d0-d1/a0-a1,USER_DA(a6)
108 fmovem.x fp0-fp3,USER_FP0(a6)
109 fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
110 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
112 * copy, convert and tag input arguments
115 fmove.x fp0,FPTEMP(a6)
121 fmove.x fp0,ETEMP(a6)
128 fmove.l fpsr,d0 ; update status register
129 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
131 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
135 * Result is now in FP0
137 movem.l USER_DA(a6),d0-d1/a0-a1
138 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
145 movem.l d0-d1/a0-a1,USER_DA(a6)
146 fmovem.x fp0-fp3,USER_FP0(a6)
147 fmovem.l fpsr/fpcr,USER_FPSR(a6) ; user's rounding mode/precision
148 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
150 * copy, convert and tag input arguments
153 fmove.x fp0,FPTEMP(a6)
159 fmove.x fp0,ETEMP(a6)
166 fmove.l fpsr,d0 ; update status register
167 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
169 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
173 * Result is now in FP0
175 movem.l USER_DA(a6),d0-d1/a0-a1
176 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored