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 * l_support.sa 1.2 5/1/91
37 L_SUPPORT IDNT 2,1 Motorola 040 Floating Point Software Package
41 mns_one dc.l $bfff0000,$80000000,$00000000
42 pls_one dc.l $3fff0000,$80000000,$00000000
43 pls_inf dc.l $7fff0000,$00000000,$00000000
44 pls_huge dc.l $7ffe0000,$ffffffff,$ffffffff
45 mns_huge dc.l $fffe0000,$ffffffff,$ffffffff
46 pls_tiny dc.l $00000000,$80000000,$00000000
47 mns_tiny dc.l $80000000,$80000000,$00000000
48 small dc.l $20000000,$80000000,$00000000
49 pls_zero dc.l $00000000,$00000000,$00000000
54 * tag --- determine the type of an extended precision operand
56 * The tag values returned match the way the 68040 would have
59 * Input: a0 points to operand
61 * Output d0.b = $00 norm
66 * All other registers are unchanged
70 move.w LOCAL_EX(a0),d0
85 btst.b #7,LOCAL_HI(a0) # check if J-bit is set
104 * t_dz, t_dz2 --- divide by zero exception
106 * t_dz2 is used by monadic functions such as flogn (from do_func).
107 * t_dz is used by monadic functions such as satanh (from the
108 * transcendental function).
119 btst.b #sign_bit,ETEMP_EX(a6) ;check sign for neg or pos
120 beq.b p_inf ;branch if pos sign
132 * t_operr --- Operand Error exception
142 * t_unfl --- UNFL exception
146 btst.b #sign_bit,ETEMP(a6)
149 fmovem.x mns_tiny,fp0
155 fmovem.x pls_tiny,fp0
160 * t_ovfl --- OVFL exception
162 * t_ovfl is called as an exit for monadic functions. t_ovfl2
163 * is for dyadic exits.
168 move.l d1,USER_FPCR(a6) user's control register
169 move.l #ovfinx_mask,d0
172 move.l #ovfl_inx_mask,d0
174 btst.b #sign_bit,ETEMP(a6)
177 fmovem.x mns_huge,fp0
178 fmove.l USER_FPCR(a6),fpcr
185 fmovem.x pls_huge,fp0
186 fmove.l USER_FPCR(a6),fpcr
193 * t_inx2 --- INEX2 exception (correct fpcr is in USER_FPCR(a6))
197 fmove.l fpsr,USER_FPSR(a6) capture incoming fpsr
198 fmove.l USER_FPCR(a6),fpcr
200 * create an inex2 exception by adding two numbers with very different exponents
201 * do the add in fp1 so as to not disturb the result sitting in fp0
206 or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
207 fmove.l USER_FPSR(a6),fpsr
210 * t_frcinx --- Force Inex2 (for monadic functions)
214 fmove.l fpsr,USER_FPSR(a6) capture incoming fpsr
217 * create an inex2 exception by adding two numbers with very different exponents
218 * do the add in fp1 so as to not disturb the result sitting in fp0
223 or.l #inx2a_mask,USER_FPSR(a6) ;set INEX2, AINEX
224 btst.b #unfl_bit,FPSR_EXCEPT(a6) ;test for unfl bit set
225 beq.b no_uacc1 ;if clear, do not set aunfl
226 bset.b #aunfl_bit,FPSR_AEXCEPT(a6)
228 fmove.l USER_FPSR(a6),fpsr
231 * dst_nan --- force result when destination is a NaN
235 fmove.l USER_FPCR(a6),fpcr
236 fmove.x FPTEMP(a6),fp0
240 * src_nan --- force result when source is a NaN
244 fmove.l USER_FPCR(a6),fpcr
245 fmove.x ETEMP(a6),fp0
248 * mon_nan --- force result when source is a NaN (monadic version)
250 * This is the same as src_nan except that the user's fpcr comes
251 * in via d1, not USER_FPCR(a6).
256 fmove.x ETEMP(a6),fp0
259 * t_extdnrm, t_resdnrm --- generate results for denorm inputs
261 * For all functions that have a denormalized input and that f(x)=x,
262 * this is the entry point.
267 fmove.x LOCAL_EX(a0),fp0
275 fmove.l USER_FPCR(a6),fpcr
276 fmove.x LOCAL_EX(a0),fp0
291 fmovem.x LOCAL_EX(a0),fp1
294 * Native instruction support
296 * Some systems may need entry points even for 68040 native
297 * instructions. These routines are provided for
302 fmovem.x FPTEMP(a6),fp0
303 fmove.l USER_FPCR(a6),fpcr
309 fmovem.x FPTEMP(a6),fp0
310 fmove.l USER_FPCR(a6),fpcr
316 fmovem.x FPTEMP(a6),fp0
317 fmove.l USER_FPCR(a6),fpcr
323 fmovem.x FPTEMP(a6),fp0
324 fmove.l USER_FPCR(a6),fpcr
330 fmovem.x ETEMP(a6),fp0
337 fmovem.x ETEMP(a6),fp0
344 fmovem.x ETEMP(a6),fp0
350 * l_sint,l_sintrz,l_sintd --- special wrapper for fint and fintrz
352 * On entry, move the user's FPCR to USER_FPCR.
354 * On return from, we need to pickup the INEX2/AINEX bits
355 * that are in USER_FPSR.
363 move.l d1,USER_FPCR(a6)
366 or.l USER_FPSR(a6),d0
372 move.l d1,USER_FPCR(a6)
375 or.l USER_FPSR(a6),d0
381 move.l d1,USER_FPCR(a6)
384 or.l USER_FPSR(a6),d0