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