]>
Commit | Line | Data |
---|---|---|
c906108c | 1 | |
1d506c26 | 2 | # Copyright 1997-2024 Free Software Foundation, Inc. |
c906108c SS |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
c906108c | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
c906108c SS |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
c906108c | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
c906108c | 16 | |
c906108c SS |
17 | # This file was written by Jeff Law. (law@cygnus.com) |
18 | ||
73c06197 | 19 | require {istarget "mn10300*-*-*"} |
c906108c SS |
20 | |
21 | global exec_output | |
c906108c SS |
22 | |
23 | set testfile "mn10300" | |
24 | set srcfile ${srcdir}/${subdir}/${testfile}.s | |
25 | set binfile ${objdir}/${subdir}/${testfile} | |
26 | if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } { | |
84c93cd5 | 27 | untested "failed to compile" |
b60f0898 | 28 | return -1 |
c906108c SS |
29 | } |
30 | ||
31 | proc add_tests { } { | |
32 | global gdb_prompt | |
33 | global hex | |
34 | global decimal | |
35 | ||
36 | send_gdb "x/14i add_tests\n" | |
37 | gdb_expect { | |
38 | -re " | |
39 | .*add d1,d2.* | |
40 | .*add d2,a3.* | |
41 | .*add a3,a2.* | |
42 | .*add a2,d1.* | |
43 | .*add 16,d1.* | |
44 | .*add 256,d2.* | |
45 | .*add 131071,d3.* | |
46 | .*add 16,a1.* | |
47 | .*add 256,a2.* | |
48 | .*add 131071,a3.* | |
49 | .*add 16,sp.* | |
50 | .*add 256,sp.* | |
51 | .*add 131071,sp.* | |
52 | .*addc d1,d2.* | |
53 | .*$gdb_prompt $" { pass "add tests" } | |
54 | -re "$gdb_prompt $" { fail "add tests" } | |
55 | timeout { fail "(timeout) add tests" } | |
56 | } | |
57 | } | |
58 | ||
59 | proc bcc_tests { } { | |
60 | global gdb_prompt | |
61 | global hex | |
62 | global decimal | |
63 | ||
64 | send_gdb "x/15i bCC_tests\n" | |
65 | gdb_expect { | |
66 | -re " | |
67 | .*beq 0x\[0-9a-f]+ <bCC_tests>.* | |
68 | .*bne 0x\[0-9a-f]+ <bCC_tests>.* | |
69 | .*bgt 0x\[0-9a-f]+ <bCC_tests>.* | |
70 | .*bge 0x\[0-9a-f]+ <bCC_tests>.* | |
71 | .*ble 0x\[0-9a-f]+ <bCC_tests>.* | |
72 | .*blt 0x\[0-9a-f]+ <bCC_tests>.* | |
73 | .*bhi 0x\[0-9a-f]+ <bCC_tests>.* | |
74 | .*bcc 0x\[0-9a-f]+ <bCC_tests>.* | |
75 | .*bls 0x\[0-9a-f]+ <bCC_tests>.* | |
76 | .*bcs 0x\[0-9a-f]+ <bCC_tests>.* | |
77 | .*bvc 0x\[0-9a-f]+ <bCC_tests>.* | |
78 | .*bvs 0x\[0-9a-f]+ <bCC_tests>.* | |
79 | .*bnc 0x\[0-9a-f]+ <bCC_tests>.* | |
80 | .*bns 0x\[0-9a-f]+ <bCC_tests>.* | |
81 | .*bra 0x\[0-9a-f]+ <bCC_tests>.* | |
82 | .*$gdb_prompt $" { pass "bCC tests" } | |
83 | -re "$gdb_prompt $" { fail "bCC tests" } | |
84 | timeout { fail "(timeout) bCC tests" } | |
85 | } | |
86 | } | |
87 | ||
88 | proc bit_tests { } { | |
89 | global gdb_prompt | |
90 | global hex | |
91 | global decimal | |
92 | ||
93 | send_gdb "x/11i bit_tests\n" | |
94 | gdb_expect { | |
95 | -re " | |
96 | .*btst 64,d1.* | |
97 | .*btst 8192,d2.* | |
98 | .*btst 131071,d3.* | |
99 | .*btst 64,\\(8,a1\\).* | |
100 | .*btst 64,\\(0x1ffff\\).* | |
101 | .*bset d1,\\(a2\\).* | |
102 | .*bset 64,\\(8,a1\\).* | |
103 | .*bset 64,\\(0x1ffff\\).* | |
104 | .*bclr d1,\\(a2\\).* | |
105 | .*bclr 64,\\(8,a1\\).* | |
106 | .*bclr 64,\\(0x1ffff\\).* | |
107 | .*$gdb_prompt $" { pass "bit tests" } | |
108 | -re "$gdb_prompt $" { fail "bit tests" } | |
109 | timeout { fail "(timeout) bit tests" } | |
110 | } | |
111 | } | |
112 | ||
113 | proc cmp_tests { } { | |
114 | global gdb_prompt | |
115 | global hex | |
116 | global decimal | |
117 | ||
118 | send_gdb "x/10i cmp_tests\n" | |
119 | gdb_expect { | |
120 | -re " | |
121 | .*cmp d1,d2.* | |
122 | .*cmp d2,a3.* | |
123 | .*cmp a3,d3.* | |
124 | .*cmp a3,a2.* | |
125 | .*cmp 16,d3.* | |
126 | .*cmp 256,d2.* | |
127 | .*cmp 131071,d1.* | |
128 | .*cmp 16,a3.* | |
129 | .*cmp 256,a2.* | |
130 | .*cmp 131071,a1.* | |
131 | .*$gdb_prompt $" { pass "cmp tests" } | |
132 | -re "$gdb_prompt $" { fail "cmp tests" } | |
133 | timeout { fail "(timeout) cmp tests" } | |
134 | } | |
135 | } | |
136 | ||
137 | proc extend_tests { } { | |
138 | global gdb_prompt | |
139 | global hex | |
140 | global decimal | |
141 | ||
142 | send_gdb "x/5i extend_tests\n" | |
143 | gdb_expect { | |
144 | -re " | |
145 | .*ext d1.* | |
146 | .*extb d2.* | |
147 | .*extbu d3.* | |
148 | .*exth d2.* | |
149 | .*exthu d1.* | |
150 | .*$gdb_prompt $" { pass "extend tests" } | |
151 | -re "$gdb_prompt $" { fail "extend tests" } | |
152 | timeout { fail "(timeout) extend tests" } | |
153 | } | |
154 | } | |
155 | ||
156 | proc extended_tests { } { | |
157 | global gdb_prompt | |
158 | global hex | |
159 | global decimal | |
160 | ||
161 | send_gdb "x/13i extended_tests\n" | |
162 | gdb_expect { | |
163 | -re " | |
164 | .*putx d1.* | |
165 | .*getx d2.* | |
166 | .*mulq d1,d2.* | |
167 | .*mulq 16,d2.* | |
168 | .*mulq 256,d3.* | |
169 | .*mulq 131071,d3.* | |
170 | .*mulqu d1,d2.* | |
171 | .*mulqu 16,d2.* | |
172 | .*mulqu 256,d3.* | |
173 | .*mulqu 131071,d3.* | |
174 | .*sat16 d2,d3.* | |
175 | .*sat24 d3,d2.* | |
176 | .*bsch d1,d2.* | |
177 | .*$gdb_prompt $" { pass "extended tests" } | |
178 | -re "$gdb_prompt $" { fail "extended tests" } | |
179 | timeout { fail "(timeout) extended tests" } | |
180 | } | |
181 | } | |
182 | ||
183 | proc logical_tests { } { | |
184 | global gdb_prompt | |
185 | global hex | |
186 | global decimal | |
187 | ||
188 | send_gdb "x/14i logical_tests\n" | |
189 | gdb_expect { | |
190 | -re " | |
191 | .*and d1,d2.* | |
192 | .*and 127,d2.* | |
193 | .*and 32767,d3.* | |
194 | .*and 131071,d3.* | |
195 | .*and 32767,psw.* | |
196 | .*or d1,d2.* | |
197 | .*or 127,d2.* | |
198 | .*or 32767,d3.* | |
199 | .*or 131071,d3.* | |
200 | .*or 32767,psw.* | |
201 | .*xor d1,d2.* | |
202 | .*xor 32767,d3.* | |
203 | .*xor 131071,d3.* | |
204 | .*not d3.* | |
205 | .*$gdb_prompt $" { pass "logical tests" } | |
206 | -re "$gdb_prompt $" { fail "logical tests" } | |
207 | timeout { fail "(timeout) logical tests" } | |
208 | } | |
209 | } | |
210 | ||
211 | proc loop_tests { } { | |
212 | global gdb_prompt | |
213 | global hex | |
214 | global decimal | |
215 | ||
216 | send_gdb "x/12i loop_tests\n" | |
217 | gdb_expect { | |
218 | -re " | |
219 | .*leq.* | |
220 | .*lne.* | |
221 | .*lgt.* | |
222 | .*lge.* | |
223 | .*lle.* | |
224 | .*llt.* | |
225 | .*lhi.* | |
226 | .*lcc.* | |
227 | .*lls.* | |
228 | .*lcs.* | |
229 | .*lra.* | |
230 | .*setlb.* | |
231 | .*$gdb_prompt $" { pass "loop tests" } | |
232 | -re "$gdb_prompt $" { fail "loop tests" } | |
233 | timeout { fail "(timeout) loop tests" } | |
234 | } | |
235 | } | |
236 | ||
237 | proc mov_tests_1 { } { | |
238 | global gdb_prompt | |
239 | global hex | |
240 | global decimal | |
241 | ||
242 | send_gdb "x/16i mov_tests_1\n" | |
243 | gdb_expect { | |
244 | -re " | |
245 | .*mov d1,d2.* | |
246 | .*mov d1,a2.* | |
247 | .*mov a2,d1.* | |
248 | .*mov a2,a1.* | |
249 | .*mov sp,a2.* | |
250 | .*mov a1,sp.* | |
251 | .*mov d2,psw.* | |
252 | .*mov mdr,d1.* | |
253 | .*mov d2,mdr.* | |
254 | .*mov \\(a2\\),d1.* | |
255 | .*mov \\(8,a2\\),d1.* | |
256 | .*mov \\(256,a2\\),d1.* | |
257 | .*mov \\(131071,a2\\),d1.* | |
258 | .*mov \\(8,sp\\),d1.* | |
259 | .*mov \\(256,sp\\),d1.* | |
260 | .*mov psw,d3.* | |
261 | .*$gdb_prompt $" { pass "mov1 tests" } | |
262 | -re "$gdb_prompt $" { fail "mov1 tests" } | |
263 | timeout { fail "(timeout) mov1 tests" } | |
264 | } | |
265 | } | |
266 | ||
267 | proc mov_tests_2 { } { | |
268 | global gdb_prompt | |
269 | global hex | |
270 | global decimal | |
271 | ||
272 | send_gdb "x/15i mov_tests_2\n" | |
273 | gdb_expect { | |
274 | -re " | |
275 | .*mov \\(131071,sp\\),d1.* | |
276 | .*mov \\(d1,a1\\),d2.* | |
277 | .*mov \\(0x8000.*\\),d1.* | |
278 | .*mov \\(0x1ffff.*\\),d1.* | |
279 | .*mov \\(a2\\),a1.* | |
280 | .*mov \\(8,a2\\),a1.* | |
281 | .*mov \\(256,a2\\),a1.* | |
282 | .*mov \\(131071,a2\\),a1.* | |
283 | .*mov \\(8,sp\\),a1.* | |
284 | .*mov \\(256,sp\\),a1.* | |
285 | .*mov \\(131071,sp\\),a1.* | |
286 | .*mov \\(d1,a1\\),a2.* | |
287 | .*mov \\(0x8000.*\\),a1.* | |
288 | .*mov \\(0x1ffff.*\\),a1.* | |
289 | .*mov \\(32,a1\\),sp.* | |
290 | .*$gdb_prompt $" { pass "mov2 tests" } | |
291 | -re "$gdb_prompt $" { fail "mov2 tests" } | |
292 | timeout { fail "(timeout) mov2 tests" } | |
293 | } | |
294 | } | |
295 | ||
296 | proc mov_tests_3 { } { | |
297 | global gdb_prompt | |
298 | global hex | |
299 | global decimal | |
300 | ||
301 | send_gdb "x/15i mov_tests_3\n" | |
302 | gdb_expect { | |
303 | -re " | |
304 | .*mov d1,\\(a2\\).* | |
305 | .*mov d1,\\(32,a2\\).* | |
306 | .*mov d1,\\(256,a2\\).* | |
307 | .*mov d1,\\(131071,a2\\).* | |
308 | .*mov d1,\\(32,sp\\).* | |
309 | .*mov d1,\\(32768,sp\\).* | |
310 | .*mov d1,\\(131071,sp\\).* | |
311 | .*mov d1,\\(d2,a2\\).* | |
312 | .*mov d1,\\(0x80.*\\).* | |
313 | .*mov d1,\\(0x1ffff.*\\).* | |
314 | .*mov a1,\\(a2\\).* | |
315 | .*mov a1,\\(32,a2\\).* | |
316 | .*mov a1,\\(256,a2\\).* | |
317 | .*mov a1,\\(131071,a2\\).* | |
318 | .*mov a1,\\(32,sp\\).* | |
319 | .*$gdb_prompt $" { pass "mov3 tests" } | |
320 | -re "$gdb_prompt $" { fail "mov3 tests" } | |
321 | timeout { fail "(timeout) mov3 tests" } | |
322 | } | |
323 | } | |
324 | ||
325 | proc mov_tests_4 { } { | |
326 | global gdb_prompt | |
327 | global hex | |
328 | global decimal | |
329 | ||
330 | send_gdb "x/12i mov_tests_4\n" | |
331 | gdb_expect { | |
332 | -re " | |
333 | .*mov a1,\\(32768,sp\\).* | |
334 | .*mov a1,\\(131071,sp\\).* | |
335 | .*mov a1,\\(d2,a2\\).* | |
336 | .*mov a1,\\(0x80.*\\).* | |
337 | .*mov a1,\\(0x1ffff.*\\).* | |
338 | .*mov sp,\\(32,a1\\).* | |
339 | .*mov 8,d1.* | |
340 | .*mov 256,d1.* | |
341 | .*mov 131071,d1.* | |
342 | .*mov 8,a1.* | |
343 | .*mov 256,a1.* | |
344 | .*mov 131071,a1.* | |
345 | .*$gdb_prompt $" { pass "mov4 tests" } | |
346 | -re "$gdb_prompt $" { fail "mov4 tests" } | |
347 | timeout { fail "(timeout) mov4 tests" } | |
348 | } | |
349 | } | |
350 | ||
351 | proc movbu_tests { } { | |
352 | global gdb_prompt | |
353 | global hex | |
354 | global decimal | |
355 | ||
356 | send_gdb "x/20i movbu_tests\n" | |
357 | gdb_expect { | |
358 | -re " | |
359 | .*movbu \\(a2\\),d1.* | |
360 | .*movbu \\(8,a2\\),d1.* | |
361 | .*movbu \\(256,a2\\),d1.* | |
362 | .*movbu \\(131071,a2\\),d1.* | |
363 | .*movbu \\(8,sp\\),d1.* | |
364 | .*movbu \\(256,sp\\),d1.* | |
365 | .*movbu \\(131071,sp\\),d1.* | |
366 | .*movbu \\(d1,a1\\),d2.* | |
367 | .*movbu \\(0x8000.*\\),d1.* | |
368 | .*movbu \\(0x1ffff.*\\),d1.* | |
369 | .*movbu d1,\\(a2\\).* | |
370 | .*movbu d1,\\(32,a2\\).* | |
371 | .*movbu d1,\\(256,a2\\).* | |
372 | .*movbu d1,\\(131071,a2\\).* | |
373 | .*movbu d1,\\(32,sp\\).* | |
374 | .*movbu d1,\\(32768,sp\\).* | |
375 | .*movbu d1,\\(131071,sp\\).* | |
376 | .*movbu d1,\\(d2,a2\\).* | |
377 | .*movbu d1,\\(0x80.*\\).* | |
378 | .*movbu d1,\\(0x1ffff.*\\).* | |
379 | .*$gdb_prompt $" { pass "movbu tests" } | |
380 | -re "$gdb_prompt $" { fail "movbu tests" } | |
381 | timeout { fail "(timeout) movbu tests" } | |
382 | } | |
383 | } | |
384 | ||
385 | proc movhu_tests { } { | |
386 | global gdb_prompt | |
387 | global hex | |
388 | global decimal | |
389 | ||
390 | send_gdb "x/20i movhu_tests\n" | |
391 | gdb_expect { | |
392 | -re " | |
393 | .*movhu \\(a2\\),d1.* | |
394 | .*movhu \\(8,a2\\),d1.* | |
395 | .*movhu \\(256,a2\\),d1.* | |
396 | .*movhu \\(131071,a2\\),d1.* | |
397 | .*movhu \\(8,sp\\),d1.* | |
398 | .*movhu \\(256,sp\\),d1.* | |
399 | .*movhu \\(131071,sp\\),d1.* | |
400 | .*movhu \\(d1,a1\\),d2.* | |
401 | .*movhu \\(0x8000.*\\),d1.* | |
402 | .*movhu \\(0x1ffff.*\\),d1.* | |
403 | .*movhu d1,\\(a2\\).* | |
404 | .*movhu d1,\\(32,a2\\).* | |
405 | .*movhu d1,\\(256,a2\\).* | |
406 | .*movhu d1,\\(131071,a2\\).* | |
407 | .*movhu d1,\\(32,sp\\).* | |
408 | .*movhu d1,\\(32768,sp\\).* | |
409 | .*movhu d1,\\(131071,sp\\).* | |
410 | .*movhu d1,\\(d2,a2\\).* | |
411 | .*movhu d1,\\(0x80.*\\).* | |
412 | .*movhu d1,\\(0x1ffff.*\\).* | |
413 | .*$gdb_prompt $" { pass "movhu tests" } | |
414 | -re "$gdb_prompt $" { fail "movhu tests" } | |
415 | timeout { fail "(timeout) movhu tests" } | |
416 | } | |
417 | } | |
418 | ||
419 | proc movm_tests { } { | |
420 | global gdb_prompt | |
421 | global hex | |
422 | global decimal | |
423 | ||
424 | send_gdb "x/4i movm_tests\n" | |
425 | gdb_expect { | |
426 | -re " | |
427 | .*movm \\(sp\\),.a2,a3..* | |
428 | .*movm \\(sp\\),.d2,d3,a2,a3,other..* | |
429 | .*movm .a2,a3.,\\(sp\\).* | |
430 | .*movm .d2,d3,a2,a3,other.,\\(sp\\).* | |
431 | .*$gdb_prompt $" { pass "movm tests" } | |
432 | -re "$gdb_prompt $" { fail "movm tests" } | |
433 | timeout { fail "(timeout) movm tests" } | |
434 | } | |
435 | } | |
436 | ||
437 | proc muldiv_tests { } { | |
438 | global gdb_prompt | |
439 | global hex | |
440 | global decimal | |
441 | ||
442 | send_gdb "x/4i muldiv_tests\n" | |
443 | gdb_expect { | |
444 | -re " | |
445 | .*mul d1,d2.* | |
446 | .*mulu d2,d3.* | |
447 | .*div d3,d3.* | |
448 | .*divu d3,d2.* | |
449 | .*$gdb_prompt $" { pass "muldiv tests" } | |
450 | -re "$gdb_prompt $" { fail "muldiv tests" } | |
451 | timeout { fail "(timeout) muldiv tests" } | |
452 | } | |
453 | } | |
454 | ||
455 | proc other_tests { } { | |
456 | global gdb_prompt | |
457 | global hex | |
458 | global decimal | |
459 | ||
460 | send_gdb "x/19i other_tests\n" | |
461 | gdb_expect { | |
462 | -re " | |
463 | .*clr d2.* | |
464 | .*inc d1.* | |
465 | .*inc a2.* | |
466 | .*inc4 a3.* | |
467 | .*jmp \\(a2\\).* | |
468 | .*jmp 0x\[0-9a-f]+ <main>.* | |
469 | .*jmp 0x\[0-9a-f]+ <start>.* | |
470 | .*call 0x\[0-9a-f]+ <main>,.a2,a3.,9.* | |
471 | .*call 0x\[0-9a-f]+ <start>,.a2,a3.,32.* | |
472 | .*calls \\(a2\\).* | |
473 | .*calls 0x\[0-9a-f]+ <main>.* | |
474 | .*calls 0x\[0-9a-f]+ <start>.* | |
475 | .*ret .a2,a3.,7.* | |
476 | .*retf .a2,a3.,5.* | |
477 | .*rets.* | |
478 | .*rti.* | |
479 | .*trap.* | |
480 | .*nop.* | |
481 | .*rtm.* | |
482 | .*$gdb_prompt $" { pass "other tests" } | |
483 | -re "$gdb_prompt $" { fail "other tests" } | |
484 | timeout { fail "(timeout) other tests" } | |
485 | } | |
486 | } | |
487 | ||
488 | proc shift_tests { } { | |
489 | global gdb_prompt | |
490 | global hex | |
491 | global decimal | |
492 | ||
493 | send_gdb "x/9i shift_tests\n" | |
494 | gdb_expect { | |
495 | -re " | |
496 | .*asr d1,d2.* | |
497 | .*asr 4,d2.* | |
498 | .*lsr d2,d3.* | |
499 | .*lsr 4,d3.* | |
500 | .*asl d3,d2.* | |
501 | .*asl 4,d2.* | |
502 | .*asl2 d2.* | |
503 | .*ror d1.* | |
504 | .*rol d2.* | |
505 | .*$gdb_prompt $" { pass "shift tests" } | |
506 | -re "$gdb_prompt $" { fail "shift tests" } | |
507 | timeout { fail "(timeout) shift tests" } | |
508 | } | |
509 | } | |
510 | ||
511 | proc sub_tests { } { | |
512 | global gdb_prompt | |
513 | global hex | |
514 | global decimal | |
515 | ||
516 | send_gdb "x/7i sub_tests\n" | |
517 | gdb_expect { | |
518 | -re " | |
519 | .*sub d1,d2.* | |
520 | .*sub d2,a3.* | |
521 | .*sub a3,d3.* | |
522 | .*sub a3,a2.* | |
523 | .*sub 131071,d2.* | |
524 | .*sub 131071,a1.* | |
525 | .*subc d1,d2.* | |
526 | .*$gdb_prompt $" { pass "sub tests" } | |
527 | -re "$gdb_prompt $" { fail "sub tests" } | |
528 | timeout { fail "(timeout) sub tests" } | |
529 | } | |
530 | } | |
531 | ||
eefe81b5 | 532 | clean_restart $binfile |
c906108c SS |
533 | |
534 | add_tests | |
535 | bcc_tests | |
536 | bit_tests | |
537 | cmp_tests | |
538 | extend_tests | |
539 | extended_tests | |
540 | logical_tests | |
541 | loop_tests | |
542 | mov_tests_1 | |
543 | mov_tests_2 | |
544 | mov_tests_3 | |
545 | mov_tests_4 | |
546 | movbu_tests | |
547 | movhu_tests | |
548 | movm_tests | |
549 | muldiv_tests | |
550 | other_tests | |
551 | shift_tests | |
552 | sub_tests |