Expand PMF_FN_* macros.
[netbsd-mini2440.git] / sys / arch / pmax / test / fptest1.s
blob47526779da9bf6a79eb2f1daefd30ebef218ce75
1 /*
2 * Routines for floating point emulation testing.
3 */
5 #include <machine/regdef.h>
6 #include <machine/machAsmDefs.h>
7 #include <machine/machConst.h>
9 .rdata
10 jtab:
11 .word add_s
12 .word add_d
13 .word sub_s
14 .word sub_d
15 .word mul_s
16 .word mul_d
17 .word div_s
18 .word div_d
19 .word abs_s
20 .word abs_d
21 .word mov_s
22 .word mov_d
23 .word neg_s
24 .word neg_d
25 .word cvt_s_d
26 .word cvt_s_w
27 .word cvt_d_s
28 .word cvt_d_w
29 .word cvt_w_s
30 .word cvt_w_d
31 .word c_f_s
32 .word c_un_s
33 .word c_eq_s
34 .word c_ueq_s
35 .word c_olt_s
36 .word c_ult_s
37 .word c_ole_s
38 .word c_ule_s
39 .word c_sf_s
40 .word c_ngle_s
41 .word c_seq_s
42 .word c_ngl_s
43 .word c_lt_s
44 .word c_nge_s
45 .word c_le_s
46 .word c_ngt_s
47 .word c_f_d
48 .word c_un_d
49 .word c_eq_d
50 .word c_ueq_d
51 .word c_olt_d
52 .word c_ult_d
53 .word c_ole_d
54 .word c_ule_d
55 .word c_sf_d
56 .word c_ngle_d
57 .word c_seq_d
58 .word c_ngl_d
59 .word c_lt_d
60 .word c_nge_d
61 .word c_le_d
62 .word c_ngt_d
63 .text
65 LEAF(dofp)
66 cfc1 v0, MACH_FPC_CSR
67 lw t1, 16(sp) # get 4th arg
68 mtc1 a1, $f4
69 mtc1 a2, $f5
70 mtc1 a3, $f6
71 mtc1 t1, $f7
72 ctc1 zero, MACH_FPC_CSR
73 sll a0, a0, 2 # index into jump table
74 lw t0, jtab(a0)
75 j t0
77 add_s:
78 add.s $f0, $f4, $f6
79 b done
80 add_d:
81 add.d $f0, $f4, $f6
82 b done
83 sub_s:
84 sub.s $f0, $f4, $f6
85 b done
86 sub_d:
87 sub.d $f0, $f4, $f6
88 b done
89 mul_s:
90 mul.s $f0, $f4, $f6
91 b done
92 mul_d:
93 mul.d $f0, $f4, $f6
94 b done
95 div_s:
96 div.s $f0, $f4, $f6
97 b done
98 div_d:
99 div.d $f0, $f4, $f6
100 b done
101 abs_s:
102 abs.s $f0, $f4
103 b done
104 abs_d:
105 abs.d $f0, $f4
106 b done
107 mov_s:
108 mov.s $f0, $f4
109 b done
110 mov_d:
111 mov.d $f0, $f4
112 b done
113 neg_s:
114 neg.s $f0, $f4
115 b done
116 neg_d:
117 neg.d $f0, $f4
118 b done
119 cvt_s_d:
120 cvt.s.d $f0, $f4
121 b done
122 cvt_s_w:
123 cvt.s.w $f0, $f4
124 b done
125 cvt_d_s:
126 cvt.d.s $f0, $f4
127 b done
128 cvt_d_w:
129 cvt.d.w $f0, $f4
130 b done
131 cvt_w_s:
132 cvt.w.s $f0, $f4
133 b done
134 cvt_w_d:
135 cvt.w.d $f0, $f4
136 b done
137 c_f_s:
138 c.f.s $f4, $f6
139 b done
140 c_un_s:
141 c.un.s $f4, $f6
142 b done
143 c_eq_s:
144 c.eq.s $f4, $f6
145 b done
146 c_ueq_s:
147 c.ueq.s $f4, $f6
148 b done
149 c_olt_s:
150 c.olt.s $f4, $f6
151 b done
152 c_ult_s:
153 c.ult.s $f4, $f6
154 b done
155 c_ole_s:
156 c.ole.s $f4, $f6
157 b done
158 c_ule_s:
159 c.ule.s $f4, $f6
160 b done
161 c_sf_s:
162 c.sf.s $f4, $f6
163 b done
164 c_ngle_s:
165 c.ngle.s $f4, $f6
166 b done
167 c_seq_s:
168 c.seq.s $f4, $f6
169 b done
170 c_ngl_s:
171 c.ngl.s $f4, $f6
172 b done
173 c_lt_s:
174 c.lt.s $f4, $f6
175 b done
176 c_nge_s:
177 c.nge.s $f4, $f6
178 b done
179 c_le_s:
180 c.le.s $f4, $f6
181 b done
182 c_ngt_s:
183 c.ngt.s $f4, $f6
184 b done
185 c_f_d:
186 c.f.d $f4, $f6
187 b done
188 c_un_d:
189 c.un.d $f4, $f6
190 b done
191 c_eq_d:
192 c.eq.d $f4, $f6
193 b done
194 c_ueq_d:
195 c.ueq.d $f4, $f6
196 b done
197 c_olt_d:
198 c.olt.d $f4, $f6
199 b done
200 c_ult_d:
201 c.ult.d $f4, $f6
202 b done
203 c_ole_d:
204 c.ole.d $f4, $f6
205 b done
206 c_ule_d:
207 c.ule.d $f4, $f6
208 b done
209 c_sf_d:
210 c.sf.d $f4, $f6
211 b done
212 c_ngle_d:
213 c.ngle.d $f4, $f6
214 b done
215 c_seq_d:
216 c.seq.d $f4, $f6
217 b done
218 c_ngl_d:
219 c.ngl.d $f4, $f6
220 b done
221 c_lt_d:
222 c.lt.d $f4, $f6
223 b done
224 c_nge_d:
225 c.nge.d $f4, $f6
226 b done
227 c_le_d:
228 c.le.d $f4, $f6
229 b done
230 c_ngt_d:
231 c.ngt.d $f4, $f6
232 done:
233 cfc1 t0, MACH_FPC_CSR
234 mfc1 v0, $f0
235 mfc1 v1, $f1
236 sw t0, fp_res+8
237 sw v0, fp_res
238 sw v1, fp_res+4
239 j ra
240 END(dofp)
242 .rdata
243 itab:
244 .word 0x46062000 # add.s f0,f4,f6
245 .word 0x46262000 # add.d f0,f4,f6
246 .word 0x46062001 # sub.s f0,f4,f6
247 .word 0x46262001 # sub.d f0,f4,f6
248 .word 0x46062002 # mul.s f0,f4,f6
249 .word 0x46262002 # mul.d f0,f4,f6
250 .word 0x46062003 # div.s f0,f4,f6
251 .word 0x46262003 # div.d f0,f4,f6
252 .word 0x46002005 # abs.s f0,f4
253 .word 0x46202005 # abs.d f0,f4
254 .word 0x46002006 # mov.s f0,f4
255 .word 0x46202006 # mov.d f0,f4
256 .word 0x46002007 # neg.s f0,f4,f0
257 .word 0x46202007 # neg.d f0,f4,f0
258 .word 0x46202020 # cvt.s.d f0,f4
259 .word 0x46802020 # cvt.s.w f0,f4
260 .word 0x46002021 # cvt.d.s f0,f4
261 .word 0x46802021 # cvt.d.w f0,f4
262 .word 0x46002024 # cvt.w.s f0,f4
263 .word 0x46202024 # cvt.w.d f0,f4
264 .word 0x46062030 # c.f.s f4,f6
265 .word 0x46062031 # c.un.s f4,f6
266 .word 0x46062032 # c.eq.s f4,f6
267 .word 0x46062033 # c.ueq.s f4,f6
268 .word 0x46062034 # c.olt.s f4,f6
269 .word 0x46062035 # c.ult.s f4,f6
270 .word 0x46062036 # c.ole.s f4,f6
271 .word 0x46062037 # c.ule.s f4,f6
272 .word 0x46062038 # c.sf.s f4,f6
273 .word 0x46062039 # c.ngle.s f4,f6
274 .word 0x4606203a # c.seq.s f4,f6
275 .word 0x4606203b # c.ngl.s f4,f6
276 .word 0x4606203c # c.lt.s f4,f6
277 .word 0x4606203d # c.nge.s f4,f6
278 .word 0x4606203e # c.le.s f4,f6
279 .word 0x4606203f # c.ngt.s f4,f6
280 .word 0x46262030 # c.f.d f4,f6
281 .word 0x46262031 # c.un.d f4,f6
282 .word 0x46262032 # c.eq.d f4,f6
283 .word 0x46262033 # c.ueq.d f4,f6
284 .word 0x46262034 # c.olt.d f4,f6
285 .word 0x46262035 # c.ult.d f4,f6
286 .word 0x46262036 # c.ole.d f4,f6
287 .word 0x46262037 # c.ule.d f4,f6
288 .word 0x46262038 # c.sf.d f4,f6
289 .word 0x46262039 # c.ngle.d f4,f6
290 .word 0x4626203a # c.seq.d f4,f6
291 .word 0x4626203b # c.ngl.d f4,f6
292 .word 0x4626203c # c.lt.d f4,f6
293 .word 0x4626203d # c.nge.d f4,f6
294 .word 0x4626203e # c.le.d f4,f6
295 .word 0x4626203f # c.ngt.d f4,f6
296 .text
298 NON_LEAF(emfp, STAND_FRAME_SIZE, ra)
299 subu sp, sp, STAND_FRAME_SIZE
300 sw ra, STAND_RA_OFFSET(sp)
301 .mask 0x80000000, (STAND_RA_OFFSET - STAND_FRAME_SIZE)
303 cfc1 v0, MACH_FPC_CSR
304 lw t1, STAND_FRAME_SIZE+16(sp) # get 4th arg
305 mtc1 a1, $f4
306 mtc1 a2, $f5
307 mtc1 a3, $f6
308 mtc1 t1, $f7
309 ctc1 zero, MACH_FPC_CSR
310 sll a0, a0, 2 # index into instruction table
311 lw a0, itab(a0)
313 jal MachEmulateFP
315 cfc1 t0, MACH_FPC_CSR
316 mfc1 v0, $f0
317 mfc1 v1, $f1
318 sw t0, em_res+8
319 sw v0, em_res
320 sw v1, em_res+4
321 lw ra, STAND_RA_OFFSET(sp)
322 addu sp, sp, STAND_FRAME_SIZE
323 j ra
324 END(emfp)