1 |
116 |
jeremybenn |
/* is-mac-test.S. l.mac, l.maci, l.macrc and l.msb instruction test of Or1ksim
|
2 |
|
|
*
|
3 |
|
|
* Copyright (C) 1999-2006 OpenCores
|
4 |
|
|
* Copyright (C) 2010 Embecosm Limited
|
5 |
|
|
*
|
6 |
|
|
* Contributors various OpenCores participants
|
7 |
|
|
* Contributor Jeremy Bennett
|
8 |
|
|
*
|
9 |
|
|
* This file is part of OpenRISC 1000 Architectural Simulator.
|
10 |
|
|
*
|
11 |
|
|
* This program is free software; you can redistribute it and/or modify it
|
12 |
|
|
* under the terms of the GNU General Public License as published by the Free
|
13 |
|
|
* Software Foundation; either version 3 of the License, or (at your option)
|
14 |
|
|
* any later version.
|
15 |
|
|
*
|
16 |
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
17 |
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
18 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
19 |
|
|
* more details.
|
20 |
|
|
*
|
21 |
|
|
* You should have received a copy of the GNU General Public License along
|
22 |
|
|
* with this program. If not, see .
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
/* ----------------------------------------------------------------------------
|
26 |
|
|
* Coding conventions are described in inst-set-test.S
|
27 |
|
|
* ------------------------------------------------------------------------- */
|
28 |
|
|
|
29 |
|
|
/* ----------------------------------------------------------------------------
|
30 |
|
|
* Test coverage
|
31 |
|
|
*
|
32 |
|
|
* The l.add, l.addc, l.addi and l.addic instructions should set the carry and
|
33 |
|
|
* overflow flags.
|
34 |
|
|
*
|
35 |
|
|
* In addition the l.addc and l.addic instructions should add in the carry
|
36 |
|
|
* bit.
|
37 |
|
|
*
|
38 |
|
|
* Problems in this area were reported in Bugs 1771 and 1776. Having fixed the
|
39 |
|
|
* problem, this is (in good software engineering style), a regression test
|
40 |
|
|
* to go with the fix.
|
41 |
|
|
*
|
42 |
|
|
* This is not a comprehensive test of any instruction (yet).
|
43 |
|
|
*
|
44 |
|
|
* Of course what is really needed is a comprehensive instruction test...
|
45 |
|
|
* ------------------------------------------------------------------------- */
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
#include "inst-set-test.h"
|
49 |
|
|
|
50 |
|
|
/* ----------------------------------------------------------------------------
|
51 |
|
|
* A macro to carry out a test of multiply accumulate read and clear
|
52 |
|
|
*
|
53 |
|
|
* Arguments
|
54 |
|
|
* machi: Inital value of MACHI
|
55 |
|
|
* maclo: Inital value of MACLO
|
56 |
|
|
* op1: First operand value
|
57 |
|
|
* op2: Second operand value
|
58 |
|
|
* res: Expected result
|
59 |
|
|
* ------------------------------------------------------------------------- */
|
60 |
|
|
#define TEST_MACRC(machi, maclo, op1, op2, res) \
|
61 |
|
|
LOAD_CONST (r2,maclo) ;\
|
62 |
|
|
l.mtspr r0,r2,SPR_MACLO ;\
|
63 |
|
|
LOAD_CONST (r2,machi) ;\
|
64 |
|
|
l.mtspr r0,r2,SPR_MACHI ;\
|
65 |
|
|
;\
|
66 |
|
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
67 |
|
|
LOAD_CONST (r6,op2) ;\
|
68 |
|
|
l.mac r5,r6 ;\
|
69 |
|
|
l.macrc r4 ;\
|
70 |
|
|
PUSH (r4) /* Save for later */ ;\
|
71 |
|
|
PUTS (" 0x") ;\
|
72 |
|
|
PUTH (machi) ;\
|
73 |
|
|
PUTS (" ") ;\
|
74 |
|
|
PUTH (maclo) ;\
|
75 |
|
|
PUTS (" + 0x") ;\
|
76 |
|
|
PUTH (op1) ;\
|
77 |
|
|
PUTS (" * 0x") ;\
|
78 |
|
|
PUTH (op2) ;\
|
79 |
|
|
PUTS (" = 0x") ;\
|
80 |
|
|
PUTH (res) ;\
|
81 |
|
|
PUTS (": ") ;\
|
82 |
|
|
POP (r4) ;\
|
83 |
|
|
CHECK_RES ("", r4, res) ;\
|
84 |
|
|
;\
|
85 |
|
|
l.mfspr r5,r0,SPR_MACHI ;\
|
86 |
|
|
l.sfne r5,r0 ;\
|
87 |
|
|
l.bf 50f ;\
|
88 |
|
|
;\
|
89 |
|
|
PUTS (" - MACHI cleared\n") ;\
|
90 |
|
|
;\
|
91 |
|
|
50: l.mfspr r6,r0,SPR_MACLO ;\
|
92 |
|
|
l.sfne r6,r0 ;\
|
93 |
|
|
l.bf 51f ;\
|
94 |
|
|
;\
|
95 |
|
|
PUTS (" - MACLO cleared\n") ;\
|
96 |
|
|
51:
|
97 |
|
|
|
98 |
|
|
/* ----------------------------------------------------------------------------
|
99 |
|
|
* A macro to carry out a test of multiply accumulate in registers
|
100 |
|
|
*
|
101 |
|
|
* Arguments
|
102 |
|
|
* machi: Inital value of MACHI
|
103 |
|
|
* maclo: Inital value of MACLO
|
104 |
|
|
* op1: First operand value
|
105 |
|
|
* op2: Second operand value
|
106 |
|
|
* reshi: Expected result
|
107 |
|
|
* reslo: Expected result
|
108 |
|
|
* ------------------------------------------------------------------------- */
|
109 |
|
|
#define TEST_MAC(machi, maclo, op1, op2, reshi, reslo) \
|
110 |
|
|
LOAD_CONST (r2,maclo) ;\
|
111 |
|
|
l.mtspr r0,r2,SPR_MACLO ;\
|
112 |
|
|
LOAD_CONST (r2,machi) ;\
|
113 |
|
|
l.mtspr r0,r2,SPR_MACHI ;\
|
114 |
|
|
;\
|
115 |
|
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
116 |
|
|
LOAD_CONST (r6,op2) ;\
|
117 |
|
|
l.mac r5,r6 ;\
|
118 |
|
|
l.mfspr r5,r0,SPR_MACHI ;\
|
119 |
|
|
l.mfspr r6,r0,SPR_MACLO ;\
|
120 |
|
|
PUSH (r5) /* Save for later */ ;\
|
121 |
|
|
PUSH (r6) ;\
|
122 |
|
|
PUTS (" 0x") ;\
|
123 |
|
|
PUTH (machi) ;\
|
124 |
|
|
PUTS (" ") ;\
|
125 |
|
|
PUTH (maclo) ;\
|
126 |
|
|
PUTS (" + 0x") ;\
|
127 |
|
|
PUTH (op1) ;\
|
128 |
|
|
PUTS (" * 0x") ;\
|
129 |
|
|
PUTH (op2) ;\
|
130 |
|
|
PUTS (" = 0x") ;\
|
131 |
|
|
PUTH (reshi) ;\
|
132 |
|
|
PUTS (" ") ;\
|
133 |
|
|
PUTH (reslo) ;\
|
134 |
|
|
PUTS (": ") ;\
|
135 |
|
|
POP (r6) ;\
|
136 |
|
|
POP (r5) ;\
|
137 |
|
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
138 |
|
|
|
139 |
|
|
|
140 |
|
|
/* ----------------------------------------------------------------------------
|
141 |
|
|
* A macro to carry out a test of multiply accumulate with immediate arg
|
142 |
|
|
*
|
143 |
|
|
* There is currently a bug in the assembler, so we must hand construct
|
144 |
|
|
* l.maci r5,op1.
|
145 |
|
|
*
|
146 |
|
|
* Arguments
|
147 |
|
|
* machi: Inital value of MACHI
|
148 |
|
|
* maclo: Inital value of MACLO
|
149 |
|
|
* op1: First operand value
|
150 |
|
|
* op2: Second operand value
|
151 |
|
|
* reshi: Expected result
|
152 |
|
|
* reslo: Expected result
|
153 |
|
|
* ------------------------------------------------------------------------- */
|
154 |
|
|
#define TEST_MACI(machi, maclo, op1, op2, reshi, reslo) \
|
155 |
|
|
LOAD_CONST (r2,maclo) ;\
|
156 |
|
|
l.mtspr r0,r2,SPR_MACLO ;\
|
157 |
|
|
LOAD_CONST (r2,machi) ;\
|
158 |
|
|
l.mtspr r0,r2,SPR_MACHI ;\
|
159 |
|
|
;\
|
160 |
|
|
LOAD_CONST (r5,op1) /* Load number to add */ ;\
|
161 |
|
|
.word (0x4c050000|op2) /* l.maci r5,op2 */ ;\
|
162 |
|
|
/* l.maci r5,op2 */ ;\
|
163 |
|
|
l.mfspr r5,r0,SPR_MACHI ;\
|
164 |
|
|
l.mfspr r6,r0,SPR_MACLO ;\
|
165 |
|
|
PUSH (r5) /* Save for later */ ;\
|
166 |
|
|
PUSH (r6) ;\
|
167 |
|
|
PUTS (" 0x") ;\
|
168 |
|
|
PUTH (machi) ;\
|
169 |
|
|
PUTS (" ") ;\
|
170 |
|
|
PUTH (maclo) ;\
|
171 |
|
|
PUTS (" + 0x") ;\
|
172 |
|
|
PUTH (op1) ;\
|
173 |
|
|
PUTS (" * 0x") ;\
|
174 |
|
|
PUTH (op2) ;\
|
175 |
|
|
PUTS (" = 0x") ;\
|
176 |
|
|
PUTH (reshi) ;\
|
177 |
|
|
PUTS (" ") ;\
|
178 |
|
|
PUTH (reslo) ;\
|
179 |
|
|
PUTS (": ") ;\
|
180 |
|
|
POP (r6) ;\
|
181 |
|
|
POP (r5) ;\
|
182 |
|
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
/* ----------------------------------------------------------------------------
|
186 |
|
|
* A macro to carry out a test of multiply and subract
|
187 |
|
|
*
|
188 |
|
|
* Arguments
|
189 |
|
|
* machi: Inital value of MACHI
|
190 |
|
|
* maclo: Inital value of MACLO
|
191 |
|
|
* op1: First operand value
|
192 |
|
|
* op2: Second operand value
|
193 |
|
|
* reshi: Expected result
|
194 |
|
|
* reslo: Expected result
|
195 |
|
|
* ------------------------------------------------------------------------- */
|
196 |
|
|
#define TEST_MSB(machi, maclo, op1, op2, reshi, reslo) \
|
197 |
|
|
LOAD_CONST (r2,maclo) ;\
|
198 |
|
|
l.mtspr r0,r2,SPR_MACLO ;\
|
199 |
|
|
LOAD_CONST (r2,machi) ;\
|
200 |
|
|
l.mtspr r0,r2,SPR_MACHI ;\
|
201 |
|
|
;\
|
202 |
|
|
LOAD_CONST (r5,op1) /* Load numbers to add */ ;\
|
203 |
|
|
LOAD_CONST (r6,op2) ;\
|
204 |
|
|
l.msb r5,r6 ;\
|
205 |
|
|
l.mfspr r5,r0,SPR_MACHI ;\
|
206 |
|
|
l.mfspr r6,r0,SPR_MACLO ;\
|
207 |
|
|
PUSH (r5) /* Save for later */ ;\
|
208 |
|
|
PUSH (r6) ;\
|
209 |
|
|
PUTS (" 0x") ;\
|
210 |
|
|
PUTH (machi) ;\
|
211 |
|
|
PUTS (" ") ;\
|
212 |
|
|
PUTH (maclo) ;\
|
213 |
|
|
PUTS (" - 0x") ;\
|
214 |
|
|
PUTH (op1) ;\
|
215 |
|
|
PUTS (" * 0x") ;\
|
216 |
|
|
PUTH (op2) ;\
|
217 |
|
|
PUTS (" = 0x") ;\
|
218 |
|
|
PUTH (reshi) ;\
|
219 |
|
|
PUTS (" ") ;\
|
220 |
|
|
PUTH (reslo) ;\
|
221 |
|
|
PUTS (": ") ;\
|
222 |
|
|
POP (r6) ;\
|
223 |
|
|
POP (r5) ;\
|
224 |
|
|
CHECK_RES2 (r5, r6, reshi, reslo)
|
225 |
|
|
|
226 |
|
|
|
227 |
|
|
.section .text
|
228 |
|
|
.global _start
|
229 |
|
|
_start:
|
230 |
|
|
|
231 |
|
|
/* ----------------------------------------------------------------------------
|
232 |
|
|
* Test of multiply signed and accumulate, l.mac
|
233 |
|
|
* ------------------------------------------------------------------------- */
|
234 |
|
|
_mac:
|
235 |
|
|
LOAD_STR (r3, "l.mac\n")
|
236 |
|
|
l.jal _puts
|
237 |
|
|
l.nop
|
238 |
|
|
|
239 |
|
|
/* MAC two small positive numbers on a zero total */
|
240 |
|
|
TEST_MAC (0x00000000, 0x00000000,
|
241 |
|
|
0x00000002, 0x00000003,
|
242 |
|
|
0x00000000, 0x00000006)
|
243 |
|
|
|
244 |
|
|
/* MAC two small positive numbers on a small positive total */
|
245 |
|
|
TEST_MAC (0x00000000, 0x00000006,
|
246 |
|
|
0x00000002, 0x00000003,
|
247 |
|
|
0x00000000, 0x0000000c)
|
248 |
|
|
|
249 |
|
|
/* MAC two small positive numbers on a moderate positive total */
|
250 |
|
|
TEST_MAC (0x00000000, 0xfffffffa,
|
251 |
|
|
0x00000002, 0x00000003,
|
252 |
|
|
0x00000001, 0x00000000)
|
253 |
|
|
|
254 |
|
|
/* MAC two small positive numbers on a large positive total */
|
255 |
|
|
TEST_MAC (0x3fffffff, 0xfffffffa,
|
256 |
|
|
0x00000002, 0x00000003,
|
257 |
|
|
0x40000000, 0x00000000)
|
258 |
|
|
|
259 |
|
|
/* MAC two small positive numbers on a small negative total */
|
260 |
|
|
TEST_MAC (0xffffffff, 0xfffffffa,
|
261 |
|
|
0x00000002, 0x00000003,
|
262 |
|
|
0x00000000, 0x00000000)
|
263 |
|
|
|
264 |
|
|
/* MAC two small positive numbers on a moderate negative total */
|
265 |
|
|
TEST_MAC (0xffffffff, 0x00000000,
|
266 |
|
|
0x00000002, 0x00000003,
|
267 |
|
|
0xffffffff, 0x00000006)
|
268 |
|
|
|
269 |
|
|
/* MAC two small positive numbers on a large negative total */
|
270 |
|
|
TEST_MAC (0x80000000, 0x00000000,
|
271 |
|
|
0x00000002, 0x00000003,
|
272 |
|
|
0x80000000, 0x00000006)
|
273 |
|
|
|
274 |
|
|
PUTC ('\n')
|
275 |
|
|
|
276 |
|
|
/* MAC two moderate positive numbers on a zero total */
|
277 |
|
|
TEST_MAC (0x00000000, 0x00000000,
|
278 |
|
|
0x00008001, 0x0000fffe,
|
279 |
|
|
0x00000000, 0x7ffffffe)
|
280 |
|
|
|
281 |
|
|
/* MAC two moderate positive numbers on a small positive total */
|
282 |
|
|
TEST_MAC (0x00000000, 0x00000002,
|
283 |
|
|
0x00008001, 0x0000fffe,
|
284 |
|
|
0x00000000, 0x80000000)
|
285 |
|
|
|
286 |
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
287 |
|
|
TEST_MAC (0x00000000, 0x80000002,
|
288 |
|
|
0x00008001, 0x0000fffe,
|
289 |
|
|
0x00000001, 0x00000000)
|
290 |
|
|
|
291 |
|
|
/* MAC two moderate positive numbers on a large positive total */
|
292 |
|
|
TEST_MAC (0x7fffffff, 0x80000001,
|
293 |
|
|
0x00008001, 0x0000fffe,
|
294 |
|
|
0x7fffffff, 0xffffffff)
|
295 |
|
|
|
296 |
|
|
/* MAC two moderate positive numbers on a small negative total */
|
297 |
|
|
TEST_MAC (0xffffffff, 0xffffffff,
|
298 |
|
|
0x00008001, 0x0000fffe,
|
299 |
|
|
0x00000000, 0x7ffffffd)
|
300 |
|
|
|
301 |
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
302 |
|
|
TEST_MAC (0xffffffff, 0x80000002,
|
303 |
|
|
0x00008001, 0x0000fffe,
|
304 |
|
|
0x00000000, 0x00000000)
|
305 |
|
|
|
306 |
|
|
/* MAC two moderate positive numbers on a large negative total */
|
307 |
|
|
TEST_MAC (0xfffffffe, 0x80000002,
|
308 |
|
|
0x00008001, 0x0000fffe,
|
309 |
|
|
0xffffffff, 0x00000000)
|
310 |
|
|
|
311 |
|
|
PUTC ('\n')
|
312 |
|
|
|
313 |
|
|
/* MAC two small negative numbers on a zero total */
|
314 |
|
|
TEST_MAC (0x00000000, 0x00000000,
|
315 |
|
|
0xfffffffe, 0xfffffffd,
|
316 |
|
|
0x00000000, 0x00000006)
|
317 |
|
|
|
318 |
|
|
/* MAC two small negative numbers on a small positive total */
|
319 |
|
|
TEST_MAC (0x00000000, 0x00000006,
|
320 |
|
|
0xfffffffe, 0xfffffffd,
|
321 |
|
|
0x00000000, 0x0000000c)
|
322 |
|
|
|
323 |
|
|
/* MAC two small negative numbers on a small negative total */
|
324 |
|
|
TEST_MAC (0xffffffff, 0xffffffff,
|
325 |
|
|
0xfffffffe, 0xfffffffd,
|
326 |
|
|
0x00000000, 0x00000005)
|
327 |
|
|
|
328 |
|
|
PUTC ('\n')
|
329 |
|
|
|
330 |
|
|
/* MAC one small positive and one small negative number on a zero
|
331 |
|
|
total */
|
332 |
|
|
TEST_MAC (0x00000000, 0x00000000,
|
333 |
|
|
0x00000002, 0xfffffffd,
|
334 |
|
|
0xffffffff, 0xfffffffa)
|
335 |
|
|
|
336 |
|
|
/* MAC one small positive and one small negative number on a small
|
337 |
|
|
positive total */
|
338 |
|
|
TEST_MAC (0x00000000, 0x0000000c,
|
339 |
|
|
0x00000002, 0xfffffffd,
|
340 |
|
|
0x00000000, 0x00000006)
|
341 |
|
|
|
342 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
343 |
|
|
positive total */
|
344 |
|
|
TEST_MAC (0x00000001, 0x00000005,
|
345 |
|
|
0x00000002, 0xfffffffd,
|
346 |
|
|
0x00000000, 0xffffffff)
|
347 |
|
|
|
348 |
|
|
/* MAC one small positive and one small negative number on a large
|
349 |
|
|
positive total */
|
350 |
|
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
351 |
|
|
0x00000002, 0xfffffffd,
|
352 |
|
|
0x7fffffff, 0xfffffff9)
|
353 |
|
|
|
354 |
|
|
/* MAC one small positive and one small negative number on a small
|
355 |
|
|
negative total */
|
356 |
|
|
TEST_MAC (0xffffffff, 0xffffffff,
|
357 |
|
|
0x00000002, 0xfffffffd,
|
358 |
|
|
0xffffffff, 0xfffffff9)
|
359 |
|
|
|
360 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
361 |
|
|
negative total */
|
362 |
|
|
TEST_MAC (0xffffffff, 0x00000005,
|
363 |
|
|
0x00000002, 0xfffffffd,
|
364 |
|
|
0xfffffffe, 0xffffffff)
|
365 |
|
|
|
366 |
|
|
/* MAC one small positive and one small negative number on a large
|
367 |
|
|
negative total */
|
368 |
|
|
TEST_MAC (0x80000000, 0x00000006,
|
369 |
|
|
0x00000002, 0xfffffffd,
|
370 |
|
|
0x80000000, 0x00000000)
|
371 |
|
|
|
372 |
|
|
PUTC ('\n')
|
373 |
|
|
|
374 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
375 |
|
|
zero total */
|
376 |
|
|
TEST_MAC (0x00000000, 0x00000000,
|
377 |
|
|
0x00008000, 0xffff0000,
|
378 |
|
|
0xffffffff, 0x80000000)
|
379 |
|
|
|
380 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
381 |
|
|
small positive total */
|
382 |
|
|
TEST_MAC (0x00000000, 0x00000006,
|
383 |
|
|
0x00008000, 0xffff0000,
|
384 |
|
|
0xffffffff, 0x80000006)
|
385 |
|
|
|
386 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
387 |
|
|
moderate positive total */
|
388 |
|
|
TEST_MAC (0x00000000, 0x80000000,
|
389 |
|
|
0x00008000, 0xffff0000,
|
390 |
|
|
0x00000000, 0x00000000)
|
391 |
|
|
|
392 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
393 |
|
|
large positive total */
|
394 |
|
|
TEST_MAC (0x7fffffff, 0xffffffff,
|
395 |
|
|
0x00008000, 0xffff0000,
|
396 |
|
|
0x7fffffff, 0x7fffffff)
|
397 |
|
|
|
398 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
399 |
|
|
small negative total */
|
400 |
|
|
TEST_MAC (0xffffffff, 0xffffffff,
|
401 |
|
|
0x00008000, 0xffff0000,
|
402 |
|
|
0xffffffff, 0x7fffffff)
|
403 |
|
|
|
404 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
405 |
|
|
moderate negative total */
|
406 |
|
|
TEST_MAC (0xffffffff, 0x7fffffff,
|
407 |
|
|
0x00008000, 0xffff0000,
|
408 |
|
|
0xfffffffe, 0xffffffff)
|
409 |
|
|
|
410 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
411 |
|
|
large negative total */
|
412 |
|
|
TEST_MAC (0x80000000, 0x80000000,
|
413 |
|
|
0x00008000, 0xffff0000,
|
414 |
|
|
0x80000000, 0x00000000)
|
415 |
|
|
|
416 |
|
|
PUTC ('\n')
|
417 |
|
|
|
418 |
|
|
/* ----------------------------------------------------------------------------
|
419 |
|
|
* Test of multiply signed and accumulate, l.maci
|
420 |
|
|
* ------------------------------------------------------------------------- */
|
421 |
|
|
_maci:
|
422 |
|
|
LOAD_STR (r3, "l.maci\n")
|
423 |
|
|
l.jal _puts
|
424 |
|
|
l.nop
|
425 |
|
|
|
426 |
|
|
/* MAC two small positive numbers on a zero total */
|
427 |
|
|
TEST_MACI (0x00000000, 0x00000000,
|
428 |
|
|
0x00000002, 0x0003,
|
429 |
|
|
0x00000000, 0x00000006)
|
430 |
|
|
|
431 |
|
|
/* MAC two small positive numbers on a small positive total */
|
432 |
|
|
TEST_MACI (0x00000000, 0x00000006,
|
433 |
|
|
0x00000002, 0x0003,
|
434 |
|
|
0x00000000, 0x0000000c)
|
435 |
|
|
|
436 |
|
|
/* MAC two small positive numbers on a moderate positive total */
|
437 |
|
|
TEST_MACI (0x00000000, 0xfffffffa,
|
438 |
|
|
0x00000002, 0x0003,
|
439 |
|
|
0x00000001, 0x00000000)
|
440 |
|
|
|
441 |
|
|
/* MAC two small positive numbers on a large positive total */
|
442 |
|
|
TEST_MACI (0x3fffffff, 0xfffffffa,
|
443 |
|
|
0x00000002, 0x0003,
|
444 |
|
|
0x40000000, 0x00000000)
|
445 |
|
|
|
446 |
|
|
/* MAC two small positive numbers on a small negative total */
|
447 |
|
|
TEST_MACI (0xffffffff, 0xfffffffa,
|
448 |
|
|
0x00000002, 0x0003,
|
449 |
|
|
0x00000000, 0x00000000)
|
450 |
|
|
|
451 |
|
|
/* MAC two small positive numbers on a moderate negative total */
|
452 |
|
|
TEST_MACI (0xffffffff, 0x00000000,
|
453 |
|
|
0x00000002, 0x0003,
|
454 |
|
|
0xffffffff, 0x00000006)
|
455 |
|
|
|
456 |
|
|
/* MAC two small positive numbers on a large negative total */
|
457 |
|
|
TEST_MACI (0x80000000, 0x00000000,
|
458 |
|
|
0x00000002, 0x0003,
|
459 |
|
|
0x80000000, 0x00000006)
|
460 |
|
|
|
461 |
|
|
PUTC ('\n')
|
462 |
|
|
tmp:
|
463 |
|
|
/* MAC two moderate positive numbers on a zero total */
|
464 |
|
|
TEST_MACI (0x00000000, 0x00000000,
|
465 |
|
|
0x00010002, 0x7fff,
|
466 |
|
|
0x00000000, 0x7ffffffe)
|
467 |
|
|
|
468 |
|
|
/* MAC two moderate positive numbers on a small positive total */
|
469 |
|
|
TEST_MACI (0x00000000, 0x00000002,
|
470 |
|
|
0x00010002, 0x7fff,
|
471 |
|
|
0x00000000, 0x80000000)
|
472 |
|
|
|
473 |
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
474 |
|
|
TEST_MACI (0x00000000, 0x80000002,
|
475 |
|
|
0x00010002, 0x7fff,
|
476 |
|
|
0x00000001, 0x00000000)
|
477 |
|
|
|
478 |
|
|
/* MAC two moderate positive numbers on a large positive total */
|
479 |
|
|
TEST_MACI (0x7fffffff, 0x80000001,
|
480 |
|
|
0x00010002, 0x7fff,
|
481 |
|
|
0x7fffffff, 0xffffffff)
|
482 |
|
|
|
483 |
|
|
/* MAC two moderate positive numbers on a small negative total */
|
484 |
|
|
TEST_MACI (0xffffffff, 0xffffffff,
|
485 |
|
|
0x00010002, 0x7fff,
|
486 |
|
|
0x00000000, 0x7ffffffd)
|
487 |
|
|
|
488 |
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
489 |
|
|
TEST_MACI (0xffffffff, 0x80000002,
|
490 |
|
|
0x00010002, 0x7fff,
|
491 |
|
|
0x00000000, 0x00000000)
|
492 |
|
|
|
493 |
|
|
/* MAC two moderate positive numbers on a large negative total */
|
494 |
|
|
TEST_MACI (0xfffffffe, 0x80000002,
|
495 |
|
|
0x00010002, 0x7fff,
|
496 |
|
|
0xffffffff, 0x00000000)
|
497 |
|
|
|
498 |
|
|
PUTC ('\n')
|
499 |
|
|
|
500 |
|
|
/* MAC two small negative numbers on a zero total */
|
501 |
|
|
TEST_MACI (0x00000000, 0x00000000,
|
502 |
|
|
0xfffffffe, 0xfffd,
|
503 |
|
|
0x00000000, 0x00000006)
|
504 |
|
|
|
505 |
|
|
/* MAC two small negative numbers on a small positive total */
|
506 |
|
|
TEST_MACI (0x00000000, 0x00000006,
|
507 |
|
|
0xfffffffe, 0xfffd,
|
508 |
|
|
0x00000000, 0x0000000c)
|
509 |
|
|
|
510 |
|
|
/* MAC two small negative numbers on a small negative total */
|
511 |
|
|
TEST_MACI (0xffffffff, 0xffffffff,
|
512 |
|
|
0xfffffffe, 0xfffd,
|
513 |
|
|
0x00000000, 0x00000005)
|
514 |
|
|
|
515 |
|
|
PUTC ('\n')
|
516 |
|
|
|
517 |
|
|
/* MAC one small positive and one small negative number on a zero
|
518 |
|
|
total */
|
519 |
|
|
TEST_MACI (0x00000000, 0x00000000,
|
520 |
|
|
0x00000002, 0xfffd,
|
521 |
|
|
0xffffffff, 0xfffffffa)
|
522 |
|
|
|
523 |
|
|
/* MAC one small positive and one small negative number on a small
|
524 |
|
|
positive total */
|
525 |
|
|
TEST_MACI (0x00000000, 0x0000000c,
|
526 |
|
|
0x00000002, 0xfffd,
|
527 |
|
|
0x00000000, 0x00000006)
|
528 |
|
|
|
529 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
530 |
|
|
positive total */
|
531 |
|
|
TEST_MACI (0x00000001, 0x00000005,
|
532 |
|
|
0x00000002, 0xfffd,
|
533 |
|
|
0x00000000, 0xffffffff)
|
534 |
|
|
|
535 |
|
|
/* MAC one small positive and one small negative number on a large
|
536 |
|
|
positive total */
|
537 |
|
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
538 |
|
|
0x00000002, 0xfffd,
|
539 |
|
|
0x7fffffff, 0xfffffff9)
|
540 |
|
|
|
541 |
|
|
/* MAC one small positive and one small negative number on a small
|
542 |
|
|
negative total */
|
543 |
|
|
TEST_MACI (0xffffffff, 0xffffffff,
|
544 |
|
|
0x00000002, 0xfffd,
|
545 |
|
|
0xffffffff, 0xfffffff9)
|
546 |
|
|
|
547 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
548 |
|
|
negative total */
|
549 |
|
|
TEST_MACI (0xffffffff, 0x00000005,
|
550 |
|
|
0x00000002, 0xfffd,
|
551 |
|
|
0xfffffffe, 0xffffffff)
|
552 |
|
|
|
553 |
|
|
/* MAC one small positive and one small negative number on a large
|
554 |
|
|
negative total */
|
555 |
|
|
TEST_MACI (0x80000000, 0x00000006,
|
556 |
|
|
0x00000002, 0xfffd,
|
557 |
|
|
0x80000000, 0x00000000)
|
558 |
|
|
|
559 |
|
|
PUTC ('\n')
|
560 |
|
|
|
561 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
562 |
|
|
zero total */
|
563 |
|
|
TEST_MACI (0x00000000, 0x00000000,
|
564 |
|
|
0x00010000, 0x8000,
|
565 |
|
|
0xffffffff, 0x80000000)
|
566 |
|
|
|
567 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
568 |
|
|
small positive total */
|
569 |
|
|
TEST_MACI (0x00000000, 0x00000006,
|
570 |
|
|
0x00010000, 0x8000,
|
571 |
|
|
0xffffffff, 0x80000006)
|
572 |
|
|
|
573 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
574 |
|
|
moderate positive total */
|
575 |
|
|
TEST_MACI (0x00000000, 0x80000000,
|
576 |
|
|
0x00010000, 0x8000,
|
577 |
|
|
0x00000000, 0x00000000)
|
578 |
|
|
|
579 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
580 |
|
|
large positive total */
|
581 |
|
|
TEST_MACI (0x7fffffff, 0xffffffff,
|
582 |
|
|
0x00010000, 0x8000,
|
583 |
|
|
0x7fffffff, 0x7fffffff)
|
584 |
|
|
|
585 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
586 |
|
|
small negative total */
|
587 |
|
|
TEST_MACI (0xffffffff, 0xffffffff,
|
588 |
|
|
0x00010000, 0x8000,
|
589 |
|
|
0xffffffff, 0x7fffffff)
|
590 |
|
|
|
591 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
592 |
|
|
moderate negative total */
|
593 |
|
|
TEST_MACI (0xffffffff, 0x7fffffff,
|
594 |
|
|
0x00010000, 0x8000,
|
595 |
|
|
0xfffffffe, 0xffffffff)
|
596 |
|
|
|
597 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
598 |
|
|
large negative total */
|
599 |
|
|
TEST_MACI (0x80000000, 0x80000000,
|
600 |
|
|
0x00010000, 0x8000,
|
601 |
|
|
0x80000000, 0x00000000)
|
602 |
|
|
|
603 |
|
|
PUTC ('\n')
|
604 |
|
|
|
605 |
|
|
/* ----------------------------------------------------------------------------
|
606 |
|
|
* Test of multiply signed and accumulate, read and clear l.macrc
|
607 |
|
|
* ------------------------------------------------------------------------- */
|
608 |
|
|
_macrc:
|
609 |
|
|
LOAD_STR (r3, "l.macrc\n")
|
610 |
|
|
l.jal _puts
|
611 |
|
|
l.nop
|
612 |
|
|
|
613 |
|
|
/* MAC two small positive numbers on a zero total */
|
614 |
|
|
TEST_MACRC (0x00000000, 0x00000000,
|
615 |
|
|
0x00000002, 0x00000003,
|
616 |
|
|
0x00000006)
|
617 |
|
|
|
618 |
|
|
/* MAC two small positive numbers on a small positive total */
|
619 |
|
|
TEST_MACRC (0x00000000, 0x00000006,
|
620 |
|
|
0x00000002, 0x00000003,
|
621 |
|
|
0x0000000c)
|
622 |
|
|
|
623 |
|
|
/* MAC two small positive numbers on a moderate positive total */
|
624 |
|
|
TEST_MACRC (0x00000000, 0xfffffffa,
|
625 |
|
|
0x00000002, 0x00000003,
|
626 |
|
|
0x00000000)
|
627 |
|
|
|
628 |
|
|
/* MAC two small positive numbers on a large positive total */
|
629 |
|
|
TEST_MACRC (0x3fffffff, 0xfffffffa,
|
630 |
|
|
0x00000002, 0x00000003,
|
631 |
|
|
0x00000000)
|
632 |
|
|
|
633 |
|
|
/* MAC two small positive numbers on a small negative total */
|
634 |
|
|
TEST_MACRC (0xffffffff, 0xfffffffa,
|
635 |
|
|
0x00000002, 0x00000003,
|
636 |
|
|
0x00000000)
|
637 |
|
|
|
638 |
|
|
/* MAC two small positive numbers on a moderate negative total */
|
639 |
|
|
TEST_MACRC (0xffffffff, 0x00000000,
|
640 |
|
|
0x00000002, 0x00000003,
|
641 |
|
|
0x00000006)
|
642 |
|
|
|
643 |
|
|
/* MAC two small positive numbers on a large negative total */
|
644 |
|
|
TEST_MACRC (0x80000000, 0x00000000,
|
645 |
|
|
0x00000002, 0x00000003,
|
646 |
|
|
0x00000006)
|
647 |
|
|
|
648 |
|
|
PUTC ('\n')
|
649 |
|
|
|
650 |
|
|
/* MAC two moderate positive numbers on a zero total */
|
651 |
|
|
TEST_MACRC (0x00000000, 0x00000000,
|
652 |
|
|
0x00008001, 0x0000fffe,
|
653 |
|
|
0x7ffffffe)
|
654 |
|
|
|
655 |
|
|
/* MAC two moderate positive numbers on a small positive total */
|
656 |
|
|
TEST_MACRC (0x00000000, 0x00000002,
|
657 |
|
|
0x00008001, 0x0000fffe,
|
658 |
|
|
0x80000000)
|
659 |
|
|
|
660 |
|
|
/* MAC two moderate positive numbers on a moderate positive total */
|
661 |
|
|
TEST_MACRC (0x00000000, 0x80000002,
|
662 |
|
|
0x00008001, 0x0000fffe,
|
663 |
|
|
0x00000000)
|
664 |
|
|
|
665 |
|
|
/* MAC two moderate positive numbers on a large positive total */
|
666 |
|
|
TEST_MACRC (0x7fffffff, 0x80000001,
|
667 |
|
|
0x00008001, 0x0000fffe,
|
668 |
|
|
0xffffffff)
|
669 |
|
|
|
670 |
|
|
/* MAC two moderate positive numbers on a small negative total */
|
671 |
|
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
672 |
|
|
0x00008001, 0x0000fffe,
|
673 |
|
|
0x7ffffffd)
|
674 |
|
|
|
675 |
|
|
/* MAC two moderate positive numbers on a moderate negative total */
|
676 |
|
|
TEST_MACRC (0xffffffff, 0x80000002,
|
677 |
|
|
0x00008001, 0x0000fffe,
|
678 |
|
|
0x00000000)
|
679 |
|
|
|
680 |
|
|
/* MAC two moderate positive numbers on a large negative total */
|
681 |
|
|
TEST_MACRC (0xfffffffe, 0x80000002,
|
682 |
|
|
0x00008001, 0x0000fffe,
|
683 |
|
|
0x00000000)
|
684 |
|
|
|
685 |
|
|
PUTC ('\n')
|
686 |
|
|
|
687 |
|
|
/* MAC two small negative numbers on a zero total */
|
688 |
|
|
TEST_MACRC (0x00000000, 0x00000000,
|
689 |
|
|
0xfffffffe, 0xfffffffd,
|
690 |
|
|
0x00000006)
|
691 |
|
|
|
692 |
|
|
/* MAC two small negative numbers on a small positive total */
|
693 |
|
|
TEST_MACRC (0x00000000, 0x00000006,
|
694 |
|
|
0xfffffffe, 0xfffffffd,
|
695 |
|
|
0x0000000c)
|
696 |
|
|
|
697 |
|
|
/* MAC two small negative numbers on a small negative total */
|
698 |
|
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
699 |
|
|
0xfffffffe, 0xfffffffd,
|
700 |
|
|
0x00000005)
|
701 |
|
|
|
702 |
|
|
PUTC ('\n')
|
703 |
|
|
|
704 |
|
|
/* MAC one small positive and one small negative number on a zero
|
705 |
|
|
total */
|
706 |
|
|
TEST_MACRC (0x00000000, 0x00000000,
|
707 |
|
|
0x00000002, 0xfffffffd,
|
708 |
|
|
0xfffffffa)
|
709 |
|
|
|
710 |
|
|
/* MAC one small positive and one small negative number on a small
|
711 |
|
|
positive total */
|
712 |
|
|
TEST_MACRC (0x00000000, 0x0000000c,
|
713 |
|
|
0x00000002, 0xfffffffd,
|
714 |
|
|
0x00000006)
|
715 |
|
|
|
716 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
717 |
|
|
positive total */
|
718 |
|
|
TEST_MACRC (0x00000001, 0x00000005,
|
719 |
|
|
0x00000002, 0xfffffffd,
|
720 |
|
|
0xffffffff)
|
721 |
|
|
|
722 |
|
|
/* MAC one small positive and one small negative number on a large
|
723 |
|
|
positive total */
|
724 |
|
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
725 |
|
|
0x00000002, 0xfffffffd,
|
726 |
|
|
0xfffffff9)
|
727 |
|
|
|
728 |
|
|
/* MAC one small positive and one small negative number on a small
|
729 |
|
|
negative total */
|
730 |
|
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
731 |
|
|
0x00000002, 0xfffffffd,
|
732 |
|
|
0xfffffff9)
|
733 |
|
|
|
734 |
|
|
/* MAC one small positive and one small negative number on a moderate
|
735 |
|
|
negative total */
|
736 |
|
|
TEST_MACRC (0xffffffff, 0x00000005,
|
737 |
|
|
0x00000002, 0xfffffffd,
|
738 |
|
|
0xffffffff)
|
739 |
|
|
|
740 |
|
|
/* MAC one small positive and one small negative number on a large
|
741 |
|
|
negative total */
|
742 |
|
|
TEST_MACRC (0x80000000, 0x00000006,
|
743 |
|
|
0x00000002, 0xfffffffd,
|
744 |
|
|
0x00000000)
|
745 |
|
|
|
746 |
|
|
PUTC ('\n')
|
747 |
|
|
|
748 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
749 |
|
|
zero total */
|
750 |
|
|
TEST_MACRC (0x00000000, 0x00000000,
|
751 |
|
|
0x00008000, 0xffff0000,
|
752 |
|
|
0x80000000)
|
753 |
|
|
|
754 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
755 |
|
|
small positive total */
|
756 |
|
|
TEST_MACRC (0x00000000, 0x00000006,
|
757 |
|
|
0x00008000, 0xffff0000,
|
758 |
|
|
0x80000006)
|
759 |
|
|
|
760 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
761 |
|
|
moderate positive total */
|
762 |
|
|
TEST_MACRC (0x00000000, 0x80000000,
|
763 |
|
|
0x00008000, 0xffff0000,
|
764 |
|
|
0x00000000)
|
765 |
|
|
|
766 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
767 |
|
|
large positive total */
|
768 |
|
|
TEST_MACRC (0x7fffffff, 0xffffffff,
|
769 |
|
|
0x00008000, 0xffff0000,
|
770 |
|
|
0x7fffffff)
|
771 |
|
|
|
772 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
773 |
|
|
small negative total */
|
774 |
|
|
TEST_MACRC (0xffffffff, 0xffffffff,
|
775 |
|
|
0x00008000, 0xffff0000,
|
776 |
|
|
0x7fffffff)
|
777 |
|
|
|
778 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
779 |
|
|
moderate negative total */
|
780 |
|
|
TEST_MACRC (0xffffffff, 0x7fffffff,
|
781 |
|
|
0x00008000, 0xffff0000,
|
782 |
|
|
0xffffffff)
|
783 |
|
|
|
784 |
|
|
/* MAC one moderate positive and one moderate negative number on a
|
785 |
|
|
large negative total */
|
786 |
|
|
TEST_MACRC (0x80000000, 0x80000000,
|
787 |
|
|
0x00008000, 0xffff0000,
|
788 |
|
|
0x00000000)
|
789 |
|
|
|
790 |
|
|
PUTC ('\n')
|
791 |
|
|
|
792 |
|
|
/* ----------------------------------------------------------------------------
|
793 |
|
|
* Test of multiply signed and accumulate, l.msb
|
794 |
|
|
* ------------------------------------------------------------------------- */
|
795 |
|
|
_msb:
|
796 |
|
|
LOAD_STR (r3, "l.msb\n")
|
797 |
|
|
l.jal _puts
|
798 |
|
|
l.nop
|
799 |
|
|
|
800 |
|
|
/* MSB two small positive numbers on a zero total */
|
801 |
|
|
TEST_MSB (0x00000000, 0x00000000,
|
802 |
|
|
0x00000002, 0x00000003,
|
803 |
|
|
0xffffffff, 0xfffffffa)
|
804 |
|
|
|
805 |
|
|
/* MSB two small positive numbers on a small positive total */
|
806 |
|
|
TEST_MSB (0x00000000, 0x0000000c,
|
807 |
|
|
0x00000002, 0x00000003,
|
808 |
|
|
0x00000000, 0x00000006)
|
809 |
|
|
|
810 |
|
|
/* MSB two small positive numbers on a moderate positive total */
|
811 |
|
|
TEST_MSB (0x00000001, 0x00000000,
|
812 |
|
|
0x00000002, 0x00000003,
|
813 |
|
|
0x00000000, 0xfffffffa)
|
814 |
|
|
|
815 |
|
|
/* MSB two small positive numbers on a large positive total */
|
816 |
|
|
TEST_MSB (0x40000000, 0x00000000,
|
817 |
|
|
0x00000002, 0x00000003,
|
818 |
|
|
0x3fffffff, 0xfffffffa)
|
819 |
|
|
|
820 |
|
|
/* MSB two small positive numbers on a small negative total */
|
821 |
|
|
TEST_MSB (0xffffffff, 0xfffffffa,
|
822 |
|
|
0x00000002, 0x00000003,
|
823 |
|
|
0xffffffff, 0xfffffff4)
|
824 |
|
|
|
825 |
|
|
/* MSB two small positive numbers on a moderate negative total */
|
826 |
|
|
TEST_MSB (0xffffffff, 0x00000005,
|
827 |
|
|
0x00000002, 0x00000003,
|
828 |
|
|
0xfffffffe, 0xffffffff)
|
829 |
|
|
|
830 |
|
|
/* MSB two small positive numbers on a large negative total */
|
831 |
|
|
TEST_MSB (0x80000000, 0x00000006,
|
832 |
|
|
0x00000002, 0x00000003,
|
833 |
|
|
0x80000000, 0x00000000)
|
834 |
|
|
|
835 |
|
|
PUTC ('\n')
|
836 |
|
|
|
837 |
|
|
/* MSB two moderate positive numbers on a zero total */
|
838 |
|
|
TEST_MSB (0x00000000, 0x00000000,
|
839 |
|
|
0x00008001, 0x0000fffe,
|
840 |
|
|
0xffffffff, 0x80000002)
|
841 |
|
|
|
842 |
|
|
/* MSB two moderate positive numbers on a small positive total */
|
843 |
|
|
TEST_MSB (0x00000000, 0x00000002,
|
844 |
|
|
0x00008001, 0x0000fffe,
|
845 |
|
|
0xffffffff, 0x80000004)
|
846 |
|
|
|
847 |
|
|
/* MSB two moderate positive numbers on a moderate positive total */
|
848 |
|
|
TEST_MSB (0x00000000, 0x80000002,
|
849 |
|
|
0x00008001, 0x0000fffe,
|
850 |
|
|
0x00000000, 0x00000004)
|
851 |
|
|
|
852 |
|
|
/* MSB two moderate positive numbers on a large positive total */
|
853 |
|
|
TEST_MSB (0x7fffffff, 0x7ffffffd,
|
854 |
|
|
0x00008001, 0x0000fffe,
|
855 |
|
|
0x7ffffffe, 0xffffffff)
|
856 |
|
|
|
857 |
|
|
/* MSB two moderate positive numbers on a small negative total */
|
858 |
|
|
TEST_MSB (0xffffffff, 0xffffffff,
|
859 |
|
|
0x00008001, 0x0000fffe,
|
860 |
|
|
0xffffffff, 0x80000001)
|
861 |
|
|
|
862 |
|
|
/* MSB two moderate positive numbers on a moderate negative total */
|
863 |
|
|
TEST_MSB (0xffffffff, 0x80000002,
|
864 |
|
|
0x00008001, 0x0000fffe,
|
865 |
|
|
0xffffffff, 0x00000004)
|
866 |
|
|
|
867 |
|
|
/* MSB two moderate positive numbers on a large negative total */
|
868 |
|
|
TEST_MSB (0xfffffffe, 0x80000002,
|
869 |
|
|
0x00008001, 0x0000fffe,
|
870 |
|
|
0xfffffffe, 0x00000004)
|
871 |
|
|
|
872 |
|
|
PUTC ('\n')
|
873 |
|
|
|
874 |
|
|
/* MSB two small negative numbers on a zero total */
|
875 |
|
|
TEST_MSB (0x00000000, 0x00000006,
|
876 |
|
|
0xfffffffe, 0xfffffffd,
|
877 |
|
|
0x00000000, 0x00000000)
|
878 |
|
|
|
879 |
|
|
/* MSB two small negative numbers on a small positive total */
|
880 |
|
|
TEST_MSB (0x00000000, 0x0000000c,
|
881 |
|
|
0xfffffffe, 0xfffffffd,
|
882 |
|
|
0x00000000, 0x00000006)
|
883 |
|
|
|
884 |
|
|
/* MSB two small negative numbers on a small negative total */
|
885 |
|
|
TEST_MSB (0xffffffff, 0xffffffff,
|
886 |
|
|
0xfffffffe, 0xfffffffd,
|
887 |
|
|
0xffffffff, 0xfffffff9)
|
888 |
|
|
|
889 |
|
|
PUTC ('\n')
|
890 |
|
|
|
891 |
|
|
/* MSB one small positive and one small negative number on a zero
|
892 |
|
|
total */
|
893 |
|
|
TEST_MSB (0x00000000, 0x00000000,
|
894 |
|
|
0x00000002, 0xfffffffd,
|
895 |
|
|
0x00000000, 0x00000006)
|
896 |
|
|
|
897 |
|
|
/* MSB one small positive and one small negative number on a small
|
898 |
|
|
positive total */
|
899 |
|
|
TEST_MSB (0x00000000, 0x00000006,
|
900 |
|
|
0x00000002, 0xfffffffd,
|
901 |
|
|
0x00000000, 0x0000000c)
|
902 |
|
|
|
903 |
|
|
/* MSB one small positive and one small negative number on a moderate
|
904 |
|
|
positive total */
|
905 |
|
|
TEST_MSB (0x00000000, 0xffffffff,
|
906 |
|
|
0x00000002, 0xfffffffd,
|
907 |
|
|
0x00000001, 0x00000005)
|
908 |
|
|
|
909 |
|
|
/* MSB one small positive and one small negative number on a large
|
910 |
|
|
positive total */
|
911 |
|
|
TEST_MSB (0x7fffffff, 0xfffffff9,
|
912 |
|
|
0x00000002, 0xfffffffd,
|
913 |
|
|
0x7fffffff, 0xffffffff)
|
914 |
|
|
|
915 |
|
|
/* MSB one small positive and one small negative number on a small
|
916 |
|
|
negative total */
|
917 |
|
|
TEST_MSB (0xffffffff, 0xfffffff9,
|
918 |
|
|
0x00000002, 0xfffffffd,
|
919 |
|
|
0xffffffff, 0xffffffff)
|
920 |
|
|
|
921 |
|
|
/* MSB one small positive and one small negative number on a moderate
|
922 |
|
|
negative total */
|
923 |
|
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
924 |
|
|
0x00000002, 0xfffffffd,
|
925 |
|
|
0xffffffff, 0x00000005)
|
926 |
|
|
|
927 |
|
|
/* MSB one small positive and one small negative number on a large
|
928 |
|
|
negative total */
|
929 |
|
|
TEST_MSB (0x80000000, 0x00000000,
|
930 |
|
|
0x00000002, 0xfffffffd,
|
931 |
|
|
0x80000000, 0x00000006)
|
932 |
|
|
|
933 |
|
|
PUTC ('\n')
|
934 |
|
|
|
935 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
936 |
|
|
zero total */
|
937 |
|
|
TEST_MSB (0x00000000, 0x00000000,
|
938 |
|
|
0x00008000, 0xffff0000,
|
939 |
|
|
0x00000000, 0x80000000)
|
940 |
|
|
|
941 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
942 |
|
|
small positive total */
|
943 |
|
|
TEST_MSB (0x00000000, 0x00000006,
|
944 |
|
|
0x00008000, 0xffff0000,
|
945 |
|
|
0x00000000, 0x80000006)
|
946 |
|
|
|
947 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
948 |
|
|
moderate positive total */
|
949 |
|
|
TEST_MSB (0x00000000, 0x80000000,
|
950 |
|
|
0x00008000, 0xffff0000,
|
951 |
|
|
0x00000001, 0x00000000)
|
952 |
|
|
|
953 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
954 |
|
|
large positive total */
|
955 |
|
|
TEST_MSB (0x7fffffff, 0x7fffffff,
|
956 |
|
|
0x00008000, 0xffff0000,
|
957 |
|
|
0x7fffffff, 0xffffffff)
|
958 |
|
|
|
959 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
960 |
|
|
small negative total */
|
961 |
|
|
TEST_MSB (0xffffffff, 0xffffffff,
|
962 |
|
|
0x00008000, 0xffff0000,
|
963 |
|
|
0x00000000, 0x7fffffff)
|
964 |
|
|
|
965 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
966 |
|
|
moderate negative total */
|
967 |
|
|
TEST_MSB (0xfffffffe, 0xffffffff,
|
968 |
|
|
0x00008000, 0xffff0000,
|
969 |
|
|
0xffffffff, 0x7fffffff)
|
970 |
|
|
|
971 |
|
|
/* MSB one moderate positive and one moderate negative number on a
|
972 |
|
|
large negative total */
|
973 |
|
|
TEST_MSB (0x80000000, 0x00000000,
|
974 |
|
|
0x00008000, 0xffff0000,
|
975 |
|
|
0x80000000, 0x80000000)
|
976 |
|
|
|
977 |
|
|
PUTC ('\n')
|
978 |
|
|
|
979 |
|
|
/* ----------------------------------------------------------------------------
|
980 |
|
|
* All done
|
981 |
|
|
* ------------------------------------------------------------------------- */
|
982 |
|
|
_exit:
|
983 |
|
|
LOAD_STR (r3, "Test completed\n")
|
984 |
|
|
l.jal _puts
|
985 |
|
|
l.nop
|
986 |
|
|
|
987 |
|
|
TEST_EXIT
|