DYADIC.GCC revision 1.1 1 * MOTOROLA MICROPROCESSOR & MEMORY TECHNOLOGY GROUP
2 * M68000 Hi-Performance Microprocessor Division
3 * M68040 Software Package
4 *
5 * M68040 Software Package Copyright (c) 1993, 1994 Motorola Inc.
6 * All rights reserved.
7 *
8 * THE SOFTWARE is provided on an "AS IS" basis and without warranty.
9 * To the maximum extent permitted by applicable law,
10 * MOTOROLA DISCLAIMS ALL WARRANTIES WHETHER EXPRESS OR IMPLIED,
11 * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
12 * PARTICULAR PURPOSE and any warranty against infringement with
13 * regard to the SOFTWARE (INCLUDING ANY MODIFIED VERSIONS THEREOF)
14 * and any accompanying written materials.
15 *
16 * To the maximum extent permitted by applicable law,
17 * IN NO EVENT SHALL MOTOROLA BE LIABLE FOR ANY DAMAGES WHATSOEVER
18 * (INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS
19 * PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR
20 * OTHER PECUNIARY LOSS) ARISING OF THE USE OR INABILITY TO USE THE
21 * SOFTWARE. Motorola assumes no responsibility for the maintenance
22 * and support of the SOFTWARE.
23 *
24 * You are hereby granted a copyright license to use, modify, and
25 * distribute the SOFTWARE so long as this entire notice is retained
26 * without alteration in any modified and/or redistributed versions,
27 * and that such modified versions are clearly identified as such.
28 * No licenses are granted by implication, estoppel or otherwise
29 * under any patents or trademarks of Motorola, Inc.
30
31 *
32 * DYADIC.GCC --- DYADIC template for GCC compiler
33 *
34 * This is based on the generic template. The only difference is that
35 * GCC does not need the d0-d1/a0-a1 registers saved.
36 *
37 * Customizations:
38 * 2. Likewise, don't save FP0/FP1 if they are scratch
39 * registers.
40 * 3. Delete updating of the fpsr if you only care about
41 * the result.
42 * 5. Move the result to d0/d1 if the compiler is that old.
43 *
44
45 xref _OPa_
46 xref tag
47
48 xdef _OPs_
49 _OPs_:
50 link a6,#-LOCAL_SIZE
51 fmovem.x fp0-fp3,USER_FP0(a6)
52 fmove.l fpsr,USER_FPSR(a6)
53 fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
54 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
55 *
56 * copy, convert and tag input arguments
57 *
58 fmove.s 8(a6),fp0
59 fmove.x fp0,FPTEMP(a6)
60 lea FPTEMP(a6),a0
61 bsr tag
62 move.b d0,DTAG(a6)
63
64 fmove.s 12(a6),fp0
65 fmove.x fp0,ETEMP(a6)
66 lea ETEMP(a6),a0
67 bsr tag
68 move.b d0,STAG(a6)
69
70 bsr _OPa_
71
72 fmove.l fpsr,d0 ; update status register
73 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
74 swap.w d0
75 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
76 swap.w d0
77 fmove.l d0,fpsr
78 *
79 * Result is now in FP0
80 *
81 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
82 unlk a6
83 rts
84
85 xdef _OPd_
86 _OPd_:
87 link a6,#-LOCAL_SIZE
88 fmovem.x fp0-fp3,USER_FP0(a6)
89 fmove.l fpsr,USER_FPSR(a6)
90 fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
91 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
92 *
93 * copy, convert and tag input arguments
94 *
95 fmove.d 8(a6),fp0
96 fmove.x fp0,FPTEMP(a6)
97 lea FPTEMP(a6),a0
98 bsr tag
99 move.b d0,DTAG(a6)
100
101 fmove.d 16(a6),fp0
102 fmove.x fp0,ETEMP(a6)
103 lea ETEMP(a6),a0
104 bsr tag
105 move.b d0,STAG(a6)
106
107 bsr _OPa_
108
109 fmove.l fpsr,d0 ; update status register
110 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
111 swap.w d0
112 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
113 swap.w d0
114 fmove.l d0,fpsr
115 *
116 * Result is now in FP0
117 *
118 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
119 unlk a6
120 rts
121
122 xdef _OPx_
123 _OPx_:
124 link a6,#-LOCAL_SIZE
125 fmovem.x fp0-fp3,USER_FP0(a6)
126 fmove.l fpsr,USER_FPSR(a6)
127 fmove.l fpcr,USER_FPCR(a6) ; user's rounding mode/precision
128 fmove.l #0,fpcr ; force rounding mode/prec to extended,rn
129 *
130 * copy, convert and tag input arguments
131 *
132 fmove.x 8(a6),fp0
133 fmove.x fp0,FPTEMP(a6)
134 lea FPTEMP(a6),a0
135 bsr tag
136 move.b d0,DTAG(a6)
137
138 fmove.x 20(a6),fp0
139 fmove.x fp0,ETEMP(a6)
140 lea ETEMP(a6),a0
141 bsr tag
142 move.b d0,STAG(a6)
143
144 bsr _OPa_
145
146 fmove.l fpsr,d0 ; update status register
147 or.b FPSR_AEXCEPT(a6),d0 ;add previously accrued exceptions
148 swap.w d0
149 or.b FPSR_QBYTE(a6),d0 ; pickup sign of quotient byte
150 swap.w d0
151 fmove.l d0,fpsr
152 *
153 * Result is now in FP0
154 *
155 fmovem.x USER_FP1(a6),fp1-fp3 ; note: FP0 not restored
156 unlk a6
157 rts
158
159