1
2# Copyright 1997, 1998 Free Software Foundation, Inc.
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 "am33"
37set srcfile ${srcdir}/${subdir}/${testfile}.s
38set binfile ${objdir}/${subdir}/${testfile}
39if  { [gdb_compile "${srcfile}" "${binfile}" object ""] != "" } {
40     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
41}
42
43proc call_tests { } {
44    global gdb_prompt
45    global hex
46    global decimal
47
48    send_gdb "x/8i call_tests\n"
49    gdb_expect {
50	-re "
51.*call	.*,.a2,a3,exreg0.,9.*
52.*call	.*,.a2,a3,exreg1.,9.*
53.*call	.*,.a2,a3,exother.,9.*
54.*call	.*,.d2,d3,a2,a3,other,exreg0,exreg1,exother.,9.*
55.*call	.*,.a2,a3,exreg0.,9.*
56.*call	.*,.a2,a3,exreg1.,9.*
57.*call	.*,.a2,a3,exother.,9.*
58.*call	.*,.d2,d3,a2,a3,other,exreg0,exreg1,exother.,9.*
59.*$gdb_prompt $" { pass "call tests" }
60	-re "$gdb_prompt $" { fail "call tests" }
61	timeout { fail "(timeout) call tests" }
62    }
63}
64
65proc movm_tests { } {
66    global gdb_prompt
67    global hex
68    global decimal
69
70    send_gdb "x/16i movm_tests\n"
71    gdb_expect {
72	-re "
73.*movm	\\(sp\\),.a2,a3,exreg0.*
74.*movm	\\(sp\\),.a2,a3,exreg1.*
75.*movm	\\(sp\\),.a2,a3,exother.*
76.*movm	\\(sp\\),.d2,d3,a2,a3,other,exreg0,exreg1,exother.*
77.*movm	.a2,a3,exreg0.,\\(sp\\).*
78.*movm	.a2,a3,exreg1.,\\(sp\\).*
79.*movm	.a2,a3,exother.,\\(sp\\).*
80.*movm	.d2,d3,a2,a3,other,exreg0,exreg1,exother.,\\(sp\\).*
81.*movm	\\(usp\\),.a2,a3,exreg0.*
82.*movm	\\(usp\\),.a2,a3,exreg1.*
83.*movm	\\(usp\\),.a2,a3,exother.*
84.*movm	\\(usp\\),.d2,d3,a2,a3,other,exreg0,exreg1,exother.*
85.*movm	.a2,a3,exreg0.,\\(usp\\).*
86.*movm	.a2,a3,exreg1.,\\(usp\\).*
87.*movm	.a2,a3,exother.,\\(usp\\).*
88.*movm	.d2,d3,a2,a3,other,exreg0,exreg1,exother.,\\(usp\\).*
89.*$gdb_prompt $" { pass "movm tests" }
90	-re "$gdb_prompt $" { fail "movm tests" }
91	timeout { fail "(timeout) movm tests" }
92    }
93}
94
95proc misc_tests { } {
96    global gdb_prompt
97    global hex
98    global decimal
99
100    send_gdb "x/11i misc_tests\n"
101    gdb_expect {
102	-re "
103.*syscall	4.*
104.*mcst9	d0.*
105.*mcst48	d1.*
106.*getchx	d0.*
107.*getclx	d1.*
108.*clr	a1.*
109.*sat16	a1,a0.*
110.*mcste	r7,r6.*
111.*swap	r5,r4.*
112.*swaph	r3,r2.*
113.*swhw	r1,r0.*
114.*$gdb_prompt $" { pass "misc tests" }
115	-re "$gdb_prompt $" { fail "misc tests" }
116	timeout { fail "(timeout) misc tests" }
117    }
118}
119
120proc mov_tests { } {
121    global gdb_prompt
122    global hex
123    global decimal
124
125    send_gdb "x/45i mov_tests\n"
126    gdb_expect {
127	-re "
128.*mov	r0,r1.*
129.*mov	sp,r1.*
130.*mov	r1,xr2.*
131.*mov	\\(r1\\),r2.*
132.*mov	r3,\\(r4\\).*
133.*mov	\\(sp\\),r5.*
134.*mov	r6,\\(sp\\).*
135.*mov	16,r1.*
136.*mov	16,xr1.*
137.*mov	\\(16,r1\\),r2.*
138.*mov	r2,\\(16,r1\\).*
139.*mov	\\(16,sp\\),r2.*
140.*mov	r2,\\(16,sp\\).*
141.*mov	2096895,r2.*
142.*mov	2096895,xr2.*
143.*mov	\\(2096895,r1\\),r2.*
144.*mov	r2,\\(2096895,r1\\).*
145.*mov	\\(2096895,sp\\),r2.*
146.*mov	r2,\\(2096895,sp\\).*
147.*mov	\\(0x1ffeff\\),r2.*
148.*mov	r2,\\(0x1ffeff\\).*
149.*mov	2147417596,r2.*
150.*mov	2147417596,xr2.*
151.*mov	\\(2147417596,r1\\),r2.*
152.*mov	r2,\\(2147417596,r1\\).*
153.*mov	\\(2147417596,sp\\),r2.*
154.*mov	r2,\\(2147417596,sp\\).*
155.*mov	\\(0x7ffefdfc\\),r2.*
156.*mov	r2,\\(0x7ffefdfc\\).*
157.*movu	16,r1.*
158.*movu	2096895,r2.*
159.*movu	2147417596,r2.*
160.*mov	usp,a0.*
161.*mov	ssp,a1.*
162.*mov	msp,a2.*
163.*mov	pc,a3.*
164.*mov	a0,usp.*
165.*mov	a1,ssp.*
166.*mov	a2,msp.*
167.*mov	epsw,d0.*
168.*mov	d1,epsw.*
169.*mov	a0,r1.*
170.*mov	d2,r3.*
171.*mov	r5,a1.*
172.*mov	r7,d3.*
173.*$gdb_prompt $" { pass "mov tests" }
174	-re "$gdb_prompt $" { fail "mov tests" }
175	timeout { fail "(timeout) mov tests" }
176    }
177}
178
179proc ext_tests { } {
180    global gdb_prompt
181    global hex
182    global decimal
183
184    send_gdb "x/5i ext_tests\n"
185    gdb_expect {
186	-re "
187.*ext	r2.*
188.*extb	r3,r4.*
189.*extbu	r4,r5.*
190.*exth	r6,r7.*
191.*exthu	r7,a0.*
192.*$gdb_prompt $" { pass "ext tests" }
193	-re "$gdb_prompt $" { fail "ext tests" }
194	timeout { fail "(timeout) ext tests" }
195    }
196}
197
198proc add_tests { } {
199    global gdb_prompt
200    global hex
201    global decimal
202
203    send_gdb "x/11i add_tests\n"
204    gdb_expect {
205	-re "
206.*add	a2,a3.*
207.*add	16,r1.*
208.*add	2096895,r2.*
209.*add	2147417596,r2.*
210.*add	r1,r2,r3.*
211.*addc	d0,d1.*
212.*addc	16,r1.*
213.*addc	2096895,r2.*
214.*addc	2147417596,r2.*
215.*inc	d1.*
216.*inc4	d0.*
217.*$gdb_prompt $" { pass "add tests" }
218	-re "$gdb_prompt $" { fail "add tests" }
219	timeout { fail "(timeout) add tests" }
220    }
221}
222
223proc sub_tests { } {
224    global gdb_prompt
225    global hex
226    global decimal
227
228    send_gdb "x/8i sub_tests\n"
229    gdb_expect {
230	-re "
231.*sub	d2,d3.*
232.*sub	16,r1.*
233.*sub	2096895,r2.*
234.*sub	2147417596,r2.*
235.*subc	d3,d2.*
236.*subc	16,r1.*
237.*subc	2096895,r2.*
238.*subc	2147417596,r2.*
239.*$gdb_prompt $" { pass "sub tests" }
240	-re "$gdb_prompt $" { fail "sub tests" }
241	timeout { fail "(timeout) sub tests" }
242    }
243}
244
245proc cmp_tests { } {
246    global gdb_prompt
247    global hex
248    global decimal
249
250    send_gdb "x/4i cmp_tests\n"
251    gdb_expect {
252	-re "
253.*cmp	a3,a2.*
254.*cmp	16,r1.*
255.*cmp	2096895,r2.*
256.*cmp	2147417596,r2.*
257.*$gdb_prompt $" { pass "cmp tests" }
258	-re "$gdb_prompt $" { fail "cmp tests" }
259	timeout { fail "(timeout) cmp tests" }
260    }
261}
262
263proc logical_tests { } {
264    global gdb_prompt
265    global hex
266    global decimal
267
268    send_gdb "x/15i logical_tests\n"
269    gdb_expect {
270	-re "
271.*and	r0,r1.*
272.*or	r2,r3.*
273.*xor	r4,r5.*
274.*not	r6.*
275.*and	16,r1.*
276.*or	16,r1.*
277.*xor	16,r1.*
278.*and	2096895,r2.*
279.*or	2096895,r2.*
280.*xor	2096895,r2.*
281.*and	2147417596,r2.*
282.*or	2147417596,r2.*
283.*xor	2147417596,r2.*
284.*and	131072,epsw.*
285.*or	65535,epsw.*
286.*$gdb_prompt $" { pass "logical tests" }
287	-re "$gdb_prompt $" { fail "logical tests" }
288	timeout { fail "(timeout) logical tests" }
289    }
290}
291
292proc shift_tests { } {
293    global gdb_prompt
294    global hex
295    global decimal
296
297    send_gdb "x/15i shift_tests\n"
298    gdb_expect {
299	-re "
300.*asr	r7,a0.*
301.*lsr	a1,a2.*
302.*asl	a3,d0.*
303.*asl2	d1.*
304.*ror	d2.*
305.*rol	d3.*
306.*asr	16,r1.*
307.*lsr	16,r1.*
308.*asl	16,r1.*
309.*asr	2096895,r2.*
310.*lsr	2096895,r2.*
311.*asl	2096895,r2.*
312.*asr	2147417596,r2.*
313.*lsr	2147417596,r2.*
314.*asl	2147417596,r2.*
315.*$gdb_prompt $" { pass "shift tests" }
316	-re "$gdb_prompt $" { fail "shift tests" }
317	timeout { fail "(timeout) shift tests" }
318    }
319}
320
321proc muldiv_tests { } {
322    global gdb_prompt
323    global hex
324    global decimal
325
326    send_gdb "x/16i muldiv_tests\n"
327    gdb_expect {
328	-re "
329.*mul	r1,r2.*
330.*mulu	r3,r4.*
331.*mul	16,r1.*
332.*mulu	16,r1.*
333.*mul	2096895,r2.*
334.*mulu	2096895,r2.*
335.*mul	2147417596,r2.*
336.*mulu	2147417596,r2.*
337.*div	r5,r6.*
338.*divu	r7,a0.*
339.*dmulh	d1,d0.*
340.*dmulhu	a3,a2.*
341.*dmulh	2147417596,r2.*
342.*dmulhu	2147417596,r2.*
343.*mul	r1,r2,r3,r4.*
344.*mulu	r1,r2,r3,r4.*
345.*$gdb_prompt $" { pass "muldiv tests" }
346	-re "$gdb_prompt $" { fail "muldiv tests" }
347	timeout { fail "(timeout) muldiv tests" }
348    }
349}
350
351proc 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	\\(r5\\),r6.*
360.*movbu	r7,\\(a0\\).*
361.*movbu	\\(sp\\),r7.*
362.*movbu	a0,\\(sp\\).*
363.*movbu	\\(16,r1\\),r2.*
364.*movbu	r2,\\(16,r1\\).*
365.*movbu	\\(16,sp\\),r2.*
366.*movbu	r2,\\(16,sp\\).*
367.*movbu	\\(2096895,r1\\),r2.*
368.*movbu	r2,\\(2096895,r1\\).*
369.*movbu	\\(2096895,sp\\),r2.*
370.*movbu	r2,\\(2096895,sp\\).*
371.*movbu	\\(0x1ffeff\\),r2.*
372.*movbu	r2,\\(0x1ffeff\\).*
373.*movbu	\\(2147417596,r1\\),r2.*
374.*movbu	r2,\\(2147417596,r1\\).*
375.*movbu	\\(2147417596,sp\\),r2.*
376.*movbu	r2,\\(2147417596,sp\\).*
377.*movbu	\\(0x7ffefdfc\\),r2.*
378.*movbu	r2,\\(0x7ffefdfc\\).*
379.*$gdb_prompt $" { pass "movbu tests" }
380	-re "$gdb_prompt $" { fail "movbu tests" }
381	timeout { fail "(timeout) movbu tests" }
382    }
383}
384
385proc 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	\\(a1\\),a2.*
394.*movhu	a3,\\(d0\\).*
395.*movhu	\\(sp\\),a1.*
396.*movhu	a2,\\(sp\\).*
397.*movhu	\\(16,r1\\),r2.*
398.*movhu	r2,\\(16,r1\\).*
399.*movhu	\\(16,sp\\),r2.*
400.*movhu	r2,\\(16,sp\\).*
401.*movhu	\\(2096895,r1\\),r2.*
402.*movhu	r2,\\(2096895,r1\\).*
403.*movhu	\\(2096895,sp\\),r2.*
404.*movhu	r2,\\(2096895,sp\\).*
405.*movhu	\\(0x1ffeff\\),r2.*
406.*movhu	r2,\\(0x1ffeff\\).*
407.*movhu	\\(2147417596,r1\\),r2.*
408.*movhu	r2,\\(2147417596,r1\\).*
409.*movhu	\\(2147417596,sp\\),r2.*
410.*movhu	r2,\\(2147417596,sp\\).*
411.*movhu	\\(0x7ffefdfc\\),r2.*
412.*movhu	r2,\\(0x7ffefdfc\\).*
413.*$gdb_prompt $" { pass "movhu tests" }
414	-re "$gdb_prompt $" { fail "movhu tests" }
415	timeout { fail "(timeout) movhu tests" }
416    }
417}
418
419proc mac_tests { } {
420    global gdb_prompt
421    global hex
422    global decimal
423
424    send_gdb "x/28i mac_tests\n"
425    gdb_expect {
426	-re "
427.*mac	r1,r2.*
428.*macu	r3,r4.*
429.*macb	r5,r6.*
430.*macbu	r7,a0.*
431.*mach	a1,a2.*
432.*machu	a3,d0.*
433.*dmach	d1,d2.*
434.*dmachu	d3,d2.*
435.*mac	16,r1.*
436.*macu	16,r1.*
437.*macb	16,r1.*
438.*macbu	16,r1.*
439.*mach	16,r1.*
440.*machu	16,r1.*
441.*mac	2096895,r2.*
442.*macu	2096895,r2.*
443.*macb	2096895,r2.*
444.*macbu	2096895,r2.*
445.*mach	2096895,r2.*
446.*machu	2096895,r2.*
447.*mac	2147417596,r2.*
448.*macu	2147417596,r2.*
449.*macb	2147417596,r2.*
450.*macbu	2147417596,r2.*
451.*mach	2147417596,r2.*
452.*machu	2147417596,r2.*
453.*dmach	2147417596,r2.*
454.*dmachu	2147417596,r2.*
455.*$gdb_prompt $" { pass "mac tests" }
456	-re "$gdb_prompt $" { fail "mac tests" }
457	timeout { fail "(timeout) mac tests" }
458    }
459}
460
461proc bit_tests { } {
462    global gdb_prompt
463    global hex
464    global decimal
465
466    send_gdb "x/4i bit_tests\n"
467    gdb_expect {
468	-re "
469.*bsch	r1,r2.*
470.*btst	16,r1.*
471.*btst	2096895,r2.*
472.*btst	2147417596,r2.*
473.*$gdb_prompt $" { pass "bit tests" }
474	-re "$gdb_prompt $" { fail "bit tests" }
475	timeout { fail "(timeout) bit tests" }
476    }
477}
478
479proc dsp_add_tests { } {
480    global gdb_prompt
481    global hex
482    global decimal
483
484    send_gdb "x/28i dsp_add_tests\n"
485    gdb_expect {
486	-re "
487.*add_add	r4,r1,r2,r3.*
488.*add_add	r4,r1,2,r3.*
489.*add_sub	r4,r1,r2,r3.*
490.*add_sub	r4,r1,2,r3.*
491.*add_cmp	r4,r1,r2,r3.*
492.*add_cmp	r4,r1,2,r3.*
493.*add_mov	r4,r1,r2,r3.*
494.*add_mov	r4,r1,2,r3.*
495.*add_asr	r4,r1,r2,r3.*
496.*add_asr	r4,r1,2,r3.*
497.*add_lsr	r4,r1,r2,r3.*
498.*add_lsr	r4,r1,2,r3.*
499.*add_asl	r4,r1,r2,r3.*
500.*add_asl	r4,r1,2,r3.*
501.*add_add	4,r1,r2,r3.*
502.*add_add	4,r1,2,r3.*
503.*add_sub	4,r1,r2,r3.*
504.*add_sub	4,r1,2,r3.*
505.*add_cmp	4,r1,r2,r3.*
506.*add_cmp	4,r1,2,r3.*
507.*add_mov	4,r1,r2,r3.*
508.*add_mov	4,r1,2,r3.*
509.*add_asr	4,r1,r2,r3.*
510.*add_asr	4,r1,2,r3.*
511.*add_lsr	4,r1,r2,r3.*
512.*add_lsr	4,r1,2,r3.*
513.*add_asl	4,r1,r2,r3.*
514.*add_asl	4,r1,2,r3.*
515.*$gdb_prompt $" { pass "dsp_add tests" }
516	-re "$gdb_prompt $" { fail "dsp_add tests" }
517	timeout { fail "(timeout) dsp_add tests" }
518    }
519}
520
521proc dsp_cmp_tests { } {
522    global gdb_prompt
523    global hex
524    global decimal
525
526    send_gdb "x/24i dsp_cmp_tests\n"
527    gdb_expect {
528	-re "
529.*cmp_add	r4,r1,r2,r3.*
530.*cmp_add	r4,r1,2,r3.*
531.*cmp_sub	r4,r1,r2,r3.*
532.*cmp_sub	r4,r1,2,r3.*
533.*cmp_mov	r4,r1,r2,r3.*
534.*cmp_mov	r4,r1,2,r3.*
535.*cmp_asr	r4,r1,r2,r3.*
536.*cmp_asr	r4,r1,2,r3.*
537.*cmp_lsr	r4,r1,r2,r3.*
538.*cmp_lsr	r4,r1,2,r3.*
539.*cmp_asl	r4,r1,r2,r3.*
540.*cmp_asl	r4,r1,2,r3.*
541.*cmp_add	4,r1,r2,r3.*
542.*cmp_add	4,r1,2,r3.*
543.*cmp_sub	4,r1,r2,r3.*
544.*cmp_sub	4,r1,2,r3.*
545.*cmp_mov	4,r1,r2,r3.*
546.*cmp_mov	4,r1,2,r3.*
547.*cmp_asr	4,r1,r2,r3.*
548.*cmp_asr	4,r1,2,r3.*
549.*cmp_lsr	4,r1,r2,r3.*
550.*cmp_lsr	4,r1,2,r3.*
551.*cmp_asl	4,r1,r2,r3.*
552.*cmp_asl	4,r1,2,r3.*
553.*$gdb_prompt $" { pass "dsp_cmp tests" }
554	-re "$gdb_prompt $" { fail "dsp_cmp tests" }
555	timeout { fail "(timeout) dsp_cmp tests" }
556    }
557}
558
559proc dsp_sub_tests { } {
560    global gdb_prompt
561    global hex
562    global decimal
563
564    send_gdb "x/28i dsp_sub_tests\n"
565    gdb_expect {
566	-re "
567.*sub_add	r4,r1,r2,r3.*
568.*sub_add	r4,r1,2,r3.*
569.*sub_sub	r4,r1,r2,r3.*
570.*sub_sub	r4,r1,2,r3.*
571.*sub_cmp	r4,r1,r2,r3.*
572.*sub_cmp	r4,r1,2,r3.*
573.*sub_mov	r4,r1,r2,r3.*
574.*sub_mov	r4,r1,2,r3.*
575.*sub_asr	r4,r1,r2,r3.*
576.*sub_asr	r4,r1,2,r3.*
577.*sub_lsr	r4,r1,r2,r3.*
578.*sub_lsr	r4,r1,2,r3.*
579.*sub_asl	r4,r1,r2,r3.*
580.*sub_asl	r4,r1,2,r3.*
581.*sub_add	4,r1,r2,r3.*
582.*sub_add	4,r1,2,r3.*
583.*sub_sub	4,r1,r2,r3.*
584.*sub_sub	4,r1,2,r3.*
585.*sub_cmp	4,r1,r2,r3.*
586.*sub_cmp	4,r1,2,r3.*
587.*sub_mov	4,r1,r2,r3.*
588.*sub_mov	4,r1,2,r3.*
589.*sub_asr	4,r1,r2,r3.*
590.*sub_asr	4,r1,2,r3.*
591.*sub_lsr	4,r1,r2,r3.*
592.*sub_lsr	4,r1,2,r3.*
593.*sub_asl	4,r1,r2,r3.*
594.*sub_asl	4,r1,2,r3.*
595.*$gdb_prompt $" { pass "dsp_sub tests" }
596	-re "$gdb_prompt $" { fail "dsp_sub tests" }
597	timeout { fail "(timeout) dsp_sub tests" }
598    }
599}
600
601proc dsp_mov_tests { } {
602    global gdb_prompt
603    global hex
604    global decimal
605
606    send_gdb "x/28i dsp_mov_tests\n"
607    gdb_expect {
608	-re "
609.*mov_add	r4,r1,r2,r3.*
610.*mov_add	r4,r1,2,r3.*
611.*mov_sub	r4,r1,r2,r3.*
612.*mov_sub	r4,r1,2,r3.*
613.*mov_cmp	r4,r1,r2,r3.*
614.*mov_cmp	r4,r1,2,r3.*
615.*mov_mov	r4,r1,r2,r3.*
616.*mov_mov	r4,r1,2,r3.*
617.*mov_asr	r4,r1,r2,r3.*
618.*mov_asr	r4,r1,2,r3.*
619.*mov_lsr	r4,r1,r2,r3.*
620.*mov_lsr	r4,r1,2,r3.*
621.*mov_asl	r4,r1,r2,r3.*
622.*mov_asl	r4,r1,2,r3.*
623.*mov_add	4,r1,r2,r3.*
624.*mov_add	4,r1,2,r3.*
625.*mov_sub	4,r1,r2,r3.*
626.*mov_sub	4,r1,2,r3.*
627.*mov_cmp	4,r1,r2,r3.*
628.*mov_cmp	4,r1,2,r3.*
629.*mov_mov	4,r1,r2,r3.*
630.*mov_mov	4,r1,2,r3.*
631.*mov_asr	4,r1,r2,r3.*
632.*mov_asr	4,r1,2,r3.*
633.*mov_lsr	4,r1,r2,r3.*
634.*mov_lsr	4,r1,2,r3.*
635.*mov_asl	4,r1,r2,r3.*
636.*mov_asl	4,r1,2,r3.*
637.*$gdb_prompt $" { pass "dsp_mov tests" }
638	-re "$gdb_prompt $" { fail "dsp_mov tests" }
639	timeout { fail "(timeout) dsp_mov tests" }
640    }
641}
642
643proc dsp_logical_tests { } {
644    global gdb_prompt
645    global hex
646    global decimal
647
648    send_gdb "x/42i dsp_logical_tests\n"
649    gdb_expect {
650	-re "
651.*and_add	r4,r1,r2,r3.*
652.*and_add	r4,r1,2,r3.*
653.*and_sub	r4,r1,r2,r3.*
654.*and_sub	r4,r1,2,r3.*
655.*and_cmp	r4,r1,r2,r3.*
656.*and_cmp	r4,r1,2,r3.*
657.*and_mov	r4,r1,r2,r3.*
658.*and_mov	r4,r1,2,r3.*
659.*and_asr	r4,r1,r2,r3.*
660.*and_asr	r4,r1,2,r3.*
661.*and_lsr	r4,r1,r2,r3.*
662.*and_lsr	r4,r1,2,r3.*
663.*and_asl	r4,r1,r2,r3.*
664.*and_asl	r4,r1,2,r3.*
665.*xor_add	r4,r1,r2,r3.*
666.*xor_add	r4,r1,2,r3.*
667.*xor_sub	r4,r1,r2,r3.*
668.*xor_sub	r4,r1,2,r3.*
669.*xor_cmp	r4,r1,r2,r3.*
670.*xor_cmp	r4,r1,2,r3.*
671.*xor_mov	r4,r1,r2,r3.*
672.*xor_mov	r4,r1,2,r3.*
673.*xor_asr	r4,r1,r2,r3.*
674.*xor_asr	r4,r1,2,r3.*
675.*xor_lsr	r4,r1,r2,r3.*
676.*xor_lsr	r4,r1,2,r3.*
677.*xor_asl	r4,r1,r2,r3.*
678.*xor_asl	r4,r1,2,r3.*
679.*or_add	r4,r1,r2,r3.*
680.*or_add	r4,r1,2,r3.*
681.*or_sub	r4,r1,r2,r3.*
682.*or_sub	r4,r1,2,r3.*
683.*or_cmp	r4,r1,r2,r3.*
684.*or_cmp	r4,r1,2,r3.*
685.*or_mov	r4,r1,r2,r3.*
686.*or_mov	r4,r1,2,r3.*
687.*or_asr	r4,r1,r2,r3.*
688.*or_asr	r4,r1,2,r3.*
689.*or_lsr	r4,r1,r2,r3.*
690.*or_lsr	r4,r1,2,r3.*
691.*or_asl	r4,r1,r2,r3.*
692.*or_asl	r4,r1,2,r3.*
693.*$gdb_prompt $" { pass "dsp_logical tests" }
694	-re "$gdb_prompt $" { fail "dsp_logical tests" }
695	timeout { fail "(timeout) dsp_logical tests" }
696    }
697}
698
699proc dsp_misc_tests { } {
700    global gdb_prompt
701    global hex
702    global decimal
703
704    send_gdb "x/42i dsp_misc_tests\n"
705    gdb_expect {
706	-re "
707.*dmach_add	r4,r1,r2,r3.*
708.*dmach_add	r4,r1,2,r3.*
709.*dmach_sub	r4,r1,r2,r3.*
710.*dmach_sub	r4,r1,2,r3.*
711.*dmach_cmp	r4,r1,r2,r3.*
712.*dmach_cmp	r4,r1,2,r3.*
713.*dmach_mov	r4,r1,r2,r3.*
714.*dmach_mov	r4,r1,2,r3.*
715.*dmach_asr	r4,r1,r2,r3.*
716.*dmach_asr	r4,r1,2,r3.*
717.*dmach_lsr	r4,r1,r2,r3.*
718.*dmach_lsr	r4,r1,2,r3.*
719.*dmach_asl	r4,r1,r2,r3.*
720.*dmach_asl	r4,r1,2,r3.*
721.*swhw_add	r4,r1,r2,r3.*
722.*swhw_add	r4,r1,2,r3.*
723.*swhw_sub	r4,r1,r2,r3.*
724.*swhw_sub	r4,r1,2,r3.*
725.*swhw_cmp	r4,r1,r2,r3.*
726.*swhw_cmp	r4,r1,2,r3.*
727.*swhw_mov	r4,r1,r2,r3.*
728.*swhw_mov	r4,r1,2,r3.*
729.*swhw_asr	r4,r1,r2,r3.*
730.*swhw_asr	r4,r1,2,r3.*
731.*swhw_lsr	r4,r1,r2,r3.*
732.*swhw_lsr	r4,r1,2,r3.*
733.*swhw_asl	r4,r1,r2,r3.*
734.*swhw_asl	r4,r1,2,r3.*
735.*sat16_add	r4,r1,r2,r3.*
736.*sat16_add	r4,r1,2,r3.*
737.*sat16_sub	r4,r1,r2,r3.*
738.*sat16_sub	r4,r1,2,r3.*
739.*sat16_cmp	r4,r1,r2,r3.*
740.*sat16_cmp	r4,r1,2,r3.*
741.*sat16_mov	r4,r1,r2,r3.*
742.*sat16_mov	r4,r1,2,r3.*
743.*sat16_asr	r4,r1,r2,r3.*
744.*sat16_asr	r4,r1,2,r3.*
745.*sat16_lsr	r4,r1,r2,r3.*
746.*sat16_lsr	r4,r1,2,r3.*
747.*sat16_asl	r4,r1,r2,r3.*
748.*sat16_asl	r4,r1,2,r3.*
749.*$gdb_prompt $" { pass "dsp_misc tests" }
750	-re "$gdb_prompt $" { fail "dsp_misc tests" }
751	timeout { fail "(timeout) dsp_misc tests" }
752    }
753}
754
755proc autoincrement_tests { } {
756    global gdb_prompt
757    global hex
758    global decimal
759
760    send_gdb "x/16i autoincrement_tests\n"
761    gdb_expect {
762	-re "
763.*mov	\\(r1\\+\\),r2.*
764.*mov	r3,\\(r4\\+\\).*
765.*movhu	\\(r6\\+\\),r7.*
766.*movhu	a0,\\(a1\\+\\).*
767.*mov	\\(r1\\+,64\\),r2.*
768.*mov	r1,\\(r2\\+,64\\).*
769.*movhu	\\(r1\\+,64\\),r2.*
770.*movhu	r1,\\(r2\\+,64\\).*
771.*mov	\\(r1\\+,131055\\),r2.*
772.*mov	r1,\\(r2\\+,131055\\).*
773.*movhu	\\(r1\\+,131055\\),r2.*
774.*movhu	r1,\\(r2\\+,131055\\).*
775.*mov	\\(r1\\+,2147417596\\),r2.*
776.*mov	r1,\\(r2\\+,2147417596\\).*
777.*movhu	\\(r1\\+,2147417596\\),r2.*
778.*movhu	r1,\\(r2\\+,2147417596\\).*
779.*$gdb_prompt $" { pass "autoincrement tests" }
780	-re "$gdb_prompt $" { fail "autoincrement tests" }
781	timeout { fail "(timeout) autoincrement tests" }
782    }
783}
784
785proc dsp_autoincrement_tests { } {
786    global gdb_prompt
787    global hex
788    global decimal
789
790    send_gdb "x/11i dsp_autoincrement_tests\n"
791    gdb_expect {
792	-re "
793.*mov_llt	\\(r1\\+,4\\),r2.*
794.*mov_lgt	\\(r1\\+,4\\),r2.*
795.*mov_lge	\\(r1\\+,4\\),r2.*
796.*mov_lle	\\(r1\\+,4\\),r2.*
797.*mov_lcs	\\(r1\\+,4\\),r2.*
798.*mov_lhi	\\(r1\\+,4\\),r2.*
799.*mov_lcc	\\(r1\\+,4\\),r2.*
800.*mov_lls	\\(r1\\+,4\\),r2.*
801.*mov_leq	\\(r1\\+,4\\),r2.*
802.*mov_lne	\\(r1\\+,4\\),r2.*
803.*mov_lra	\\(r1\\+,4\\),r2.*
804.*$gdb_prompt $" { pass "autoincrement tests" }
805	-re "$gdb_prompt $" { fail "autoincrement tests" }
806	timeout { fail "(timeout) autoincrement tests" }
807    }
808}
809
810# Start with a fresh gdb.
811
812gdb_exit
813gdb_start
814gdb_reinitialize_dir $srcdir/$subdir
815gdb_load $binfile
816
817call_tests
818movm_tests
819misc_tests
820mov_tests
821ext_tests
822add_tests
823sub_tests
824cmp_tests
825logical_tests
826shift_tests
827muldiv_tests
828movbu_tests
829movhu_tests
830mac_tests
831bit_tests
832dsp_add_tests
833dsp_cmp_tests
834dsp_sub_tests
835dsp_mov_tests
836dsp_logical_tests
837autoincrement_tests
838dsp_autoincrement_tests
839