1 # Copyright (C) 2000-2019 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)
18 if ![istarget "h8300*-*-*"] {
19 verbose "Tests ignored for all but h8300s based targets."
25 set srcfile ${srcdir}/${subdir}/${testfile}.s
26 set binfile ${objdir}/${subdir}/${testfile}
27 if { [gdb_compile "${srcfile}" "${binfile}" executable {debug additional_flags=-ms}] != "" } {
28 untested "failed to compile"
32 proc all_set_machine_h8300s { } {
37 send_gdb "set machine h8300s\n"
39 -re "$gdb_prompt $" {}
43 proc all_movb_tests { } {
48 send_gdb "x/9i movb_tests\n"
54 .*mov.b\t@\\(0x1234:16,er0\\),r2l.*
55 .*mov.b\t@\\(0x12345678:32,er0\\),r2h.*
56 .*mov.b\t@er0\\+,r3l.*
57 .*mov.b\t@0x12:8,r3h.*
58 .*mov.b\t@0x1234:16,r4l.*
59 .*mov.b\t@0x12345678:32,r4h.*
60 .*$gdb_prompt $" { pass "movb_tests" }
61 -re "$gdb_prompt $" { fail "movb_tests" }
62 timeout { fail "(timeout) movb_tests" }
66 proc all_movw_tests { } {
71 send_gdb "x/8i movw_tests\n"
77 .*mov.w\t@\\(0x1234:16,er0\\),r3.*
78 .*mov.w\t@\\(0x12345678:32,er0\\),r4.*
80 .*mov.w\t@0x1234:16,r6.*
81 .*mov.w\t@0x12345678:32,r7.*
82 .*$gdb_prompt $" { pass "movw_tests" }
83 -re "$gdb_prompt $" { fail "movw_tests" }
84 timeout { fail "(timeout) movw_tests" }
88 proc all_movl_tests { } {
93 send_gdb "x/8i movl_tests\n"
97 .*mov.l\t#0x12345678,er1.*
99 .*mov.l\t@\\(0x1234:16,er0\\),er3.*
100 .*mov.l\t@\\(0x12345678:32,er0\\),er4.*
101 .*mov.l\t@er0\\+,er5.*
102 .*mov.l\t@0x1234:16,er6.*
103 .*mov.l\t@0x12345678:32,er7.*
104 .*$gdb_prompt $" { pass "movl_tests" }
105 -re "$gdb_prompt $" { fail "movl_tests" }
106 timeout { fail "(timeout) movl_tests" }
110 proc all_ldm_stm_tests { } {
115 send_gdb "x/6i ldm_stm_tests\n"
118 .*ldm.l\t@sp\\+,er0-er1.*
119 .*ldm.l\t@sp\\+,er0-er2.*
120 .*ldm.l\t@sp\\+,er0-er3.*
121 .*stm.l\ter0\\-er1,@-sp.*
122 .*stm.l\ter0\\-er2,@-sp.*
123 .*stm.l\ter0\\-er3,@-sp.*
124 .*$gdb_prompt $" { pass "ldm_stm_tests" }
125 -re "$gdb_prompt $" { fail "ldm_stm_tests" }
126 timeout { fail "(timeout) ldm_stm_tests" }
130 proc all_movfpe_movtpe_tests { } {
135 send_gdb "x/2i movfpe_movtpe_tests\n"
138 .*movfpe\t@0x1234:16,r2l.*
139 .*movtpe\tr2l,@0x1234:16.*
140 .*$gdb_prompt $" { pass "movfpe_movtpe_tests" }
141 -re "$gdb_prompt $" { fail "movfpe_movtpe_tests" }
142 timeout { fail "(timeout) movfpe_movtpe_tests" }
146 proc all_add_sub_addx_subx_tests { } {
151 send_gdb "x/15i add_sub_addx_subx_tests\n"
156 .*add.w\t#0x1234,r2.*
158 .*add.l\t#0x12345678,er5.*
161 .*sub.w\t#0x1234,r2.*
163 .*sub.l\t#0x12345678,er5.*
169 .*$gdb_prompt $" { pass "add_sub_addx_subx_tests" }
170 -re "$gdb_prompt $" { fail "add_sub_addx_subx_tests" }
171 timeout { fail "(timeout) add_sub_addx_subx_tests" }
175 proc all_inc_dec_adds_subs_tests { } {
180 send_gdb "x/16i inc_dec_adds_subs_tests\n"
184 .*inc.w\t#(0x|)1,r4.*
185 .*inc.w\t#(0x|)2,r3.*
186 .*inc.l\t#(0x|)1,er2.*
187 .*inc.l\t#(0x|)2,er1.*
189 .*dec.w\t#(0x|)1,r4.*
190 .*dec.w\t#(0x|)2,r3.*
191 .*dec.l\t#(0x|)1,er2.*
192 .*dec.l\t#(0x|)2,er1.*
193 .*adds\t#(0x|)1,er7.*
194 .*adds\t#(0x|)2,er6.*
195 .*adds\t#(0x|)4,er5.*
196 .*subs\t#(0x|)1,er7.*
197 .*subs\t#(0x|)2,er6.*
198 .*subs\t#(0x|)4,er5.*
199 .*$gdb_prompt $" { pass "inc_dec_adds_subs_tests" }
200 -re "$gdb_prompt $" { fail "inc_dec_adds_subs_tests" }
201 timeout { fail "(timeout) inc_dec_adds_subs_tests" }
205 proc all_daa_das_tests { } {
210 send_gdb "x/2i daa_das_tests\n"
215 .*$gdb_prompt $" { pass "daa_das_tests" }
216 -re "$gdb_prompt $" { fail "daa_das_tests" }
217 timeout { fail "(timeout) daa_das_tests" }
221 proc all_mul_div_tests { } {
226 send_gdb "x/8i mul_div_tests\n"
237 .*$gdb_prompt $" { pass "mul_div_tests" }
238 -re "$gdb_prompt $" { fail "mul_div_tests" }
239 timeout { fail "(timeout) mul_div_tests" }
243 proc all_cmp_tests { } {
248 send_gdb "x/8i cmp_tests\n"
253 .*cmp.w\t#0x1234,r2.*
255 .*cmp.l\t#0x12345678,er4.*
257 .*$gdb_prompt $" { pass "cmp_tests" }
258 -re "$gdb_prompt $" { fail "cmp_tests" }
259 timeout { fail "(timeout) cmp_tests" }
263 proc all_neg_tests { } {
268 send_gdb "x/3i neg_tests\n"
274 .*$gdb_prompt $" { pass "neg_tests" }
275 -re "$gdb_prompt $" { fail "neg_tests" }
276 timeout { fail "(timeout) neg_tests" }
280 proc all_ext_tests { } {
285 send_gdb "x/4i ext_tests\n"
292 .*$gdb_prompt $" { pass "ext_tests" }
293 -re "$gdb_prompt $" { fail "ext_tests" }
294 timeout { fail "(timeout) ext_tests" }
298 proc all_tas_mac_tests { } {
303 send_gdb "x/7i tas_mac_tests\n"
307 .*mac\t@er1\\+,@er2\\+.*
313 .*$gdb_prompt $" { pass "tas_mac_tests" }
314 -re "$gdb_prompt $" { fail "tas_mac_tests" }
315 timeout { fail "(timeout) tas_mac_tests" }
319 proc all_logic_operations_tests { } {
324 send_gdb "x/21i logic_operations_tests\n"
329 .*and.w\t#0x1234,r0.*
331 .*and.l\t#0x12345678,er0.*
337 .*or.l\t#0x12345678,er0.*
339 .*xor(.b|)\t#0x12,r0l.*
340 .*xor(.b|)\tr1l,r2h.*
341 .*xor.w\t#0x1234,r0.*
343 .*xor.l\t#0x12345678,er0.*
348 .*$gdb_prompt $" { pass "logic_operations_tests" }
349 -re "$gdb_prompt $" { fail "logic_operations_tests" }
350 timeout { fail "(timeout) logic_operations_tests" }
354 proc all_sha_shl_tests { } {
359 send_gdb "x/12i sha_shl_tests\n"
374 .*$gdb_prompt $" { pass "sha_shl_tests" }
375 -re "$gdb_prompt $" { fail "sha_shl_tests" }
376 timeout { fail "(timeout) sha_shl_tests" }
380 proc all_rot_rotx_tests { } {
385 send_gdb "x/12i rot_rotx_tests\n"
400 .*$gdb_prompt $" { pass "rot_rotx_tests" }
401 -re "$gdb_prompt $" { fail "rot_rotx_tests" }
402 timeout { fail "(timeout) rot_rotx_tests" }
406 proc all_bset_bclr_tests { } {
411 send_gdb "x/20i bset_bclr_tests\n"
416 .*bset\t#0x5,@0x12:8.*
417 .*bset\t#0x4,@0x1234:16.*
418 .*bset\t#0x3,@0x12345678:32.*
421 .*bset\tr5l,@0x12:8.*
422 .*bset\tr4l,@0x1234:16.*
423 .*bset\tr3l,@0x12345678:32.*
426 .*bclr\t#0x5,@0x12:8.*
427 .*bclr\t#0x4,@0x1234:16.*
428 .*bclr\t#0x3,@0x12345678:32.*
431 .*bclr\tr5h,@0x12:8.*
432 .*bclr\tr4h,@0x1234:16.*
433 .*bclr\tr3h,@0x12345678:32.*
434 .*$gdb_prompt $" { pass "bset_bclr_tests" }
435 -re "$gdb_prompt $" { fail "bset_bclr_tests" }
436 timeout { fail "(timeout) bset_bclr_tests" }
440 proc all_bnot_btst_tests { } {
445 send_gdb "x/20i bnot_btst_tests\n"
450 .*bnot\t#0x5,@0x12:8.*
451 .*bnot\t#0x4,@0x1234:16.*
452 .*bnot\t#0x3,@0x12345678:32.*
455 .*bnot\tr5l,@0x12:8.*
456 .*bnot\tr4l,@0x1234:16.*
457 .*bnot\tr3l,@0x12345678:32.*
460 .*btst\t#0x5,@0x12:8.*
461 .*btst\t#0x4,@0x1234:16.*
462 .*btst\t#0x3,@0x12345678:32.*
465 .*btst\tr5h,@0x12:8.*
466 .*btst\tr4h,@0x1234:16.*
467 .*btst\tr3h,@0x12345678:32.*
468 .*$gdb_prompt $" { pass "bnot_btst_tests" }
469 -re "$gdb_prompt $" { fail "bnot_btst_tests" }
470 timeout { fail "(timeout) bnot_btst_tests" }
474 proc all_band_bor_bxor_tests { } {
479 send_gdb "x/15i band_bor_bxor_tests\n"
484 .*band\t#0x5,@0x12:8.*
485 .*band\t#0x4,@0x1234:16.*
486 .*band\t#0x3,@0x12345678:32.*
489 .*bor\t#0x5,@0x12:8.*
490 .*bor\t#0x4,@0x1234:16.*
491 .*bor\t#0x3,@0x12345678:32.*
494 .*bxor\t#0x5,@0x12:8.*
495 .*bxor\t#0x4,@0x1234:16.*
496 .*bxor\t#0x3,@0x12345678:32.*
497 .*$gdb_prompt $" { pass "band_bor_bxor_tests" }
498 -re "$gdb_prompt $" { fail "band_bor_bxor_tests" }
499 timeout { fail "(timeout) band_bor_bxor_tests" }
503 proc all_bld_bst_tests { } {
508 send_gdb "x/20i bld_bst_tests\n"
513 .*bld\t#0x5,@0x12:8.*
514 .*bld\t#0x4,@0x1234:16.*
515 .*bld\t#0x3,@0x12345678:32.*
518 .*bild\t#0x5,@0x12:8.*
519 .*bild\t#0x4,@0x1234:16.*
520 .*bild\t#0x3,@0x12345678:32.*
523 .*bst\t#0x5,@0x12:8.*
524 .*bst\t#0x4,@0x1234:16.*
525 .*bst\t#0x3,@0x12345678:32.*
528 .*bist\t#0x5,@0x12:8.*
529 .*bist\t#0x4,@0x1234:16.*
530 .*bist\t#0x3,@0x12345678:32.*
531 .*$gdb_prompt $" { pass "bld_bst_tests" }
532 -re "$gdb_prompt $" { fail "bld_bst_tests" }
533 timeout { fail "(timeout) bld_bst_tests" }
537 proc all_branch_tests { } {
542 send_gdb "x/25i branch_tests\n"
545 .*bra\t(branch_tests|.-2 ).*
546 .*brn\t(branch_tests|.-4 ).*
547 .*bhi\t(branch_tests|.-6 ).*
548 .*bls\t(branch_tests|.-8 ).*
549 .*bcc\t(branch_tests|.-10 ).*
550 .*bcs\t(branch_tests|.-12 ).*
551 .*bne\t(branch_tests|.-14 ).*
552 .*beq\t(branch_tests|.-16 ).*
553 .*bvc\t(branch_tests|.-18 ).*
554 .*bvs\t(branch_tests|.-20 ).*
555 .*bpl\t(branch_tests|.-22 ).*
556 .*bmi\t(branch_tests|.-24 ).*
557 .*bge\t(branch_tests|.-26 ).*
558 .*blt\t(branch_tests|.-28 ).*
559 .*bgt\t(branch_tests|.-30 ).*
560 .*ble\t(branch_tests|.-32 ).*
562 .*jmp\t@(branch_tests|0x).*
563 .*jmp\t@@0 \\((0x|)0\\).*
564 .*bsr\t(branch_tests|.-42 ).*
565 .*bsr\t(branch_tests|.-46 ).*
567 .*jsr\t@(branch_tests|0x).*
568 .*jsr\t@@0 \\((0x|)0\\).*
570 .*$gdb_prompt $" { pass "branch_tests" }
571 -re "$gdb_prompt $" { fail "branch_tests" }
572 timeout { fail "(timeout) branch_tests" }
576 proc all_system_control_tests { } {
581 send_gdb "x/40i system_control_tests\n"
590 .*ldc\t@\\(0x1234:16,er0\\),ccr.*
591 .*ldc\t@\\(0x12345678:32,er0\\),ccr.*
593 .*ldc\t@0x1234:16,ccr.*
594 .*ldc\t@0x12345678:32,ccr.*
597 .*stc\tccr,@\\(0x1234:16,er0\\).*
598 .*stc\tccr,@\\(0x12345678:32,er0\\).*
600 .*stc\tccr,@0x1234:16.*
601 .*stc\tccr,@0x12345678:32.*
608 .*ldc\t@\\(0x1234:16,er0\\),exr.*
609 .*ldc\t@\\(0x12345678:32,er0\\),exr.*
611 .*ldc\t@0x1234:16,exr.*
612 .*ldc\t@0x12345678:32,exr.*
615 .*stc\texr,@\\(0x1234:16,er0\\).*
616 .*stc\texr,@\\(0x12345678:32,er0\\).*
618 .*stc\texr,@0x1234:16.*
619 .*stc\texr,@0x12345678:32.*
624 .*$gdb_prompt $" { pass "system_control_tests" }
625 -re "$gdb_prompt $" { fail "system_control_tests" }
626 timeout { fail "(timeout) system_control_tests" }
630 proc all_block_data_transfer_tests { } {
635 send_gdb "x/2i block_data_transfer_tests\n"
640 .*$gdb_prompt $" { pass "block_data_transfer_tests" }
641 -re "$gdb_prompt $" { fail "block_data_transfer_tests" }
642 timeout { fail "(timeout) block_data_transfer_tests" }
648 gdb_reinitialize_dir $srcdir/$subdir
649 all_set_machine_h8300s
657 all_movfpe_movtpe_tests
659 # Arithmetic operations
660 all_add_sub_addx_subx_tests
661 all_inc_dec_adds_subs_tests
670 all_logic_operations_tests
679 all_band_bor_bxor_tests
686 all_system_control_tests
688 # Block data transfer
689 all_block_data_transfer_tests