]>
Commit | Line | Data |
---|---|---|
702d582e PG |
1 | /* Tests the MAC instructions. |
2 | ||
e2882c85 | 3 | Copyright (C) 2017-2018 Free Software Foundation, Inc. |
702d582e PG |
4 | |
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | # mach: or1k | |
19 | # output: report(0x00000000);\n | |
20 | # output: report(0x00000006);\n | |
21 | # output: report(0x00000000);\n | |
22 | # output: report(0x0000000c);\n | |
23 | # output: report(0x00000001);\n | |
24 | # output: report(0x00000000);\n | |
25 | # output: report(0x40000000);\n | |
26 | # output: report(0x00000000);\n | |
27 | # output: report(0x00000000);\n | |
28 | # output: report(0x00000000);\n | |
29 | # output: report(0xffffffff);\n | |
30 | # output: report(0x00000006);\n | |
31 | # output: report(0x80000000);\n | |
32 | # output: report(0x00000006);\n | |
33 | # output: report(0x00000000);\n | |
34 | # output: report(0x7ffffffe);\n | |
35 | # output: report(0x00000000);\n | |
36 | # output: report(0x80000000);\n | |
37 | # output: report(0x00000001);\n | |
38 | # output: report(0x00000000);\n | |
39 | # output: report(0x7fffffff);\n | |
40 | # output: report(0xffffffff);\n | |
41 | # output: report(0x00000000);\n | |
42 | # output: report(0x7ffffffd);\n | |
43 | # output: report(0x00000000);\n | |
44 | # output: report(0x00000000);\n | |
45 | # output: report(0xffffffff);\n | |
46 | # output: report(0x00000000);\n | |
47 | # output: report(0x00000000);\n | |
48 | # output: report(0x00000006);\n | |
49 | # output: report(0x00000000);\n | |
50 | # output: report(0x0000000c);\n | |
51 | # output: report(0x00000000);\n | |
52 | # output: report(0x00000005);\n | |
53 | # output: report(0xffffffff);\n | |
54 | # output: report(0xfffffffa);\n | |
55 | # output: report(0x00000000);\n | |
56 | # output: report(0x00000006);\n | |
57 | # output: report(0x00000000);\n | |
58 | # output: report(0xffffffff);\n | |
59 | # output: report(0x7fffffff);\n | |
60 | # output: report(0xfffffff9);\n | |
61 | # output: report(0xffffffff);\n | |
62 | # output: report(0xfffffff9);\n | |
63 | # output: report(0xfffffffe);\n | |
64 | # output: report(0xffffffff);\n | |
65 | # output: report(0x80000000);\n | |
66 | # output: report(0x00000000);\n | |
67 | # output: report(0xffffffff);\n | |
68 | # output: report(0x80000000);\n | |
69 | # output: report(0xffffffff);\n | |
70 | # output: report(0x80000006);\n | |
71 | # output: report(0x00000000);\n | |
72 | # output: report(0x00000000);\n | |
73 | # output: report(0x7fffffff);\n | |
74 | # output: report(0x7fffffff);\n | |
75 | # output: report(0xffffffff);\n | |
76 | # output: report(0x7fffffff);\n | |
77 | # output: report(0xfffffffe);\n | |
78 | # output: report(0xffffffff);\n | |
79 | # output: report(0x80000000);\n | |
80 | # output: report(0x00000000);\n | |
81 | # output: report(0x00000000);\n | |
82 | # output: report(0x00000006);\n | |
83 | # output: report(0x00000000);\n | |
84 | # output: report(0x0000000c);\n | |
85 | # output: report(0x00000001);\n | |
86 | # output: report(0x00000000);\n | |
87 | # output: report(0x40000000);\n | |
88 | # output: report(0x00000000);\n | |
89 | # output: report(0x00000000);\n | |
90 | # output: report(0x00000000);\n | |
91 | # output: report(0xffffffff);\n | |
92 | # output: report(0x00000006);\n | |
93 | # output: report(0x80000000);\n | |
94 | # output: report(0x00000006);\n | |
95 | # output: report(0x00000000);\n | |
96 | # output: report(0x7ffffffe);\n | |
97 | # output: report(0x00000000);\n | |
98 | # output: report(0x80000000);\n | |
99 | # output: report(0x00000001);\n | |
100 | # output: report(0x00000000);\n | |
101 | # output: report(0x7fffffff);\n | |
102 | # output: report(0xffffffff);\n | |
103 | # output: report(0x00000000);\n | |
104 | # output: report(0x7ffffffd);\n | |
105 | # output: report(0x00000000);\n | |
106 | # output: report(0x00000000);\n | |
107 | # output: report(0xffffffff);\n | |
108 | # output: report(0x00000000);\n | |
109 | # output: report(0x00000000);\n | |
110 | # output: report(0x00000006);\n | |
111 | # output: report(0x00000000);\n | |
112 | # output: report(0x0000000c);\n | |
113 | # output: report(0x00000000);\n | |
114 | # output: report(0x00000005);\n | |
115 | # output: report(0xffffffff);\n | |
116 | # output: report(0xfffffffa);\n | |
117 | # output: report(0x00000000);\n | |
118 | # output: report(0x00000006);\n | |
119 | # output: report(0x00000000);\n | |
120 | # output: report(0xffffffff);\n | |
121 | # output: report(0x7fffffff);\n | |
122 | # output: report(0xfffffff9);\n | |
123 | # output: report(0xffffffff);\n | |
124 | # output: report(0xfffffff9);\n | |
125 | # output: report(0xfffffffe);\n | |
126 | # output: report(0xffffffff);\n | |
127 | # output: report(0x80000000);\n | |
128 | # output: report(0x00000000);\n | |
129 | # output: report(0xffffffff);\n | |
130 | # output: report(0x80000000);\n | |
131 | # output: report(0xffffffff);\n | |
132 | # output: report(0x80000006);\n | |
133 | # output: report(0x00000000);\n | |
134 | # output: report(0x00000000);\n | |
135 | # output: report(0x7fffffff);\n | |
136 | # output: report(0x7fffffff);\n | |
137 | # output: report(0xffffffff);\n | |
138 | # output: report(0x7fffffff);\n | |
139 | # output: report(0xfffffffe);\n | |
140 | # output: report(0xffffffff);\n | |
141 | # output: report(0x80000000);\n | |
142 | # output: report(0x00000000);\n | |
143 | # output: report(0x00000006);\n | |
144 | # output: report(0x0000000c);\n | |
145 | # output: report(0x00000000);\n | |
146 | # output: report(0x00000000);\n | |
147 | # output: report(0x00000000);\n | |
148 | # output: report(0x00000006);\n | |
149 | # output: report(0x00000006);\n | |
150 | # output: report(0x7ffffffe);\n | |
151 | # output: report(0x80000000);\n | |
152 | # output: report(0x00000000);\n | |
153 | # output: report(0xffffffff);\n | |
154 | # output: report(0x7ffffffd);\n | |
155 | # output: report(0x00000000);\n | |
156 | # output: report(0x00000000);\n | |
157 | # output: report(0x00000006);\n | |
158 | # output: report(0x0000000c);\n | |
159 | # output: report(0x00000005);\n | |
160 | # output: report(0xfffffffa);\n | |
161 | # output: report(0x00000006);\n | |
162 | # output: report(0xffffffff);\n | |
163 | # output: report(0xfffffff9);\n | |
164 | # output: report(0xfffffff9);\n | |
165 | # output: report(0xffffffff);\n | |
166 | # output: report(0x00000000);\n | |
167 | # output: report(0x80000000);\n | |
168 | # output: report(0x80000006);\n | |
169 | # output: report(0x00000000);\n | |
170 | # output: report(0x7fffffff);\n | |
171 | # output: report(0x7fffffff);\n | |
172 | # output: report(0xffffffff);\n | |
173 | # output: report(0x00000000);\n | |
174 | # output: report(0xffffffff);\n | |
175 | # output: report(0xfffffffa);\n | |
176 | # output: report(0x00000000);\n | |
177 | # output: report(0x00000006);\n | |
178 | # output: report(0x00000000);\n | |
179 | # output: report(0xfffffffa);\n | |
180 | # output: report(0x3fffffff);\n | |
181 | # output: report(0xfffffffa);\n | |
182 | # output: report(0xffffffff);\n | |
183 | # output: report(0xfffffff4);\n | |
184 | # output: report(0xfffffffe);\n | |
185 | # output: report(0xffffffff);\n | |
186 | # output: report(0x80000000);\n | |
187 | # output: report(0x00000000);\n | |
188 | # output: report(0xffffffff);\n | |
189 | # output: report(0x80000002);\n | |
190 | # output: report(0xffffffff);\n | |
191 | # output: report(0x80000004);\n | |
192 | # output: report(0x00000000);\n | |
193 | # output: report(0x00000004);\n | |
194 | # output: report(0x7ffffffe);\n | |
195 | # output: report(0xffffffff);\n | |
196 | # output: report(0xffffffff);\n | |
197 | # output: report(0x80000001);\n | |
198 | # output: report(0xffffffff);\n | |
199 | # output: report(0x00000004);\n | |
200 | # output: report(0xfffffffe);\n | |
201 | # output: report(0x00000004);\n | |
202 | # output: report(0x00000000);\n | |
203 | # output: report(0x00000000);\n | |
204 | # output: report(0x00000000);\n | |
205 | # output: report(0x00000006);\n | |
206 | # output: report(0xffffffff);\n | |
207 | # output: report(0xfffffff9);\n | |
208 | # output: report(0x00000000);\n | |
209 | # output: report(0x00000006);\n | |
210 | # output: report(0x00000000);\n | |
211 | # output: report(0x0000000c);\n | |
212 | # output: report(0x00000001);\n | |
213 | # output: report(0x00000005);\n | |
214 | # output: report(0x7fffffff);\n | |
215 | # output: report(0xffffffff);\n | |
216 | # output: report(0xffffffff);\n | |
217 | # output: report(0xffffffff);\n | |
218 | # output: report(0xffffffff);\n | |
219 | # output: report(0x00000005);\n | |
220 | # output: report(0x80000000);\n | |
221 | # output: report(0x00000006);\n | |
222 | # output: report(0x00000000);\n | |
223 | # output: report(0x80000000);\n | |
224 | # output: report(0x00000000);\n | |
225 | # output: report(0x80000006);\n | |
226 | # output: report(0x00000001);\n | |
227 | # output: report(0x00000000);\n | |
228 | # output: report(0x7fffffff);\n | |
229 | # output: report(0xffffffff);\n | |
230 | # output: report(0x00000000);\n | |
231 | # output: report(0x7fffffff);\n | |
232 | # output: report(0xffffffff);\n | |
233 | # output: report(0x7fffffff);\n | |
234 | # output: report(0x80000000);\n | |
235 | # output: report(0x80000000);\n | |
236 | # output: exit(0)\n | |
237 | ||
238 | #include "or1k-asm-test-helpers.h" | |
239 | ||
240 | .macro TEST_MACRC mac_hi, mac_lo, op1, op2 | |
241 | LOAD_IMMEDIATE r2, \mac_hi | |
242 | MOVE_TO_SPR SPR_MACHI, r2 | |
243 | LOAD_IMMEDIATE r2, \mac_lo | |
244 | MOVE_TO_SPR SPR_MACLO, r2 | |
245 | LOAD_IMMEDIATE r5, \op1 | |
246 | LOAD_IMMEDIATE r6, \op2 | |
247 | l.mac r5, r6 | |
248 | l.macrc r3 | |
249 | REPORT_REG_TO_CONSOLE r3 | |
250 | .endm | |
251 | ||
252 | .macro TEST_MAC mac_hi, mac_lo, op1, op2 | |
253 | LOAD_IMMEDIATE r2, \mac_hi | |
254 | MOVE_TO_SPR SPR_MACHI, r2 | |
255 | LOAD_IMMEDIATE r2, \mac_lo | |
256 | MOVE_TO_SPR SPR_MACLO, r2 | |
257 | LOAD_IMMEDIATE r5, \op1 | |
258 | LOAD_IMMEDIATE r6, \op2 | |
259 | l.mac r5, r6 | |
260 | MOVE_FROM_SPR r3, SPR_MACHI | |
261 | REPORT_REG_TO_CONSOLE r3 | |
262 | MOVE_FROM_SPR r3, SPR_MACLO | |
263 | REPORT_REG_TO_CONSOLE r3 | |
264 | .endm | |
265 | ||
266 | .macro TEST_MACI mac_hi, mac_lo, op1, op2_immediate | |
267 | LOAD_IMMEDIATE r2, \mac_hi | |
268 | MOVE_TO_SPR SPR_MACHI, r2 | |
269 | LOAD_IMMEDIATE r2, \mac_lo | |
270 | MOVE_TO_SPR SPR_MACLO, r2 | |
271 | LOAD_IMMEDIATE r5, \op1 | |
272 | l.maci r5, \op2_immediate | |
273 | MOVE_FROM_SPR r3, SPR_MACHI | |
274 | REPORT_REG_TO_CONSOLE r3 | |
275 | MOVE_FROM_SPR r3, SPR_MACLO | |
276 | REPORT_REG_TO_CONSOLE r3 | |
277 | .endm | |
278 | ||
279 | .macro TEST_MSB mac_hi, mac_lo, op1, op2 | |
280 | LOAD_IMMEDIATE r2, \mac_hi | |
281 | MOVE_TO_SPR SPR_MACHI, r2 | |
282 | LOAD_IMMEDIATE r2, \mac_lo | |
283 | MOVE_TO_SPR SPR_MACLO, r2 | |
284 | LOAD_IMMEDIATE r5, \op1 | |
285 | LOAD_IMMEDIATE r6, \op2 | |
286 | l.msb r5, r6 | |
287 | MOVE_FROM_SPR r3, SPR_MACHI | |
288 | REPORT_REG_TO_CONSOLE r3 | |
289 | MOVE_FROM_SPR r3, SPR_MACLO | |
290 | REPORT_REG_TO_CONSOLE r3 | |
291 | .endm | |
292 | ||
293 | STANDARD_TEST_ENVIRONMENT | |
294 | ||
295 | .section .text | |
296 | start_tests: | |
297 | PUSH LINK_REGISTER_R9 | |
298 | ||
299 | /* Test the l.mac instruction. */ | |
300 | ||
301 | /* two small positive numbers */ | |
302 | ||
303 | /* MAC two small positive numbers on a zero total */ | |
304 | TEST_MAC 0x00000000, 0x00000000, 0x00000002, 0x00000003 | |
305 | ||
306 | /* MAC two small positive numbers on a small positive total */ | |
307 | TEST_MAC 0x00000000, 0x00000006, 0x00000002, 0x00000003, | |
308 | ||
309 | /* MAC two small positive numbers on a moderate positive total */ | |
310 | TEST_MAC 0x00000000, 0xfffffffa, 0x00000002, 0x00000003 | |
311 | ||
312 | /* MAC two small positive numbers on a large positive total */ | |
313 | TEST_MAC 0x3fffffff, 0xfffffffa, 0x00000002, 0x00000003 | |
314 | ||
315 | /* MAC two small positive numbers on a small negative total */ | |
316 | TEST_MAC 0xffffffff, 0xfffffffa, 0x00000002, 0x00000003 | |
317 | ||
318 | /* MAC two small positive numbers on a moderate negative total */ | |
319 | TEST_MAC 0xffffffff, 0x00000000, 0x00000002, 0x00000003 | |
320 | ||
321 | /* MAC two small positive numbers on a large negative total */ | |
322 | TEST_MAC 0x80000000, 0x00000000, 0x00000002, 0x00000003 | |
323 | ||
324 | /* two moderate positive numbers */ | |
325 | ||
326 | /* MAC two moderate positive numbers on a zero total */ | |
327 | TEST_MAC 0x00000000, 0x00000000, 0x00008001, 0x0000fffe | |
328 | ||
329 | /* MAC two moderate positive numbers on a small positive total */ | |
330 | TEST_MAC 0x00000000, 0x00000002, 0x00008001, 0x0000fffe | |
331 | ||
332 | /* MAC two moderate positive numbers on a moderate positive total */ | |
333 | TEST_MAC 0x00000000, 0x80000002, 0x00008001, 0x0000fffe | |
334 | ||
335 | /* MAC two moderate positive numbers on a large positive total */ | |
336 | TEST_MAC 0x7fffffff, 0x80000001, 0x00008001, 0x0000fffe | |
337 | ||
338 | /* MAC two moderate positive numbers on a small negative total */ | |
339 | TEST_MAC 0xffffffff, 0xffffffff, 0x00008001, 0x0000fffe | |
340 | ||
341 | /* MAC two moderate positive numbers on a moderate negative total */ | |
342 | TEST_MAC 0xffffffff, 0x80000002, 0x00008001, 0x0000fffe | |
343 | ||
344 | /* MAC two moderate positive numbers on a large negative total */ | |
345 | TEST_MAC 0xfffffffe, 0x80000002, 0x00008001, 0x0000fffe | |
346 | ||
347 | /* two small negative numbers */ | |
348 | ||
349 | /* MAC two small negative numbers on a zero total */ | |
350 | TEST_MAC 0x00000000, 0x00000000, 0xfffffffe, 0xfffffffd | |
351 | ||
352 | /* MAC two small negative numbers on a small positive total */ | |
353 | TEST_MAC 0x00000000, 0x00000006, 0xfffffffe, 0xfffffffd | |
354 | ||
355 | /* MAC two small negative numbers on a small negative total */ | |
356 | TEST_MAC 0xffffffff, 0xffffffff, 0xfffffffe, 0xfffffffd | |
357 | ||
358 | /* one small positive and one small negative */ | |
359 | ||
360 | /* MAC one small positive and one small negative number on a zero | |
361 | total */ | |
362 | TEST_MAC 0x00000000, 0x00000000, 0x00000002, 0xfffffffd | |
363 | ||
364 | /* MAC one small positive and one small negative number on a small | |
365 | positive total */ | |
366 | TEST_MAC 0x00000000, 0x0000000c, 0x00000002, 0xfffffffd | |
367 | ||
368 | /* MAC one small positive and one small negative number on a | |
369 | moderate positive total */ | |
370 | TEST_MAC 0x00000001, 0x00000005, 0x00000002, 0xfffffffd | |
371 | ||
372 | /* MAC one small positive and one small negative number on a large | |
373 | positive total */ | |
374 | TEST_MAC 0x7fffffff, 0xffffffff, 0x00000002, 0xfffffffd | |
375 | ||
376 | /* MAC one small positive and one small negative number on a small | |
377 | negative total */ | |
378 | TEST_MAC 0xffffffff, 0xffffffff, 0x00000002, 0xfffffffd | |
379 | ||
380 | /* MAC one small positive and one small negative number on a | |
381 | moderate negative total */ | |
382 | TEST_MAC 0xffffffff, 0x00000005, 0x00000002, 0xfffffffd | |
383 | ||
384 | /* MAC one small positive and one small negative number on a large | |
385 | negative total */ | |
386 | TEST_MAC 0x80000000, 0x00000006, 0x00000002, 0xfffffffd | |
387 | ||
388 | /* one moderate positive and one moderate negative number */ | |
389 | ||
390 | /* MAC one moderate positive and one moderate negative number on a | |
391 | zero total */ | |
392 | TEST_MAC 0x00000000, 0x00000000, 0x00008000, 0xffff0000 | |
393 | ||
394 | /* MAC one moderate positive and one moderate negative number on a | |
395 | small positive total */ | |
396 | TEST_MAC 0x00000000, 0x00000006, 0x00008000, 0xffff0000 | |
397 | ||
398 | /* MAC one moderate positive and one moderate negative number on a | |
399 | moderate positive total */ | |
400 | TEST_MAC 0x00000000, 0x80000000, 0x00008000, 0xffff0000 | |
401 | ||
402 | /* MAC one moderate positive and one moderate negative number on a | |
403 | large positive total */ | |
404 | TEST_MAC 0x7fffffff, 0xffffffff, 0x00008000, 0xffff0000 | |
405 | ||
406 | /* MAC one moderate positive and one moderate negative number on a | |
407 | small negative total */ | |
408 | TEST_MAC 0xffffffff, 0xffffffff, 0x00008000, 0xffff0000 | |
409 | ||
410 | /* MAC one moderate positive and one moderate negative number on a | |
411 | moderate negative total */ | |
412 | TEST_MAC 0xffffffff, 0x7fffffff, 0x00008000, 0xffff0000 | |
413 | ||
414 | /* MAC one moderate positive and one moderate negative number on a | |
415 | large negative total */ | |
416 | TEST_MAC 0x80000000, 0x80000000, 0x00008000, 0xffff0000 | |
417 | ||
418 | /* Test the l.maci instruction. */ | |
419 | ||
420 | /* two small positive numbers */ | |
421 | ||
422 | /* MAC two small positive numbers on a zero total */ | |
423 | TEST_MACI 0x00000000, 0x00000000, 0x00000002, 0x0003 | |
424 | ||
425 | /* MAC two small positive numbers on a small positive total */ | |
426 | TEST_MACI 0x00000000, 0x00000006, 0x00000002, 0x0003 | |
427 | ||
428 | /* MAC two small positive numbers on a moderate positive total */ | |
429 | TEST_MACI 0x00000000, 0xfffffffa, 0x00000002, 0x0003 | |
430 | ||
431 | /* MAC two small positive numbers on a large positive total */ | |
432 | TEST_MACI 0x3fffffff, 0xfffffffa, 0x00000002, 0x0003 | |
433 | ||
434 | /* MAC two small positive numbers on a small negative total */ | |
435 | TEST_MACI 0xffffffff, 0xfffffffa, 0x00000002, 0x0003 | |
436 | ||
437 | /* MAC two small positive numbers on a moderate negative total */ | |
438 | TEST_MACI 0xffffffff, 0x00000000, 0x00000002, 0x0003 | |
439 | ||
440 | /* MAC two small positive numbers on a large negative total */ | |
441 | TEST_MACI 0x80000000, 0x00000000, 0x00000002, 0x0003 | |
442 | ||
443 | /* two moderate positive numbers */ | |
444 | ||
445 | /* MAC two moderate positive numbers on a zero total */ | |
446 | TEST_MACI 0x00000000, 0x00000000, 0x00010002, 0x7fff | |
447 | ||
448 | /* MAC two moderate positive numbers on a small positive total */ | |
449 | TEST_MACI 0x00000000, 0x00000002, 0x00010002, 0x7fff | |
450 | ||
451 | /* MAC two moderate positive numbers on a moderate positive total */ | |
452 | TEST_MACI 0x00000000, 0x80000002, 0x00010002, 0x7fff | |
453 | ||
454 | /* MAC two moderate positive numbers on a large positive total */ | |
455 | TEST_MACI 0x7fffffff, 0x80000001, 0x00010002, 0x7fff | |
456 | ||
457 | /* MAC two moderate positive numbers on a small negative total */ | |
458 | TEST_MACI 0xffffffff, 0xffffffff, 0x00010002, 0x7fff | |
459 | ||
460 | /* MAC two moderate positive numbers on a moderate negative total */ | |
461 | TEST_MACI 0xffffffff, 0x80000002, 0x00010002, 0x7fff | |
462 | ||
463 | /* MAC two moderate positive numbers on a large negative total */ | |
464 | TEST_MACI 0xfffffffe, 0x80000002, 0x00010002, 0x7fff | |
465 | ||
466 | /* two small negative numbers */ | |
467 | ||
468 | /* MAC two small negative numbers on a zero total */ | |
469 | TEST_MACI 0x00000000, 0x00000000, 0xfffffffe, 0xfffd | |
470 | ||
471 | /* MAC two small negative numbers on a small positive total */ | |
472 | TEST_MACI 0x00000000, 0x00000006, 0xfffffffe, 0xfffd | |
473 | ||
474 | /* MAC two small negative numbers on a small negative total */ | |
475 | TEST_MACI 0xffffffff, 0xffffffff, 0xfffffffe, 0xfffd | |
476 | ||
477 | /* one small positive and one small negative */ | |
478 | ||
479 | /* MAC one small positive and one small negative number on a zero | |
480 | total */ | |
481 | TEST_MACI 0x00000000, 0x00000000, 0x00000002, 0xfffd | |
482 | ||
483 | /* MAC one small positive and one small negative number on a small | |
484 | positive total */ | |
485 | TEST_MACI 0x00000000, 0x0000000c, 0x00000002, 0xfffd | |
486 | ||
487 | /* MAC one small positive and one small negative number on a | |
488 | moderate positive total */ | |
489 | TEST_MACI 0x00000001, 0x00000005, 0x00000002, 0xfffd | |
490 | ||
491 | /* MAC one small positive and one small negative number on a large | |
492 | positive total */ | |
493 | TEST_MACI 0x7fffffff, 0xffffffff, 0x00000002, 0xfffd | |
494 | ||
495 | /* MAC one small positive and one small negative number on a small | |
496 | negative total */ | |
497 | TEST_MACI 0xffffffff, 0xffffffff, 0x00000002, 0xfffd | |
498 | ||
499 | /* MAC one small positive and one small negative number on a | |
500 | moderate negative total */ | |
501 | TEST_MACI 0xffffffff, 0x00000005, 0x00000002, 0xfffd | |
502 | ||
503 | /* MAC one small positive and one small negative number on a large | |
504 | negative total */ | |
505 | TEST_MACI 0x80000000, 0x00000006, 0x00000002, 0xfffd | |
506 | ||
507 | /* one moderate positive and one moderate negative */ | |
508 | ||
509 | /* MAC one moderate positive and one moderate negative number on a | |
510 | zero total */ | |
511 | TEST_MACI 0x00000000, 0x00000000, 0x00010000, 0x8000 | |
512 | ||
513 | /* MAC one moderate positive and one moderate negative number on a | |
514 | small positive total */ | |
515 | TEST_MACI 0x00000000, 0x00000006, 0x00010000, 0x8000 | |
516 | ||
517 | /* MAC one moderate positive and one moderate negative number on a | |
518 | moderate positive total */ | |
519 | TEST_MACI 0x00000000, 0x80000000, 0x00010000, 0x8000 | |
520 | ||
521 | /* MAC one moderate positive and one moderate negative number on a | |
522 | large positive total */ | |
523 | TEST_MACI 0x7fffffff, 0xffffffff, 0x00010000, 0x8000 | |
524 | ||
525 | /* MAC one moderate positive and one moderate negative number on a | |
526 | small negative total */ | |
527 | TEST_MACI 0xffffffff, 0xffffffff, 0x00010000, 0x8000 | |
528 | ||
529 | /* MAC one moderate positive and one moderate negative number on a | |
530 | moderate negative total */ | |
531 | TEST_MACI 0xffffffff, 0x7fffffff, 0x00010000, 0x8000 | |
532 | ||
533 | /* MAC one moderate positive and one moderate negative number on a | |
534 | large negative total */ | |
535 | TEST_MACI 0x80000000, 0x80000000, 0x00010000, 0x8000 | |
536 | ||
537 | /* Test the l.macrc instruction. | |
538 | ||
539 | Note that these tests use the same input data as the ones for | |
540 | l.mac above. The results are the same, but only the low 32-bits | |
541 | are compared. */ | |
542 | ||
543 | /* two small positive numbers */ | |
544 | ||
545 | /* MAC two small positive numbers on a zero total */ | |
546 | TEST_MACRC 0x00000000, 0x00000000, 0x00000002, 0x00000003 | |
547 | ||
548 | /* MAC two small positive numbers on a small positive total */ | |
549 | TEST_MACRC 0x00000000, 0x00000006, 0x00000002, 0x00000003 | |
550 | ||
551 | /* MAC two small positive numbers on a moderate positive total */ | |
552 | TEST_MACRC 0x00000000, 0xfffffffa, 0x00000002, 0x00000003 | |
553 | ||
554 | /* MAC two small positive numbers on a large positive total */ | |
555 | TEST_MACRC 0x3fffffff, 0xfffffffa, 0x00000002, 0x00000003 | |
556 | ||
557 | /* MAC two small positive numbers on a small negative total */ | |
558 | TEST_MACRC 0xffffffff, 0xfffffffa, 0x00000002, 0x00000003 | |
559 | ||
560 | /* MAC two small positive numbers on a moderate negative total */ | |
561 | TEST_MACRC 0xffffffff, 0x00000000, 0x00000002, 0x00000003 | |
562 | ||
563 | /* MAC two small positive numbers on a large negative total */ | |
564 | TEST_MACRC 0x80000000, 0x00000000, 0x00000002, 0x00000003 | |
565 | ||
566 | /* two moderate positive numbers */ | |
567 | ||
568 | /* MAC two moderate positive numbers on a zero total */ | |
569 | TEST_MACRC 0x00000000, 0x00000000, 0x00008001, 0x0000fffe | |
570 | ||
571 | /* MAC two moderate positive numbers on a small positive total */ | |
572 | TEST_MACRC 0x00000000, 0x00000002, 0x00008001, 0x0000fffe | |
573 | ||
574 | /* MAC two moderate positive numbers on a moderate positive total */ | |
575 | TEST_MACRC 0x00000000, 0x80000002, 0x00008001, 0x0000fffe | |
576 | ||
577 | /* MAC two moderate positive numbers on a large positive total */ | |
578 | TEST_MACRC 0x7fffffff, 0x80000001, 0x00008001, 0x0000fffe | |
579 | ||
580 | /* MAC two moderate positive numbers on a small negative total */ | |
581 | TEST_MACRC 0xffffffff, 0xffffffff, 0x00008001, 0x0000fffe | |
582 | ||
583 | /* MAC two moderate positive numbers on a moderate negative total */ | |
584 | TEST_MACRC 0xffffffff, 0x80000002, 0x00008001, 0x0000fffe | |
585 | ||
586 | /* MAC two moderate positive numbers on a large negative total */ | |
587 | TEST_MACRC 0xfffffffe, 0x80000002, 0x00008001, 0x0000fffe | |
588 | ||
589 | /* two small negative numbers */ | |
590 | ||
591 | /* MAC two small negative numbers on a zero total */ | |
592 | TEST_MACRC 0x00000000, 0x00000000, 0xfffffffe, 0xfffffffd | |
593 | ||
594 | /* MAC two small negative numbers on a small positive total */ | |
595 | TEST_MACRC 0x00000000, 0x00000006, 0xfffffffe, 0xfffffffd | |
596 | ||
597 | /* MAC two small negative numbers on a small negative total */ | |
598 | TEST_MACRC 0xffffffff, 0xffffffff, 0xfffffffe, 0xfffffffd | |
599 | ||
600 | /* one small positive and one small negative number */ | |
601 | ||
602 | /* MAC one small positive and one small negative number on a zero | |
603 | total */ | |
604 | TEST_MACRC 0x00000000, 0x00000000, 0x00000002, 0xfffffffd | |
605 | ||
606 | /* MAC one small positive and one small negative number on a small | |
607 | positive total */ | |
608 | TEST_MACRC 0x00000000, 0x0000000c, 0x00000002, 0xfffffffd | |
609 | ||
610 | /* MAC one small positive and one small negative number on a | |
611 | moderate positive total */ | |
612 | TEST_MACRC 0x00000001, 0x00000005, 0x00000002, 0xfffffffd | |
613 | ||
614 | /* MAC one small positive and one small negative number on a large | |
615 | positive total */ | |
616 | TEST_MACRC 0x7fffffff, 0xffffffff, 0x00000002, 0xfffffffd | |
617 | ||
618 | /* MAC one small positive and one small negative number on a small | |
619 | negative total */ | |
620 | TEST_MACRC 0xffffffff, 0xffffffff, 0x00000002, 0xfffffffd | |
621 | ||
622 | /* MAC one small positive and one small negative number on a | |
623 | moderate negative total */ | |
624 | TEST_MACRC 0xffffffff, 0x00000005, 0x00000002, 0xfffffffd | |
625 | ||
626 | /* MAC one small positive and one small negative number on a large | |
627 | negative total */ | |
628 | TEST_MACRC 0x80000000, 0x00000006, 0x00000002, 0xfffffffd | |
629 | ||
630 | /* one moderate positive and one moderate negative */ | |
631 | ||
632 | /* MAC one moderate positive and one moderate negative number on a | |
633 | zero total */ | |
634 | TEST_MACRC 0x00000000, 0x00000000, 0x00008000, 0xffff0000 | |
635 | ||
636 | /* MAC one moderate positive and one moderate negative number on a | |
637 | small positive total */ | |
638 | TEST_MACRC 0x00000000, 0x00000006, 0x00008000, 0xffff0000 | |
639 | ||
640 | /* MAC one moderate positive and one moderate negative number on a | |
641 | moderate positive total */ | |
642 | TEST_MACRC 0x00000000, 0x80000000, 0x00008000, 0xffff0000 | |
643 | ||
644 | /* MAC one moderate positive and one moderate negative number on a | |
645 | large positive total */ | |
646 | TEST_MACRC 0x7fffffff, 0xffffffff, 0x00008000, 0xffff0000 | |
647 | ||
648 | /* MAC one moderate positive and one moderate negative number on a | |
649 | small negative total */ | |
650 | TEST_MACRC 0xffffffff, 0xffffffff, 0x00008000, 0xffff0000 | |
651 | ||
652 | /* MAC one moderate positive and one moderate negative number on a | |
653 | moderate negative total */ | |
654 | TEST_MACRC 0xffffffff, 0x7fffffff, 0x00008000, 0xffff0000 | |
655 | ||
656 | /* MAC one moderate positive and one moderate negative number on a | |
657 | large negative total */ | |
658 | TEST_MACRC 0x80000000, 0x80000000, 0x00008000, 0xffff0000 | |
659 | ||
660 | /* Test the l.msb instruction. */ | |
661 | ||
662 | /* MSB two small positive numbers on a zero total */ | |
663 | TEST_MSB 0x00000000, 0x00000000, 0x00000002, 0x00000003 | |
664 | ||
665 | /* MSB two small positive numbers on a small positive total */ | |
666 | TEST_MSB 0x00000000, 0x0000000c, 0x00000002, 0x00000003 | |
667 | ||
668 | /* MSB two small positive numbers on a moderate positive total */ | |
669 | TEST_MSB 0x00000001, 0x00000000, 0x00000002, 0x00000003 | |
670 | ||
671 | /* MSB two small positive numbers on a large positive total */ | |
672 | TEST_MSB 0x40000000, 0x00000000, 0x00000002, 0x00000003 | |
673 | ||
674 | /* MSB two small positive numbers on a small negative total */ | |
675 | TEST_MSB 0xffffffff, 0xfffffffa, 0x00000002, 0x00000003 | |
676 | ||
677 | /* MSB two small positive numbers on a moderate negative total */ | |
678 | TEST_MSB 0xffffffff, 0x00000005, 0x00000002, 0x00000003 | |
679 | ||
680 | /* MSB two small positive numbers on a large negative total */ | |
681 | TEST_MSB 0x80000000, 0x00000006, 0x00000002, 0x00000003 | |
682 | ||
683 | /* two moderate positive numbers */ | |
684 | ||
685 | /* MSB two moderate positive numbers on a zero total */ | |
686 | TEST_MSB 0x00000000, 0x00000000, 0x00008001, 0x0000fffe | |
687 | ||
688 | /* MSB two moderate positive numbers on a small positive total */ | |
689 | TEST_MSB 0x00000000, 0x00000002, 0x00008001, 0x0000fffe | |
690 | ||
691 | /* MSB two moderate positive numbers on a moderate positive total */ | |
692 | TEST_MSB 0x00000000, 0x80000002, 0x00008001, 0x0000fffe | |
693 | ||
694 | /* MSB two moderate positive numbers on a large positive total */ | |
695 | TEST_MSB 0x7fffffff, 0x7ffffffd, 0x00008001, 0x0000fffe | |
696 | ||
697 | /* MSB two moderate positive numbers on a small negative total */ | |
698 | TEST_MSB 0xffffffff, 0xffffffff, 0x00008001, 0x0000fffe | |
699 | ||
700 | /* MSB two moderate positive numbers on a moderate negative total */ | |
701 | TEST_MSB 0xffffffff, 0x80000002, 0x00008001, 0x0000fffe | |
702 | ||
703 | /* MSB two moderate positive numbers on a large negative total */ | |
704 | TEST_MSB 0xfffffffe, 0x80000002, 0x00008001, 0x0000fffe | |
705 | ||
706 | /* two small negative numbers */ | |
707 | ||
708 | /* MSB two small negative numbers on a zero total */ | |
709 | TEST_MSB 0x00000000, 0x00000006, 0xfffffffe, 0xfffffffd | |
710 | ||
711 | /* MSB two small negative numbers on a small positive total */ | |
712 | TEST_MSB 0x00000000, 0x0000000c, 0xfffffffe, 0xfffffffd | |
713 | ||
714 | /* MSB two small negative numbers on a small negative total */ | |
715 | TEST_MSB 0xffffffff, 0xffffffff, 0xfffffffe, 0xfffffffd | |
716 | ||
717 | /* one small positive and one small negative number */ | |
718 | ||
719 | /* MSB one small positive and one small negative number on a zero | |
720 | total */ | |
721 | TEST_MSB 0x00000000, 0x00000000, 0x00000002, 0xfffffffd | |
722 | ||
723 | /* MSB one small positive and one small negative number on a small | |
724 | positive total */ | |
725 | TEST_MSB 0x00000000, 0x00000006, 0x00000002, 0xfffffffd | |
726 | ||
727 | /* MSB one small positive and one small negative number on a | |
728 | moderate positive total */ | |
729 | TEST_MSB 0x00000000, 0xffffffff, 0x00000002, 0xfffffffd | |
730 | ||
731 | /* MSB one small positive and one small negative number on a large | |
732 | positive total */ | |
733 | TEST_MSB 0x7fffffff, 0xfffffff9, 0x00000002, 0xfffffffd | |
734 | ||
735 | /* MSB one small positive and one small negative number on a small | |
736 | negative total */ | |
737 | TEST_MSB 0xffffffff, 0xfffffff9, 0x00000002, 0xfffffffd | |
738 | ||
739 | /* MSB one small positive and one small negative number on a | |
740 | moderate negative total */ | |
741 | TEST_MSB 0xfffffffe, 0xffffffff, 0x00000002, 0xfffffffd | |
742 | ||
743 | /* MSB one small positive and one small negative number on a large | |
744 | negative total */ | |
745 | TEST_MSB 0x80000000, 0x00000000, 0x00000002, 0xfffffffd | |
746 | ||
747 | /* one moderate positive and one moderate negative number */ | |
748 | ||
749 | /* MSB one moderate positive and one moderate negative number on a | |
750 | zero total */ | |
751 | TEST_MSB 0x00000000, 0x00000000, 0x00008000, 0xffff0000 | |
752 | ||
753 | /* MSB one moderate positive and one moderate negative number on a | |
754 | small positive total */ | |
755 | TEST_MSB 0x00000000, 0x00000006, 0x00008000, 0xffff0000 | |
756 | ||
757 | /* MSB one moderate positive and one moderate negative number on a | |
758 | moderate positive total */ | |
759 | TEST_MSB 0x00000000, 0x80000000, 0x00008000, 0xffff0000 | |
760 | ||
761 | /* MSB one moderate positive and one moderate negative number on a | |
762 | large positive total */ | |
763 | TEST_MSB 0x7fffffff, 0x7fffffff, 0x00008000, 0xffff0000 | |
764 | ||
765 | /* MSB one moderate positive and one moderate negative number on a | |
766 | small negative total */ | |
767 | TEST_MSB 0xffffffff, 0xffffffff, 0x00008000, 0xffff0000 | |
768 | ||
769 | /* MSB one moderate positive and one moderate negative number on a | |
770 | moderate negative total */ | |
771 | TEST_MSB 0xfffffffe, 0xffffffff, 0x00008000, 0xffff0000 | |
772 | ||
773 | /* MSB one moderate positive and one moderate negative number on a | |
774 | large negative total */ | |
775 | TEST_MSB 0x80000000, 0x00000000, 0x00008000, 0xffff0000 | |
776 | ||
777 | POP LINK_REGISTER_R9 | |
778 | RETURN_TO_LINK_REGISTER_R9 |