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