1 # Copyright (C) 2000, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16 # This file was written by Kazu Hirata. (kazu@hxi.com)
22 if ![istarget "h8300*-*-*"] {
23 verbose "Tests ignored for all but h8300s based targets."
29 set srcfile ${srcdir}/${subdir}/${testfile}.s
30 set binfile ${objdir}/${subdir}/${testfile}
31 if { [gdb_compile "${srcfile}" "${binfile}" executable {debug additional_flags=-ms}] != "" } {
36 proc all_set_machine_h8300s { } {
41 send_gdb "set machine h8300s\n"
43 -re "$gdb_prompt $" {}
47 proc all_movb_tests { } {
52 send_gdb "x/9i movb_tests\n"
58 .*mov.b\t@\\(0x1234:16,er0\\),r2l.*
59 .*mov.b\t@\\(0x12345678:32,er0\\),r2h.*
60 .*mov.b\t@er0\\+,r3l.*
61 .*mov.b\t@0x12:8,r3h.*
62 .*mov.b\t@0x1234:16,r4l.*
63 .*mov.b\t@0x12345678:32,r4h.*
64 .*$gdb_prompt $" { pass "movb_tests" }
65 -re "$gdb_prompt $" { fail "movb_tests" }
66 timeout { fail "(timeout) movb_tests" }
70 proc all_movw_tests { } {
75 send_gdb "x/8i movw_tests\n"
81 .*mov.w\t@\\(0x1234:16,er0\\),r3.*
82 .*mov.w\t@\\(0x12345678:32,er0\\),r4.*
84 .*mov.w\t@0x1234:16,r6.*
85 .*mov.w\t@0x12345678:32,r7.*
86 .*$gdb_prompt $" { pass "movw_tests" }
87 -re "$gdb_prompt $" { fail "movw_tests" }
88 timeout { fail "(timeout) movw_tests" }
92 proc all_movl_tests { } {
97 send_gdb "x/8i movl_tests\n"
101 .*mov.l\t#0x12345678,er1.*
103 .*mov.l\t@\\(0x1234:16,er0\\),er3.*
104 .*mov.l\t@\\(0x12345678:32,er0\\),er4.*
105 .*mov.l\t@er0\\+,er5.*
106 .*mov.l\t@0x1234:16,er6.*
107 .*mov.l\t@0x12345678:32,er7.*
108 .*$gdb_prompt $" { pass "movl_tests" }
109 -re "$gdb_prompt $" { fail "movl_tests" }
110 timeout { fail "(timeout) movl_tests" }
114 proc all_ldm_stm_tests { } {
119 send_gdb "x/6i ldm_stm_tests\n"
122 .*ldm.l\t@sp\\+,er0-er1.*
123 .*ldm.l\t@sp\\+,er0-er2.*
124 .*ldm.l\t@sp\\+,er0-er3.*
125 .*stm.l\ter0\\-er1,@-sp.*
126 .*stm.l\ter0\\-er2,@-sp.*
127 .*stm.l\ter0\\-er3,@-sp.*
128 .*$gdb_prompt $" { pass "ldm_stm_tests" }
129 -re "$gdb_prompt $" { fail "ldm_stm_tests" }
130 timeout { fail "(timeout) ldm_stm_tests" }
134 proc all_movfpe_movtpe_tests { } {
139 send_gdb "x/2i movfpe_movtpe_tests\n"
142 .*movfpe\t@0x1234:16,r2l.*
143 .*movtpe\tr2l,@0x1234:16.*
144 .*$gdb_prompt $" { pass "movfpe_movtpe_tests" }
145 -re "$gdb_prompt $" { fail "movfpe_movtpe_tests" }
146 timeout { fail "(timeout) movfpe_movtpe_tests" }
150 proc all_add_sub_addx_subx_tests { } {
155 send_gdb "x/15i add_sub_addx_subx_tests\n"
160 .*add.w\t#0x1234,r2.*
162 .*add.l\t#0x12345678,er5.*
165 .*sub.w\t#0x1234,r2.*
167 .*sub.l\t#0x12345678,er5.*
173 .*$gdb_prompt $" { pass "add_sub_addx_subx_tests" }
174 -re "$gdb_prompt $" { fail "add_sub_addx_subx_tests" }
175 timeout { fail "(timeout) add_sub_addx_subx_tests" }
179 proc all_inc_dec_adds_subs_tests { } {
184 send_gdb "x/16i inc_dec_adds_subs_tests\n"
188 .*inc.w\t#(0x|)1,r4.*
189 .*inc.w\t#(0x|)2,r3.*
190 .*inc.l\t#(0x|)1,er2.*
191 .*inc.l\t#(0x|)2,er1.*
193 .*dec.w\t#(0x|)1,r4.*
194 .*dec.w\t#(0x|)2,r3.*
195 .*dec.l\t#(0x|)1,er2.*
196 .*dec.l\t#(0x|)2,er1.*
197 .*adds\t#(0x|)1,er7.*
198 .*adds\t#(0x|)2,er6.*
199 .*adds\t#(0x|)4,er5.*
200 .*subs\t#(0x|)1,er7.*
201 .*subs\t#(0x|)2,er6.*
202 .*subs\t#(0x|)4,er5.*
203 .*$gdb_prompt $" { pass "inc_dec_adds_subs_tests" }
204 -re "$gdb_prompt $" { fail "inc_dec_adds_subs_tests" }
205 timeout { fail "(timeout) inc_dec_adds_subs_tests" }
209 proc all_daa_das_tests { } {
214 send_gdb "x/2i daa_das_tests\n"
219 .*$gdb_prompt $" { pass "daa_das_tests" }
220 -re "$gdb_prompt $" { fail "daa_das_tests" }
221 timeout { fail "(timeout) daa_das_tests" }
225 proc all_mul_div_tests { } {
230 send_gdb "x/8i mul_div_tests\n"
241 .*$gdb_prompt $" { pass "mul_div_tests" }
242 -re "$gdb_prompt $" { fail "mul_div_tests" }
243 timeout { fail "(timeout) mul_div_tests" }
247 proc all_cmp_tests { } {
252 send_gdb "x/8i cmp_tests\n"
257 .*cmp.w\t#0x1234,r2.*
259 .*cmp.l\t#0x12345678,er4.*
261 .*$gdb_prompt $" { pass "cmp_tests" }
262 -re "$gdb_prompt $" { fail "cmp_tests" }
263 timeout { fail "(timeout) cmp_tests" }
267 proc all_neg_tests { } {
272 send_gdb "x/3i neg_tests\n"
278 .*$gdb_prompt $" { pass "neg_tests" }
279 -re "$gdb_prompt $" { fail "neg_tests" }
280 timeout { fail "(timeout) neg_tests" }
284 proc all_ext_tests { } {
289 send_gdb "x/4i ext_tests\n"
296 .*$gdb_prompt $" { pass "ext_tests" }
297 -re "$gdb_prompt $" { fail "ext_tests" }
298 timeout { fail "(timeout) ext_tests" }
302 proc all_tas_mac_tests { } {
307 send_gdb "x/7i tas_mac_tests\n"
311 .*mac\t@er1\\+,@er2\\+.*
317 .*$gdb_prompt $" { pass "tas_mac_tests" }
318 -re "$gdb_prompt $" { fail "tas_mac_tests" }
319 timeout { fail "(timeout) tas_mac_tests" }
323 proc all_logic_operations_tests { } {
328 send_gdb "x/21i logic_operations_tests\n"
333 .*and.w\t#0x1234,r0.*
335 .*and.l\t#0x12345678,er0.*
341 .*or.l\t#0x12345678,er0.*
343 .*xor(.b|)\t#0x12,r0l.*
344 .*xor(.b|)\tr1l,r2h.*
345 .*xor.w\t#0x1234,r0.*
347 .*xor.l\t#0x12345678,er0.*
352 .*$gdb_prompt $" { pass "logic_operations_tests" }
353 -re "$gdb_prompt $" { fail "logic_operations_tests" }
354 timeout { fail "(timeout) logic_operations_tests" }
358 proc all_sha_shl_tests { } {
363 send_gdb "x/12i sha_shl_tests\n"
378 .*$gdb_prompt $" { pass "sha_shl_tests" }
379 -re "$gdb_prompt $" { fail "sha_shl_tests" }
380 timeout { fail "(timeout) sha_shl_tests" }
384 proc all_rot_rotx_tests { } {
389 send_gdb "x/12i rot_rotx_tests\n"
404 .*$gdb_prompt $" { pass "rot_rotx_tests" }
405 -re "$gdb_prompt $" { fail "rot_rotx_tests" }
406 timeout { fail "(timeout) rot_rotx_tests" }
410 proc all_bset_bclr_tests { } {
415 send_gdb "x/20i bset_bclr_tests\n"
420 .*bset\t#0x5,@0x12:8.*
421 .*bset\t#0x4,@0x1234:16.*
422 .*bset\t#0x3,@0x12345678:32.*
425 .*bset\tr5l,@0x12:8.*
426 .*bset\tr4l,@0x1234:16.*
427 .*bset\tr3l,@0x12345678:32.*
430 .*bclr\t#0x5,@0x12:8.*
431 .*bclr\t#0x4,@0x1234:16.*
432 .*bclr\t#0x3,@0x12345678:32.*
435 .*bclr\tr5h,@0x12:8.*
436 .*bclr\tr4h,@0x1234:16.*
437 .*bclr\tr3h,@0x12345678:32.*
438 .*$gdb_prompt $" { pass "bset_bclr_tests" }
439 -re "$gdb_prompt $" { fail "bset_bclr_tests" }
440 timeout { fail "(timeout) bset_bclr_tests" }
444 proc all_bnot_btst_tests { } {
449 send_gdb "x/20i bnot_btst_tests\n"
454 .*bnot\t#0x5,@0x12:8.*
455 .*bnot\t#0x4,@0x1234:16.*
456 .*bnot\t#0x3,@0x12345678:32.*
459 .*bnot\tr5l,@0x12:8.*
460 .*bnot\tr4l,@0x1234:16.*
461 .*bnot\tr3l,@0x12345678:32.*
464 .*btst\t#0x5,@0x12:8.*
465 .*btst\t#0x4,@0x1234:16.*
466 .*btst\t#0x3,@0x12345678:32.*
469 .*btst\tr5h,@0x12:8.*
470 .*btst\tr4h,@0x1234:16.*
471 .*btst\tr3h,@0x12345678:32.*
472 .*$gdb_prompt $" { pass "bnot_btst_tests" }
473 -re "$gdb_prompt $" { fail "bnot_btst_tests" }
474 timeout { fail "(timeout) bnot_btst_tests" }
478 proc all_band_bor_bxor_tests { } {
483 send_gdb "x/15i band_bor_bxor_tests\n"
488 .*band\t#0x5,@0x12:8.*
489 .*band\t#0x4,@0x1234:16.*
490 .*band\t#0x3,@0x12345678:32.*
493 .*bor\t#0x5,@0x12:8.*
494 .*bor\t#0x4,@0x1234:16.*
495 .*bor\t#0x3,@0x12345678:32.*
498 .*bxor\t#0x5,@0x12:8.*
499 .*bxor\t#0x4,@0x1234:16.*
500 .*bxor\t#0x3,@0x12345678:32.*
501 .*$gdb_prompt $" { pass "band_bor_bxor_tests" }
502 -re "$gdb_prompt $" { fail "band_bor_bxor_tests" }
503 timeout { fail "(timeout) band_bor_bxor_tests" }
507 proc all_bld_bst_tests { } {
512 send_gdb "x/20i bld_bst_tests\n"
517 .*bld\t#0x5,@0x12:8.*
518 .*bld\t#0x4,@0x1234:16.*
519 .*bld\t#0x3,@0x12345678:32.*
522 .*bild\t#0x5,@0x12:8.*
523 .*bild\t#0x4,@0x1234:16.*
524 .*bild\t#0x3,@0x12345678:32.*
527 .*bst\t#0x5,@0x12:8.*
528 .*bst\t#0x4,@0x1234:16.*
529 .*bst\t#0x3,@0x12345678:32.*
532 .*bist\t#0x5,@0x12:8.*
533 .*bist\t#0x4,@0x1234:16.*
534 .*bist\t#0x3,@0x12345678:32.*
535 .*$gdb_prompt $" { pass "bld_bst_tests" }
536 -re "$gdb_prompt $" { fail "bld_bst_tests" }
537 timeout { fail "(timeout) bld_bst_tests" }
541 proc all_branch_tests { } {
546 send_gdb "x/25i branch_tests\n"
549 .*bra\t(branch_tests|.-2 ).*
550 .*brn\t(branch_tests|.-4 ).*
551 .*bhi\t(branch_tests|.-6 ).*
552 .*bls\t(branch_tests|.-8 ).*
553 .*bcc\t(branch_tests|.-10 ).*
554 .*bcs\t(branch_tests|.-12 ).*
555 .*bne\t(branch_tests|.-14 ).*
556 .*beq\t(branch_tests|.-16 ).*
557 .*bvc\t(branch_tests|.-18 ).*
558 .*bvs\t(branch_tests|.-20 ).*
559 .*bpl\t(branch_tests|.-22 ).*
560 .*bmi\t(branch_tests|.-24 ).*
561 .*bge\t(branch_tests|.-26 ).*
562 .*blt\t(branch_tests|.-28 ).*
563 .*bgt\t(branch_tests|.-30 ).*
564 .*ble\t(branch_tests|.-32 ).*
566 .*jmp\t@(branch_tests|0x).*
567 .*jmp\t@@0 \\((0x|)0\\).*
568 .*bsr\t(branch_tests|.-42 ).*
569 .*bsr\t(branch_tests|.-46 ).*
571 .*jsr\t@(branch_tests|0x).*
572 .*jsr\t@@0 \\((0x|)0\\).*
574 .*$gdb_prompt $" { pass "branch_tests" }
575 -re "$gdb_prompt $" { fail "branch_tests" }
576 timeout { fail "(timeout) branch_tests" }
580 proc all_system_control_tests { } {
585 send_gdb "x/40i system_control_tests\n"
594 .*ldc\t@\\(0x1234:16,er0\\),ccr.*
595 .*ldc\t@\\(0x12345678:32,er0\\),ccr.*
597 .*ldc\t@0x1234:16,ccr.*
598 .*ldc\t@0x12345678:32,ccr.*
601 .*stc\tccr,@\\(0x1234:16,er0\\).*
602 .*stc\tccr,@\\(0x12345678:32,er0\\).*
604 .*stc\tccr,@0x1234:16.*
605 .*stc\tccr,@0x12345678:32.*
612 .*ldc\t@\\(0x1234:16,er0\\),exr.*
613 .*ldc\t@\\(0x12345678:32,er0\\),exr.*
615 .*ldc\t@0x1234:16,exr.*
616 .*ldc\t@0x12345678:32,exr.*
619 .*stc\texr,@\\(0x1234:16,er0\\).*
620 .*stc\texr,@\\(0x12345678:32,er0\\).*
622 .*stc\texr,@0x1234:16.*
623 .*stc\texr,@0x12345678:32.*
628 .*$gdb_prompt $" { pass "system_control_tests" }
629 -re "$gdb_prompt $" { fail "system_control_tests" }
630 timeout { fail "(timeout) system_control_tests" }
634 proc all_block_data_transfer_tests { } {
639 send_gdb "x/2i block_data_transfer_tests\n"
644 .*$gdb_prompt $" { pass "block_data_transfer_tests" }
645 -re "$gdb_prompt $" { fail "block_data_transfer_tests" }
646 timeout { fail "(timeout) block_data_transfer_tests" }
652 gdb_reinitialize_dir $srcdir/$subdir
653 all_set_machine_h8300s
661 all_movfpe_movtpe_tests
663 # Arithmetic operations
664 all_add_sub_addx_subx_tests
665 all_inc_dec_adds_subs_tests
674 all_logic_operations_tests
683 all_band_bor_bxor_tests
690 all_system_control_tests
692 # Block data transfer
693 all_block_data_transfer_tests