Commit | Line | Data |
---|---|---|
86530b38 AT |
1 | /* |
2 | * ========== Copyright Header Begin ========================================== | |
3 | * | |
4 | * OpenSPARC T2 Processor File: fp_ieee_flags_n2.s | |
5 | * Copyright (C) 1995-2007 Sun Microsystems, Inc. All Rights Reserved | |
6 | * 4150 Network Circle, Santa Clara, California 95054, U.S.A. | |
7 | * | |
8 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; version 2 of the License. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
22 | * | |
23 | * For the avoidance of doubt, and except that if any non-GPL license | |
24 | * choice is available it will apply instead, Sun elects to use only | |
25 | * the General Public License version 2 (GPLv2) at this time for any | |
26 | * software where a choice of GPL license versions is made | |
27 | * available with the language indicating that GPLv2 or any later version | |
28 | * may be used, or where a choice of which version of the GPL is applied is | |
29 | * otherwise unspecified. | |
30 | * | |
31 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, | |
32 | * CA 95054 USA or visit www.sun.com if you need additional information or | |
33 | * have any questions. | |
34 | * | |
35 | * | |
36 | * ========== Copyright Header End ============================================ | |
37 | */ | |
38 | #define H_T0_Fp_exception_ieee_754_0x21 T0_Fp_exception_ieee_754 | |
39 | #define H_T0_Fp_exception_other_0x22 T0_Fp_exception_other | |
40 | ||
41 | #define ENABLE_T0_Fp_disabled_0x20 | |
42 | #include "hboot.s" | |
43 | ||
44 | .global sam_fast_immu_miss | |
45 | .global sam_fast_dmmu_miss | |
46 | ||
47 | .text | |
48 | .global main | |
49 | ||
50 | main: | |
51 | ||
52 | wr %g0, 0x4, %fprs /* make sure fef is 1 */ | |
53 | ||
54 | setx fsr_tem_en, %l0, %l3 ! fsr tem enable value | |
55 | ||
56 | /******************************************************* | |
57 | * Simple data | |
58 | *******************************************************/ | |
59 | ||
60 | ! By default, mask is disabled | |
61 | ||
62 | ld [%l3+0x0], %fsr ! Read it from memory - trap disabled | |
63 | ||
64 | ||
65 | setx data1, %l0, %l2 ! Some data | |
66 | ||
67 | ld [%l2+0x0], %f0 ! 1.0 | |
68 | ld [%l2+0x4], %f2 ! 0.0 | |
69 | ld [%l2+0x8], %f4 ! -1.0 | |
70 | ld [%l2+0xc], %f6 ! -0.0 | |
71 | ||
72 | fsmuld %f0, %f0, %f10 | |
73 | fsmuld %f0, %f2, %f10 | |
74 | fsmuld %f0, %f4, %f10 | |
75 | fsmuld %f0, %f6, %f10 | |
76 | ||
77 | setx ddata1, %l0, %l2 ! Double precision boundaries | |
78 | ||
79 | ldd [%l2+0x0], %f0 ! 1.0 | |
80 | ldd [%l2+0x8], %f2 ! 0.0 | |
81 | ldd [%l2+0x10], %f4 ! -1.0 | |
82 | ldd [%l2+0x18], %f6 ! -0.0 | |
83 | ||
84 | fmuld %f0, %f0, %f32 | |
85 | fmuld %f0, %f2, %f34 | |
86 | fmuld %f0, %f4, %f36 | |
87 | fmuld %f0, %f6, %f10 | |
88 | ||
89 | setx newdata, %l0, %l6 ! Double precision data | |
90 | ||
91 | ldd [%l6+%g0], %f0 ! double precision | |
92 | add %g0, 0x8, %g4 | |
93 | ldd [%l6+%g4], %f2 ! double precision | |
94 | add %g4, 0x8, %g4 | |
95 | ldd [%l6+%g4], %f4 ! double precision | |
96 | add %g4, 0x8, %g4 | |
97 | ldd [%l6+%g4], %f6 ! double precision | |
98 | add %g4, 0x8, %g4 | |
99 | ldd [%l6+%g4], %f8 ! double precision | |
100 | add %g4, 0x8, %g4 | |
101 | ldd [%l6+%g4], %f10 ! double precision | |
102 | add %g4, 0x8, %g4 | |
103 | ldd [%l6+%g4], %f12 ! double precision | |
104 | add %g4, 0x8, %g4 | |
105 | ldd [%l6+%g4], %f14 ! double precision | |
106 | add %g4, 0x8, %g4 | |
107 | ldd [%l6+%g4], %f16 ! double precision | |
108 | add %g4, 0x8, %g4 | |
109 | ldd [%l6+%g4], %f18 ! double precision | |
110 | add %g4, 0x8, %g4 | |
111 | ldd [%l6+%g4], %f20 ! double precision | |
112 | ||
113 | ||
114 | set 0x25, %g6 ! Max loop count rd | |
115 | set 0x30, %g1 ! Max loop count | |
116 | ||
117 | set 0x0, %g7 ! loop iterator | |
118 | ||
119 | fmuldiv_rd_loop0: ! Rounding mode loop | |
120 | ||
121 | sll %g7, 0x2, %g5 ! Align address | |
122 | ld [%l3+%g5], %fsr ! Read it from memory - trap disabled | |
123 | ||
124 | ||
125 | faddd %f2, %f4, %f22 | |
126 | faddd %f6, %f8, %f24 | |
127 | faddd %f10, %f12, %f26 | |
128 | fdtos %f16, %f28 | |
129 | fdivd %f18, %f20, %f30 | |
130 | fdtos %f0, %f14 | |
131 | ||
132 | add %g7, 0x1, %g7 | |
133 | subcc %g7, %g6, %g0 | |
134 | ||
135 | bne,a fmuldiv_rd_loop0 ! If not 0, go to test more | |
136 | nop | |
137 | ||
138 | ||
139 | /******************************************************* | |
140 | * Exit code | |
141 | *******************************************************/ | |
142 | ||
143 | test_pass: | |
144 | ta T_GOOD_TRAP | |
145 | ||
146 | test_fail: | |
147 | ta T_BAD_TRAP | |
148 | ||
149 | /******************************************************* | |
150 | * Data section | |
151 | *******************************************************/ | |
152 | ||
153 | .data | |
154 | ||
155 | ||
156 | ||
157 | .align 256 | |
158 | ||
159 | data1: | |
160 | .word 0x3f800000 ! 1.0 0x0 | |
161 | .word 0x00000000 ! 0.0 0x4 | |
162 | .word 0xbf800000 ! -1.0 0x8 | |
163 | .word 0x80000000 ! -0.0 0xc | |
164 | ||
165 | .word 0x4f000000 ! Large positive number should cause NV on conversion 0x10 | |
166 | .word 0xcf000000 ! Large negative number should cause NV on conversion 0x14 | |
167 | ||
168 | .word 0x5f0ac723 ! Large positive number should cause NV on conversion 0x18 | |
169 | .word 0xdf0ac723 ! Large negative number should cause NV on conversion 0x1c | |
170 | ||
171 | data1_denorm: | |
172 | ||
173 | .word 0x807fffff ! Denormal number -ve | |
174 | .word 0x80700000 ! Denormal number -ve | |
175 | .word 0x803fffff ! Denormal number -ve | |
176 | .word 0x80400000 ! Denormal number -ve | |
177 | .word 0x80400001 ! Denormal number -ve | |
178 | .word 0x80000001 ! Denormal number -ve | |
179 | .word 0x80000001 ! Denormal number -ve | |
180 | .word 0x007fffff ! Denormal number +ve | |
181 | .word 0x007fffff ! Denormal number +ve | |
182 | .word 0x00700000 ! Denormal number +ve | |
183 | .word 0x003fffff ! Denormal number +ve | |
184 | .word 0x00400000 ! Denormal number +ve | |
185 | .word 0x00400001 ! Denormal number +ve | |
186 | .word 0x00000001 ! Denormal number +ve | |
187 | ||
188 | data1_norm: | |
189 | ||
190 | .word 0xff7fffff ! Normal | |
191 | .word 0xff700000 ! Normal | |
192 | .word 0xff7ffffe ! Normal | |
193 | .word 0xff7aaaaa ! Normal | |
194 | .word 0xff755555 ! Normal | |
195 | .word 0xfe7fffff ! Normal | |
196 | .word 0xfe700000 ! Normal | |
197 | .word 0xfe7ffffe ! Normal | |
198 | .word 0xfe7aaaaa ! Normal | |
199 | .word 0xfe755555 ! Normal | |
200 | .word 0x80ffffff ! Normal | |
201 | .word 0x80f00000 ! Normal | |
202 | .word 0x80c00001 ! Normal | |
203 | .word 0x80c00000 ! Normal | |
204 | .word 0x80800001 ! Normal | |
205 | .word 0x80800000 ! Normal | |
206 | .word 0x80800000 ! Normal | |
207 | .word 0x00800000 ! Normal | |
208 | .word 0x00800000 ! Normal | |
209 | .word 0x00800001 ! Normal | |
210 | .word 0x00c00000 ! Normal | |
211 | .word 0x00c00001 ! Normal | |
212 | .word 0x00f00000 ! Normal | |
213 | .word 0x00ffffff ! Normal | |
214 | .word 0x7e755555 ! Normal | |
215 | .word 0x7e7aaaaa ! Normal | |
216 | .word 0x7e7ffffe ! Normal | |
217 | .word 0x7e700000 ! Normal | |
218 | .word 0x7e7fffff ! Normal | |
219 | .word 0x7f755555 ! Normal | |
220 | .word 0x7f7aaaaa ! Normal | |
221 | .word 0x7f7ffffe ! Normal | |
222 | .word 0x7f700000 ! Normal | |
223 | .word 0x7f7fffff ! Normal | |
224 | ||
225 | .align 256 | |
226 | ||
227 | ddata1: | |
228 | .xword 0x3ff0000000000000 ! 1.0 0x0 | |
229 | .xword 0x0000000000000000 ! 0.0 0x8 | |
230 | .xword 0xbff0000000000000 ! -1.0 0x10 | |
231 | .xword 0x8000000000000000 ! -0.0 0x18 | |
232 | ||
233 | .xword 0x41e0000000000000 ! Large positive number should cause NV on conversion 0x20 | |
234 | .xword 0xc1e0000000000000 ! Large negative number should cause NV on conversion 0x28 | |
235 | ||
236 | .xword 0x43e158e460913d00 ! Large positive number should cause NV on conversion to int 0x30 | |
237 | .xword 0xc3e158e460913d00 ! Large negative number should cause NV on conversion to int 0x38 | |
238 | ||
239 | ddata1_denorm: | |
240 | ||
241 | .xword 0x800fffffffffffff ! Denormal number -ve | |
242 | .xword 0x800f000000000000 ! Denormal number -ve | |
243 | .xword 0x8007ffffffffffff ! Denormal number -ve | |
244 | .xword 0x8008000000000000 ! Denormal number -ve | |
245 | .xword 0x8008000000000001 ! Denormal number -ve | |
246 | .xword 0x8000000000000001 ! Denormal number -ve | |
247 | .xword 0x8000000000000001 ! Denormal number -ve | |
248 | .xword 0x000fffffffffffff ! Denormal number +ve | |
249 | .xword 0x000fffffffffffff ! Denormal number +ve | |
250 | .xword 0x000f000000000000 ! Denormal number +ve | |
251 | .xword 0x0007ffffffffffff ! Denormal number +ve | |
252 | .xword 0x0008000000000000 ! Denormal number +ve | |
253 | .xword 0x0008000000000001 ! Denormal number +ve | |
254 | .xword 0x0000000000000001 ! Denormal number +ve | |
255 | ||
256 | ddata1_norm: | |
257 | ||
258 | .xword 0xffefffffffffffff ! Normal | |
259 | .xword 0xffef000000000000 ! Normal | |
260 | .xword 0xffeffffffffffffe ! Normal | |
261 | .xword 0xffeaaaaaaaaaaaaa ! Normal | |
262 | .xword 0xffe5555555555555 ! Normal | |
263 | .xword 0xffcfffffffffffff ! Normal | |
264 | .xword 0xffcf000000000000 ! Normal | |
265 | .xword 0xffcffffffffffffe ! Normal | |
266 | .xword 0xffcaaaaaaaaaaaaa ! Normal | |
267 | .xword 0xffc5555555555555 ! Normal | |
268 | .xword 0x801fffffffffffff ! Normal | |
269 | .xword 0x801f000000000000 ! Normal | |
270 | .xword 0x8018000000000001 ! Normal | |
271 | .xword 0x8018000000000000 ! Normal | |
272 | .xword 0x8010000000000001 ! Normal | |
273 | .xword 0x8010000000000000 ! Normal | |
274 | .xword 0x8010000000000000 ! Normal | |
275 | .xword 0x0010000000000000 ! Normal | |
276 | .xword 0x0010000000000000 ! Normal | |
277 | .xword 0x0010000000000001 ! Normal | |
278 | .xword 0x0018000000000000 ! Normal | |
279 | .xword 0x0018000000000001 ! Normal | |
280 | .xword 0x001f000000000000 ! Normal | |
281 | .xword 0x001fffffffffffff ! Normal | |
282 | .xword 0x7fc5555555555555 ! Normal | |
283 | .xword 0x7fcaaaaaaaaaaaaa ! Normal | |
284 | .xword 0x7fcffffffffffffe ! Normal | |
285 | .xword 0x7fc7000000000000 ! Normal | |
286 | .xword 0x7fc7ffffffffffff ! Normal | |
287 | .xword 0x7fe5555555555555 ! Normal | |
288 | .xword 0x7fe5aaaaaaaaaaaa ! Normal | |
289 | .xword 0x7feffffffffffffe ! Normal | |
290 | .xword 0x7fef000000000000 ! Normal | |
291 | .xword 0x7fefffffffffffff ! Normal | |
292 | ||
293 | .align 512 | |
294 | ||
295 | int_data_x: | |
296 | .xword 0x0000000000000000 ! 0 | |
297 | .xword 0x0000000000000001 ! 1 | |
298 | .xword 0x7fffffffffffffff ! | |
299 | .xword 0xffffffffffffffff ! | |
300 | .xword 0xaaaaaaaaaaaaaaaa ! 0 | |
301 | .xword 0x5555555555555555 ! 1 | |
302 | .xword 0x4000000000000000 ! | |
303 | .xword 0x8000000000000000 ! | |
304 | ||
305 | int_data_i: | |
306 | .word 0x00000000 ! 0 | |
307 | .word 0x00000001 ! 1 | |
308 | .word 0x7fffffff ! | |
309 | .word 0xffffffff ! | |
310 | .word 0xaaaaaaaa ! | |
311 | .word 0x55555555 ! | |
312 | .word 0x40000000 ! | |
313 | .word 0x80000000 ! | |
314 | ||
315 | .align 256 | |
316 | ||
317 | fsr_tem_en: | |
318 | .word 0x0f800000 ! TEM - all enabled - rd 0 | |
319 | .word 0x4f800000 ! TEM - all enabled - rd 1 | |
320 | .word 0x8f800000 ! TEM - all enabled - rd 2 | |
321 | .word 0xcf800000 ! TEM - all enabled - rd 3 | |
322 | .word 0x00000000 ! TEM - walk through all values | |
323 | .word 0x0f800000 | |
324 | .word 0x01000000 | |
325 | .word 0x01800000 | |
326 | .word 0x02000000 | |
327 | .word 0x02800000 | |
328 | .word 0x03000000 | |
329 | .word 0x03800000 | |
330 | .word 0x04000000 | |
331 | .word 0x04800000 | |
332 | .word 0x05000000 | |
333 | .word 0x05800000 | |
334 | .word 0x06000000 | |
335 | .word 0x06800000 | |
336 | .word 0x07000000 | |
337 | .word 0x07800000 | |
338 | .word 0x08000000 | |
339 | .word 0x08800000 | |
340 | .word 0x09000000 | |
341 | .word 0x09800000 | |
342 | .word 0x0a000000 | |
343 | .word 0x0a800000 | |
344 | .word 0x0b000000 | |
345 | .word 0x0b800000 | |
346 | .word 0x0c000000 | |
347 | .word 0x0c800000 | |
348 | .word 0x0d000000 | |
349 | .word 0x0d800000 | |
350 | .word 0x0e000000 | |
351 | .word 0x0e800000 | |
352 | .word 0x0f000000 | |
353 | .word 0x0f800000 | |
354 | .word 0x01800000 | |
355 | .word 0x02800000 | |
356 | .word 0x03800000 | |
357 | .word 0x04800000 | |
358 | ||
359 | ||
360 | newdata: | |
361 | .xword 0x3fffffffffffffff ! f0 | |
362 | ||
363 | .xword 0x7ff0000000000001 ! f2 | |
364 | .xword 0x0000000000000000 ! f4 | |
365 | ||
366 | .xword 0x7fe0000000000000 ! f6 | |
367 | .xword 0x7fe0000000000000 ! f8 | |
368 | ||
369 | .xword 0x0000000000000001 ! f10 | |
370 | .xword 0x0000000000000001 ! f12 | |
371 | ||
372 | .xword 0x0000000000000000 ! f14 | |
373 | .xword 0x380fffffffffffff ! f16 | |
374 | ||
375 | .xword 0x3ff0000000000001 ! f18 | |
376 | .xword 0x0000000000000000 ! f20 | |
377 | ||
378 | ||
379 | ||
380 | fsr_tem_dis: | |
381 | .word 0x00000000 ! TEM - all disabled | |
382 | .word 0x40000000 ! TEM - all disabled | |
383 | .word 0x80000000 ! TEM - all disabled | |
384 | .word 0xc0000000 ! TEM - all disabled | |
385 | ||
386 | /******************************************************* | |
387 | * My own trap handlers | |
388 | *******************************************************/ | |
389 | ||
390 | SECTION .TRAPS | |
391 | .text | |
392 | ||
393 | ||
394 | .global T0_Fp_exception_ieee_754 | |
395 | .global T0_Fp_exception_other | |
396 | ||
397 | T0_Fp_exception_ieee_754: | |
398 | rdpr %tpc, %i0 | |
399 | rdpr %tnpc, %i1 | |
400 | rdpr %tstate, %i1 | |
401 | rdpr %tt, %i1 | |
402 | setx scratch, %l0, %l5 ! scratch | |
403 | stx %fsr, [%l5+0x0] | |
404 | ldx [%l5+0x0], %fsr ! Need to test the sync operation | |
405 | done | |
406 | nop | |
407 | ||
408 | T0_Fp_exception_other: | |
409 | rdpr %tpc, %i0 | |
410 | rdpr %tnpc, %i1 | |
411 | rdpr %tstate, %i1 | |
412 | rdpr %tt, %i1 | |
413 | setx scratch, %l0, %l5 ! scratch | |
414 | stx %fsr, [%l5+0x0] | |
415 | ldx [%l5+0x0], %fsr ! Need to test the sync operation | |
416 | done | |
417 | nop | |
418 | ||
419 | .data | |
420 | .align 128 | |
421 | ||
422 | scratch: | |
423 | .word 0x00000000 | |
424 | .word 0x00000000 | |
425 | .word 0x00000000 | |
426 | .word 0x00000000 | |
427 | .word 0x00000000 | |
428 | .word 0x00000000 | |
429 | .word 0x00000000 | |
430 | .word 0x00000000 |