MONADIC.CI5 revision 1.2 1 * $NetBSD: MONADIC.CI5,v 1.2 1994/10/26 07:48:39 cgd 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 * MONADIC.CI5 1.3 4/30/91
35 *
36 * MONADIC.CI5 --- MONADIC template for CI5 compiler
37 *
38
39 xref tag
40 xref _OPr_
41 xref _OPz_
42 xref _OPi_
43 xref _OPn_
44 xref _OPm_
45
46
47 xdef _OPd_
48 _OPd_:
49 link a6,#-LOCAL_SIZE
50 fmovem.x fp2-fp3,USER_FP2(a6)
51 fmove.l fpsr,USER_FPSR(a6)
52 fmove.l fpcr,d1 ; user's rounding mode/precision
53 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
54 *
55 * copy, convert and tag input argument
56 *
57 fmove.d 8(a6),fp0
58 fmove.x fp0,ETEMP(a6)
59 lea ETEMP(a6),a0
60 bsr tag
61 move.b d0,STAG(a6)
62 tst.b d0
63 bne.b _TMP_2
64 bsr _OPr_ ; normalized (regular) number
65 bra.b _TMP_6
66 _TMP_2:
67 cmp.b #$20,d0 ; zero?
68 bne.b _TMP_3
69 bsr _OPz_
70 bra.b _TMP_6
71 _TMP_3:
72 cmp.b #$40,d0 ; infinity?
73 bne.b _TMP_4
74 bsr _OPi_
75 bra.b _TMP_6
76 _TMP_4:
77 cmp.b #$60,d0 ; NaN?
78 bne.b _TMP_5
79 bsr _OPn_
80 bra.b _TMP_6
81 _TMP_5:
82 bsr _OPm_ ; assuming a denorm...
83
84 _TMP_6:
85 fmove.l fpsr,d0 ; update status register
86 or.b USER_FPSR+3(a6),d0 ;add previously accrued exceptions
87 move.l d0,USER_FPSR(a6)
88 *
89 * Result is now in FP0
90 *
91 fmovem.x USER_FP2(a6),fp2-fp3 ; note: FP1 not restored
92 unlk a6
93 rts
94