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."
31 set srcfile ${srcdir}/${subdir}/${testfile}.s
32 set binfile ${objdir}/${subdir}/${testfile}
33 if { [gdb_compile "${srcfile}" "${binfile}" executable {debug additional_flags=-ms}] != "" } {
38 proc all_set_machine_h8300s { } {
43 send_gdb "set machine h8300s\n"
45 -re "$gdb_prompt $" {}
49 proc all_movb_tests { } {
54 send_gdb "x/9i movb_tests\n"
60 .*mov.b\t@\\(0x1234:16,er0\\),r2l.*
61 .*mov.b\t@\\(0x12345678:32,er0\\),r2h.*
62 .*mov.b\t@er0\\+,r3l.*
63 .*mov.b\t@0x12:8,r3h.*
64 .*mov.b\t@0x1234:16,r4l.*
65 .*mov.b\t@0x12345678:32,r4h.*
66 .*$gdb_prompt $" { pass "movb_tests" }
67 -re "$gdb_prompt $" { fail "movb_tests" }
68 timeout { fail "(timeout) movb_tests" }
72 proc all_movw_tests { } {
77 send_gdb "x/8i movw_tests\n"
83 .*mov.w\t@\\(0x1234:16,er0\\),r3.*
84 .*mov.w\t@\\(0x12345678:32,er0\\),r4.*
86 .*mov.w\t@0x1234:16,r6.*
87 .*mov.w\t@0x12345678:32,r7.*
88 .*$gdb_prompt $" { pass "movw_tests" }
89 -re "$gdb_prompt $" { fail "movw_tests" }
90 timeout { fail "(timeout) movw_tests" }
94 proc all_movl_tests { } {
99 send_gdb "x/8i movl_tests\n"
103 .*mov.l\t#0x12345678,er1.*
105 .*mov.l\t@\\(0x1234:16,er0\\),er3.*
106 .*mov.l\t@\\(0x12345678:32,er0\\),er4.*
107 .*mov.l\t@er0\\+,er5.*
108 .*mov.l\t@0x1234:16,er6.*
109 .*mov.l\t@0x12345678:32,er7.*
110 .*$gdb_prompt $" { pass "movl_tests" }
111 -re "$gdb_prompt $" { fail "movl_tests" }
112 timeout { fail "(timeout) movl_tests" }
116 proc all_ldm_stm_tests { } {
121 send_gdb "x/6i ldm_stm_tests\n"
124 .*ldm.l\t@sp\\+,er0-er1.*
125 .*ldm.l\t@sp\\+,er0-er2.*
126 .*ldm.l\t@sp\\+,er0-er3.*
127 .*stm.l\ter0\\-er1,@-sp.*
128 .*stm.l\ter0\\-er2,@-sp.*
129 .*stm.l\ter0\\-er3,@-sp.*
130 .*$gdb_prompt $" { pass "ldm_stm_tests" }
131 -re "$gdb_prompt $" { fail "ldm_stm_tests" }
132 timeout { fail "(timeout) ldm_stm_tests" }
136 proc all_movfpe_movtpe_tests { } {
141 send_gdb "x/2i movfpe_movtpe_tests\n"
144 .*movfpe\t@0x1234:16,r2l.*
145 .*movtpe\tr2l,@0x1234:16.*
146 .*$gdb_prompt $" { pass "movfpe_movtpe_tests" }
147 -re "$gdb_prompt $" { fail "movfpe_movtpe_tests" }
148 timeout { fail "(timeout) movfpe_movtpe_tests" }
152 proc all_add_sub_addx_subx_tests { } {
157 send_gdb "x/15i add_sub_addx_subx_tests\n"
162 .*add.w\t#0x1234,r2.*
164 .*add.l\t#0x12345678,er5.*
167 .*sub.w\t#0x1234,r2.*
169 .*sub.l\t#0x12345678,er5.*
175 .*$gdb_prompt $" { pass "add_sub_addx_subx_tests" }
176 -re "$gdb_prompt $" { fail "add_sub_addx_subx_tests" }
177 timeout { fail "(timeout) add_sub_addx_subx_tests" }
181 proc all_inc_dec_adds_subs_tests { } {
186 send_gdb "x/16i inc_dec_adds_subs_tests\n"
190 .*inc.w\t#(0x|)1,r4.*
191 .*inc.w\t#(0x|)2,r3.*
192 .*inc.l\t#(0x|)1,er2.*
193 .*inc.l\t#(0x|)2,er1.*
195 .*dec.w\t#(0x|)1,r4.*
196 .*dec.w\t#(0x|)2,r3.*
197 .*dec.l\t#(0x|)1,er2.*
198 .*dec.l\t#(0x|)2,er1.*
199 .*adds\t#(0x|)1,er7.*
200 .*adds\t#(0x|)2,er6.*
201 .*adds\t#(0x|)4,er5.*
202 .*subs\t#(0x|)1,er7.*
203 .*subs\t#(0x|)2,er6.*
204 .*subs\t#(0x|)4,er5.*
205 .*$gdb_prompt $" { pass "inc_dec_adds_subs_tests" }
206 -re "$gdb_prompt $" { fail "inc_dec_adds_subs_tests" }
207 timeout { fail "(timeout) inc_dec_adds_subs_tests" }
211 proc all_daa_das_tests { } {
216 send_gdb "x/2i daa_das_tests\n"
221 .*$gdb_prompt $" { pass "daa_das_tests" }
222 -re "$gdb_prompt $" { fail "daa_das_tests" }
223 timeout { fail "(timeout) daa_das_tests" }
227 proc all_mul_div_tests { } {
232 send_gdb "x/8i mul_div_tests\n"
243 .*$gdb_prompt $" { pass "mul_div_tests" }
244 -re "$gdb_prompt $" { fail "mul_div_tests" }
245 timeout { fail "(timeout) mul_div_tests" }
249 proc all_cmp_tests { } {
254 send_gdb "x/8i cmp_tests\n"
259 .*cmp.w\t#0x1234,r2.*
261 .*cmp.l\t#0x12345678,er4.*
263 .*$gdb_prompt $" { pass "cmp_tests" }
264 -re "$gdb_prompt $" { fail "cmp_tests" }
265 timeout { fail "(timeout) cmp_tests" }
269 proc all_neg_tests { } {
274 send_gdb "x/3i neg_tests\n"
280 .*$gdb_prompt $" { pass "neg_tests" }
281 -re "$gdb_prompt $" { fail "neg_tests" }
282 timeout { fail "(timeout) neg_tests" }
286 proc all_ext_tests { } {
291 send_gdb "x/4i ext_tests\n"
298 .*$gdb_prompt $" { pass "ext_tests" }
299 -re "$gdb_prompt $" { fail "ext_tests" }
300 timeout { fail "(timeout) ext_tests" }
304 proc all_tas_mac_tests { } {
309 send_gdb "x/7i tas_mac_tests\n"
313 .*mac\t@er1\\+,@er2\\+.*
319 .*$gdb_prompt $" { pass "tas_mac_tests" }
320 -re "$gdb_prompt $" { fail "tas_mac_tests" }
321 timeout { fail "(timeout) tas_mac_tests" }
325 proc all_logic_operations_tests { } {
330 send_gdb "x/21i logic_operations_tests\n"
335 .*and.w\t#0x1234,r0.*
337 .*and.l\t#0x12345678,er0.*
343 .*or.l\t#0x12345678,er0.*
345 .*xor(.b|)\t#0x12,r0l.*
346 .*xor(.b|)\tr1l,r2h.*
347 .*xor.w\t#0x1234,r0.*
349 .*xor.l\t#0x12345678,er0.*
354 .*$gdb_prompt $" { pass "logic_operations_tests" }
355 -re "$gdb_prompt $" { fail "logic_operations_tests" }
356 timeout { fail "(timeout) logic_operations_tests" }
360 proc all_sha_shl_tests { } {
365 send_gdb "x/12i sha_shl_tests\n"
380 .*$gdb_prompt $" { pass "sha_shl_tests" }
381 -re "$gdb_prompt $" { fail "sha_shl_tests" }
382 timeout { fail "(timeout) sha_shl_tests" }
386 proc all_rot_rotx_tests { } {
391 send_gdb "x/12i rot_rotx_tests\n"
406 .*$gdb_prompt $" { pass "rot_rotx_tests" }
407 -re "$gdb_prompt $" { fail "rot_rotx_tests" }
408 timeout { fail "(timeout) rot_rotx_tests" }
412 proc all_bset_bclr_tests { } {
417 send_gdb "x/20i bset_bclr_tests\n"
422 .*bset\t#0x5,@0x12:8.*
423 .*bset\t#0x4,@0x1234:16.*
424 .*bset\t#0x3,@0x12345678:32.*
427 .*bset\tr5l,@0x12:8.*
428 .*bset\tr4l,@0x1234:16.*
429 .*bset\tr3l,@0x12345678:32.*
432 .*bclr\t#0x5,@0x12:8.*
433 .*bclr\t#0x4,@0x1234:16.*
434 .*bclr\t#0x3,@0x12345678:32.*
437 .*bclr\tr5h,@0x12:8.*
438 .*bclr\tr4h,@0x1234:16.*
439 .*bclr\tr3h,@0x12345678:32.*
440 .*$gdb_prompt $" { pass "bset_bclr_tests" }
441 -re "$gdb_prompt $" { fail "bset_bclr_tests" }
442 timeout { fail "(timeout) bset_bclr_tests" }
446 proc all_bnot_btst_tests { } {
451 send_gdb "x/20i bnot_btst_tests\n"
456 .*bnot\t#0x5,@0x12:8.*
457 .*bnot\t#0x4,@0x1234:16.*
458 .*bnot\t#0x3,@0x12345678:32.*
461 .*bnot\tr5l,@0x12:8.*
462 .*bnot\tr4l,@0x1234:16.*
463 .*bnot\tr3l,@0x12345678:32.*
466 .*btst\t#0x5,@0x12:8.*
467 .*btst\t#0x4,@0x1234:16.*
468 .*btst\t#0x3,@0x12345678:32.*
471 .*btst\tr5h,@0x12:8.*
472 .*btst\tr4h,@0x1234:16.*
473 .*btst\tr3h,@0x12345678:32.*
474 .*$gdb_prompt $" { pass "bnot_btst_tests" }
475 -re "$gdb_prompt $" { fail "bnot_btst_tests" }
476 timeout { fail "(timeout) bnot_btst_tests" }
480 proc all_band_bor_bxor_tests { } {
485 send_gdb "x/15i band_bor_bxor_tests\n"
490 .*band\t#0x5,@0x12:8.*
491 .*band\t#0x4,@0x1234:16.*
492 .*band\t#0x3,@0x12345678:32.*
495 .*bor\t#0x5,@0x12:8.*
496 .*bor\t#0x4,@0x1234:16.*
497 .*bor\t#0x3,@0x12345678:32.*
500 .*bxor\t#0x5,@0x12:8.*
501 .*bxor\t#0x4,@0x1234:16.*
502 .*bxor\t#0x3,@0x12345678:32.*
503 .*$gdb_prompt $" { pass "band_bor_bxor_tests" }
504 -re "$gdb_prompt $" { fail "band_bor_bxor_tests" }
505 timeout { fail "(timeout) band_bor_bxor_tests" }
509 proc all_bld_bst_tests { } {
514 send_gdb "x/20i bld_bst_tests\n"
519 .*bld\t#0x5,@0x12:8.*
520 .*bld\t#0x4,@0x1234:16.*
521 .*bld\t#0x3,@0x12345678:32.*
524 .*bild\t#0x5,@0x12:8.*
525 .*bild\t#0x4,@0x1234:16.*
526 .*bild\t#0x3,@0x12345678:32.*
529 .*bst\t#0x5,@0x12:8.*
530 .*bst\t#0x4,@0x1234:16.*
531 .*bst\t#0x3,@0x12345678:32.*
534 .*bist\t#0x5,@0x12:8.*
535 .*bist\t#0x4,@0x1234:16.*
536 .*bist\t#0x3,@0x12345678:32.*
537 .*$gdb_prompt $" { pass "bld_bst_tests" }
538 -re "$gdb_prompt $" { fail "bld_bst_tests" }
539 timeout { fail "(timeout) bld_bst_tests" }
543 proc all_branch_tests { } {
548 send_gdb "x/25i branch_tests\n"
551 .*bra\t(branch_tests|.-2 ).*
552 .*brn\t(branch_tests|.-4 ).*
553 .*bhi\t(branch_tests|.-6 ).*
554 .*bls\t(branch_tests|.-8 ).*
555 .*bcc\t(branch_tests|.-10 ).*
556 .*bcs\t(branch_tests|.-12 ).*
557 .*bne\t(branch_tests|.-14 ).*
558 .*beq\t(branch_tests|.-16 ).*
559 .*bvc\t(branch_tests|.-18 ).*
560 .*bvs\t(branch_tests|.-20 ).*
561 .*bpl\t(branch_tests|.-22 ).*
562 .*bmi\t(branch_tests|.-24 ).*
563 .*bge\t(branch_tests|.-26 ).*
564 .*blt\t(branch_tests|.-28 ).*
565 .*bgt\t(branch_tests|.-30 ).*
566 .*ble\t(branch_tests|.-32 ).*
568 .*jmp\t@(branch_tests|0x).*
569 .*jmp\t@@0 \\((0x|)0\\).*
570 .*bsr\t(branch_tests|.-42 ).*
571 .*bsr\t(branch_tests|.-46 ).*
573 .*jsr\t@(branch_tests|0x).*
574 .*jsr\t@@0 \\((0x|)0\\).*
576 .*$gdb_prompt $" { pass "branch_tests" }
577 -re "$gdb_prompt $" { fail "branch_tests" }
578 timeout { fail "(timeout) branch_tests" }
582 proc all_system_control_tests { } {
587 send_gdb "x/40i system_control_tests\n"
596 .*ldc\t@\\(0x1234:16,er0\\),ccr.*
597 .*ldc\t@\\(0x12345678:32,er0\\),ccr.*
599 .*ldc\t@0x1234:16,ccr.*
600 .*ldc\t@0x12345678:32,ccr.*
603 .*stc\tccr,@\\(0x1234:16,er0\\).*
604 .*stc\tccr,@\\(0x12345678:32,er0\\).*
606 .*stc\tccr,@0x1234:16.*
607 .*stc\tccr,@0x12345678:32.*
614 .*ldc\t@\\(0x1234:16,er0\\),exr.*
615 .*ldc\t@\\(0x12345678:32,er0\\),exr.*
617 .*ldc\t@0x1234:16,exr.*
618 .*ldc\t@0x12345678:32,exr.*
621 .*stc\texr,@\\(0x1234:16,er0\\).*
622 .*stc\texr,@\\(0x12345678:32,er0\\).*
624 .*stc\texr,@0x1234:16.*
625 .*stc\texr,@0x12345678:32.*
630 .*$gdb_prompt $" { pass "system_control_tests" }
631 -re "$gdb_prompt $" { fail "system_control_tests" }
632 timeout { fail "(timeout) system_control_tests" }
636 proc all_block_data_transfer_tests { } {
641 send_gdb "x/2i block_data_transfer_tests\n"
646 .*$gdb_prompt $" { pass "block_data_transfer_tests" }
647 -re "$gdb_prompt $" { fail "block_data_transfer_tests" }
648 timeout { fail "(timeout) block_data_transfer_tests" }
654 gdb_reinitialize_dir $srcdir/$subdir
655 all_set_machine_h8300s
663 all_movfpe_movtpe_tests
665 # Arithmetic operations
666 all_add_sub_addx_subx_tests
667 all_inc_dec_adds_subs_tests
676 all_logic_operations_tests
685 all_band_bor_bxor_tests
692 all_system_control_tests
694 # Block data transfer
695 all_block_data_transfer_tests