1 # Copyright
(C
) 2000-2024 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 require
{istarget
"h8300*-*-*"}
22 set srcfile $
{srcdir
}/$
{subdir
}/$
{testfile
}.s
23 set binfile $
{objdir
}/$
{subdir
}/$
{testfile
}
24 if { [gdb_compile
"${srcfile}" "${binfile}" executable {debug additional_flags=-ms}] != "" } {
25 untested
"failed to compile"
29 proc all_set_machine_h8300s
{ } {
34 send_gdb
"set machine h8300s\n"
36 -re
"$gdb_prompt $" {}
40 proc all_movb_tests
{ } {
45 send_gdb
"x/9i movb_tests\n"
51 .
*mov.b
\t@
\\(0x1234:16,er0
\\),r2l.
*
52 .
*mov.b
\t@
\\(0x12345678:32,er0
\\),r2h.
*
53 .
*mov.b
\t@er0
\\+,r3l.
*
54 .
*mov.b
\t@
0x12:8,r3h.
*
55 .
*mov.b
\t@
0x1234:16,r4l.
*
56 .
*mov.b
\t@
0x12345678:32,r4h.
*
57 .
*$gdb_prompt $
" { pass "movb_tests" }
58 -re
"$gdb_prompt $" { fail "movb_tests" }
59 timeout
{ fail
"(timeout) movb_tests" }
63 proc all_movw_tests
{ } {
68 send_gdb
"x/8i movw_tests\n"
74 .
*mov.w
\t@
\\(0x1234:16,er0
\\),r3.
*
75 .
*mov.w
\t@
\\(0x12345678:32,er0
\\),r4.
*
77 .
*mov.w
\t@
0x1234:16,r6.
*
78 .
*mov.w
\t@
0x12345678:32,r7.
*
79 .
*$gdb_prompt $
" { pass "movw_tests" }
80 -re
"$gdb_prompt $" { fail "movw_tests" }
81 timeout
{ fail
"(timeout) movw_tests" }
85 proc all_movl_tests
{ } {
90 send_gdb
"x/8i movl_tests\n"
94 .
*mov.l
\t#
0x12345678,er1.
*
96 .
*mov.l
\t@
\\(0x1234:16,er0
\\),er3.
*
97 .
*mov.l
\t@
\\(0x12345678:32,er0
\\),er4.
*
98 .
*mov.l
\t@er0
\\+,er5.
*
99 .
*mov.l
\t@
0x1234:16,er6.
*
100 .
*mov.l
\t@
0x12345678:32,er7.
*
101 .
*$gdb_prompt $
" { pass "movl_tests" }
102 -re
"$gdb_prompt $" { fail "movl_tests" }
103 timeout
{ fail
"(timeout) movl_tests" }
107 proc all_ldm_stm_tests
{ } {
112 send_gdb
"x/6i ldm_stm_tests\n"
115 .
*ldm.l
\t@sp
\\+,er0
-er1.
*
116 .
*ldm.l
\t@sp
\\+,er0
-er2.
*
117 .
*ldm.l
\t@sp
\\+,er0
-er3.
*
118 .
*stm.l
\ter
0\\-er1
,@
-sp.
*
119 .
*stm.l
\ter
0\\-er2
,@
-sp.
*
120 .
*stm.l
\ter
0\\-er3
,@
-sp.
*
121 .
*$gdb_prompt $
" { pass "ldm_stm_tests" }
122 -re
"$gdb_prompt $" { fail "ldm_stm_tests" }
123 timeout
{ fail
"(timeout) ldm_stm_tests" }
127 proc all_movfpe_movtpe_tests
{ } {
132 send_gdb
"x/2i movfpe_movtpe_tests\n"
135 .
*movfpe
\t@
0x1234:16,r2l.
*
136 .
*movtpe
\tr
2l,@
0x1234:16.
*
137 .
*$gdb_prompt $
" { pass "movfpe_movtpe_tests" }
138 -re
"$gdb_prompt $" { fail "movfpe_movtpe_tests" }
139 timeout
{ fail
"(timeout) movfpe_movtpe_tests" }
143 proc all_add_sub_addx_subx_tests
{ } {
148 send_gdb
"x/15i add_sub_addx_subx_tests\n"
153 .
*add.w
\t#
0x1234,r2.
*
155 .
*add.l
\t#
0x12345678,er5.
*
158 .
*sub.w
\t#
0x1234,r2.
*
160 .
*sub.l
\t#
0x12345678,er5.
*
166 .
*$gdb_prompt $
" { pass "add_sub_addx_subx_tests" }
167 -re
"$gdb_prompt $" { fail "add_sub_addx_subx_tests" }
168 timeout
{ fail
"(timeout) add_sub_addx_subx_tests" }
172 proc all_inc_dec_adds_subs_tests
{ } {
177 send_gdb
"x/16i inc_dec_adds_subs_tests\n"
181 .
*inc.w
\t#
(0x|
)1,r4.
*
182 .
*inc.w
\t#
(0x|
)2,r3.
*
183 .
*inc.l
\t#
(0x|
)1,er2.
*
184 .
*inc.l
\t#
(0x|
)2,er1.
*
186 .
*dec.w
\t#
(0x|
)1,r4.
*
187 .
*dec.w
\t#
(0x|
)2,r3.
*
188 .
*dec.l
\t#
(0x|
)1,er2.
*
189 .
*dec.l
\t#
(0x|
)2,er1.
*
190 .
*adds
\t#
(0x|
)1,er7.
*
191 .
*adds
\t#
(0x|
)2,er6.
*
192 .
*adds
\t#
(0x|
)4,er5.
*
193 .
*subs
\t#
(0x|
)1,er7.
*
194 .
*subs
\t#
(0x|
)2,er6.
*
195 .
*subs
\t#
(0x|
)4,er5.
*
196 .
*$gdb_prompt $
" { pass "inc_dec_adds_subs_tests" }
197 -re
"$gdb_prompt $" { fail "inc_dec_adds_subs_tests" }
198 timeout
{ fail
"(timeout) inc_dec_adds_subs_tests" }
202 proc all_daa_das_tests
{ } {
207 send_gdb
"x/2i daa_das_tests\n"
212 .
*$gdb_prompt $
" { pass "daa_das_tests" }
213 -re
"$gdb_prompt $" { fail "daa_das_tests" }
214 timeout
{ fail
"(timeout) daa_das_tests" }
218 proc all_mul_div_tests
{ } {
223 send_gdb
"x/8i mul_div_tests\n"
234 .
*$gdb_prompt $
" { pass "mul_div_tests" }
235 -re
"$gdb_prompt $" { fail "mul_div_tests" }
236 timeout
{ fail
"(timeout) mul_div_tests" }
240 proc all_cmp_tests
{ } {
245 send_gdb
"x/8i cmp_tests\n"
250 .
*cmp.w
\t#
0x1234,r2.
*
252 .
*cmp.l
\t#
0x12345678,er4.
*
254 .
*$gdb_prompt $
" { pass "cmp_tests" }
255 -re
"$gdb_prompt $" { fail "cmp_tests" }
256 timeout
{ fail
"(timeout) cmp_tests" }
260 proc all_neg_tests
{ } {
265 send_gdb
"x/3i neg_tests\n"
271 .
*$gdb_prompt $
" { pass "neg_tests" }
272 -re
"$gdb_prompt $" { fail "neg_tests" }
273 timeout
{ fail
"(timeout) neg_tests" }
277 proc all_ext_tests
{ } {
282 send_gdb
"x/4i ext_tests\n"
289 .
*$gdb_prompt $
" { pass "ext_tests" }
290 -re
"$gdb_prompt $" { fail "ext_tests" }
291 timeout
{ fail
"(timeout) ext_tests" }
295 proc all_tas_mac_tests
{ } {
300 send_gdb
"x/7i tas_mac_tests\n"
304 .
*mac
\t@er1
\\+,@er2
\\+.
*
310 .
*$gdb_prompt $
" { pass "tas_mac_tests" }
311 -re
"$gdb_prompt $" { fail "tas_mac_tests" }
312 timeout
{ fail
"(timeout) tas_mac_tests" }
316 proc all_logic_operations_tests
{ } {
321 send_gdb
"x/21i logic_operations_tests\n"
326 .
*and.w
\t#
0x1234,r0.
*
328 .
*and.l
\t#
0x12345678,er0.
*
334 .
*or.l
\t#
0x12345678,er0.
*
336 .
*xor
(.b|
)\t#
0x12,r0l.
*
337 .
*xor
(.b|
)\tr
1l,r2h.
*
338 .
*xor.w
\t#
0x1234,r0.
*
340 .
*xor.l
\t#
0x12345678,er0.
*
345 .
*$gdb_prompt $
" { pass "logic_operations_tests" }
346 -re
"$gdb_prompt $" { fail "logic_operations_tests" }
347 timeout
{ fail
"(timeout) logic_operations_tests" }
351 proc all_sha_shl_tests
{ } {
356 send_gdb
"x/12i sha_shl_tests\n"
371 .
*$gdb_prompt $
" { pass "sha_shl_tests" }
372 -re
"$gdb_prompt $" { fail "sha_shl_tests" }
373 timeout
{ fail
"(timeout) sha_shl_tests" }
377 proc all_rot_rotx_tests
{ } {
382 send_gdb
"x/12i rot_rotx_tests\n"
397 .
*$gdb_prompt $
" { pass "rot_rotx_tests" }
398 -re
"$gdb_prompt $" { fail "rot_rotx_tests" }
399 timeout
{ fail
"(timeout) rot_rotx_tests" }
403 proc all_bset_bclr_tests
{ } {
408 send_gdb
"x/20i bset_bclr_tests\n"
413 .
*bset
\t#
0x5,@
0x12:8.
*
414 .
*bset
\t#
0x4,@
0x1234:16.
*
415 .
*bset
\t#
0x3,@
0x12345678:32.
*
418 .
*bset
\tr
5l,@
0x12:8.
*
419 .
*bset
\tr
4l,@
0x1234:16.
*
420 .
*bset
\tr
3l,@
0x12345678:32.
*
423 .
*bclr
\t#
0x5,@
0x12:8.
*
424 .
*bclr
\t#
0x4,@
0x1234:16.
*
425 .
*bclr
\t#
0x3,@
0x12345678:32.
*
428 .
*bclr
\tr
5h
,@
0x12:8.
*
429 .
*bclr
\tr
4h
,@
0x1234:16.
*
430 .
*bclr
\tr
3h
,@
0x12345678:32.
*
431 .
*$gdb_prompt $
" { pass "bset_bclr_tests" }
432 -re
"$gdb_prompt $" { fail "bset_bclr_tests" }
433 timeout
{ fail
"(timeout) bset_bclr_tests" }
437 proc all_bnot_btst_tests
{ } {
442 send_gdb
"x/20i bnot_btst_tests\n"
447 .
*bnot
\t#
0x5,@
0x12:8.
*
448 .
*bnot
\t#
0x4,@
0x1234:16.
*
449 .
*bnot
\t#
0x3,@
0x12345678:32.
*
452 .
*bnot
\tr
5l,@
0x12:8.
*
453 .
*bnot
\tr
4l,@
0x1234:16.
*
454 .
*bnot
\tr
3l,@
0x12345678:32.
*
457 .
*btst
\t#
0x5,@
0x12:8.
*
458 .
*btst
\t#
0x4,@
0x1234:16.
*
459 .
*btst
\t#
0x3,@
0x12345678:32.
*
462 .
*btst
\tr
5h
,@
0x12:8.
*
463 .
*btst
\tr
4h
,@
0x1234:16.
*
464 .
*btst
\tr
3h
,@
0x12345678:32.
*
465 .
*$gdb_prompt $
" { pass "bnot_btst_tests" }
466 -re
"$gdb_prompt $" { fail "bnot_btst_tests" }
467 timeout
{ fail
"(timeout) bnot_btst_tests" }
471 proc all_band_bor_bxor_tests
{ } {
476 send_gdb
"x/15i band_bor_bxor_tests\n"
481 .
*band
\t#
0x5,@
0x12:8.
*
482 .
*band
\t#
0x4,@
0x1234:16.
*
483 .
*band
\t#
0x3,@
0x12345678:32.
*
486 .
*bor
\t#
0x5,@
0x12:8.
*
487 .
*bor
\t#
0x4,@
0x1234:16.
*
488 .
*bor
\t#
0x3,@
0x12345678:32.
*
491 .
*bxor
\t#
0x5,@
0x12:8.
*
492 .
*bxor
\t#
0x4,@
0x1234:16.
*
493 .
*bxor
\t#
0x3,@
0x12345678:32.
*
494 .
*$gdb_prompt $
" { pass "band_bor_bxor_tests" }
495 -re
"$gdb_prompt $" { fail "band_bor_bxor_tests" }
496 timeout
{ fail
"(timeout) band_bor_bxor_tests" }
500 proc all_bld_bst_tests
{ } {
505 send_gdb
"x/20i bld_bst_tests\n"
510 .
*bld
\t#
0x5,@
0x12:8.
*
511 .
*bld
\t#
0x4,@
0x1234:16.
*
512 .
*bld
\t#
0x3,@
0x12345678:32.
*
515 .
*bild
\t#
0x5,@
0x12:8.
*
516 .
*bild
\t#
0x4,@
0x1234:16.
*
517 .
*bild
\t#
0x3,@
0x12345678:32.
*
520 .
*bst
\t#
0x5,@
0x12:8.
*
521 .
*bst
\t#
0x4,@
0x1234:16.
*
522 .
*bst
\t#
0x3,@
0x12345678:32.
*
525 .
*bist
\t#
0x5,@
0x12:8.
*
526 .
*bist
\t#
0x4,@
0x1234:16.
*
527 .
*bist
\t#
0x3,@
0x12345678:32.
*
528 .
*$gdb_prompt $
" { pass "bld_bst_tests" }
529 -re
"$gdb_prompt $" { fail "bld_bst_tests" }
530 timeout
{ fail
"(timeout) bld_bst_tests" }
534 proc all_branch_tests
{ } {
539 send_gdb
"x/25i branch_tests\n"
542 .
*bra
\t(branch_tests|.
-2 ).
*
543 .
*brn
\t(branch_tests|.
-4 ).
*
544 .
*bhi
\t(branch_tests|.
-6 ).
*
545 .
*bls
\t(branch_tests|.
-8 ).
*
546 .
*bcc
\t(branch_tests|.
-10 ).
*
547 .
*bcs
\t(branch_tests|.
-12 ).
*
548 .
*bne
\t(branch_tests|.
-14 ).
*
549 .
*beq
\t(branch_tests|.
-16 ).
*
550 .
*bvc
\t(branch_tests|.
-18 ).
*
551 .
*bvs
\t(branch_tests|.
-20 ).
*
552 .
*bpl
\t(branch_tests|.
-22 ).
*
553 .
*bmi
\t(branch_tests|.
-24 ).
*
554 .
*bge
\t(branch_tests|.
-26 ).
*
555 .
*blt
\t(branch_tests|.
-28 ).
*
556 .
*bgt
\t(branch_tests|.
-30 ).
*
557 .
*ble
\t(branch_tests|.
-32 ).
*
559 .
*jmp
\t@
(branch_tests|
0x
).
*
560 .
*jmp
\t@@
0 \\((0x|
)0\\).
*
561 .
*bsr
\t(branch_tests|.
-42 ).
*
562 .
*bsr
\t(branch_tests|.
-46 ).
*
564 .
*jsr
\t@
(branch_tests|
0x
).
*
565 .
*jsr
\t@@
0 \\((0x|
)0\\).
*
567 .
*$gdb_prompt $
" { pass "branch_tests" }
568 -re
"$gdb_prompt $" { fail "branch_tests" }
569 timeout
{ fail
"(timeout) branch_tests" }
573 proc all_system_control_tests
{ } {
578 send_gdb
"x/40i system_control_tests\n"
587 .
*ldc
\t@
\\(0x1234:16,er0
\\),ccr.
*
588 .
*ldc
\t@
\\(0x12345678:32,er0
\\),ccr.
*
590 .
*ldc
\t@
0x1234:16,ccr.
*
591 .
*ldc
\t@
0x12345678:32,ccr.
*
594 .
*stc
\tccr
,@
\\(0x1234:16,er0
\\).
*
595 .
*stc
\tccr
,@
\\(0x12345678:32,er0
\\).
*
597 .
*stc
\tccr
,@
0x1234:16.
*
598 .
*stc
\tccr
,@
0x12345678:32.
*
605 .
*ldc
\t@
\\(0x1234:16,er0
\\),exr.
*
606 .
*ldc
\t@
\\(0x12345678:32,er0
\\),exr.
*
608 .
*ldc
\t@
0x1234:16,exr.
*
609 .
*ldc
\t@
0x12345678:32,exr.
*
612 .
*stc
\texr
,@
\\(0x1234:16,er0
\\).
*
613 .
*stc
\texr
,@
\\(0x12345678:32,er0
\\).
*
615 .
*stc
\texr
,@
0x1234:16.
*
616 .
*stc
\texr
,@
0x12345678:32.
*
621 .
*$gdb_prompt $
" { pass "system_control_tests" }
622 -re
"$gdb_prompt $" { fail "system_control_tests" }
623 timeout
{ fail
"(timeout) system_control_tests" }
627 proc all_block_data_transfer_tests
{ } {
632 send_gdb
"x/2i block_data_transfer_tests\n"
637 .
*$gdb_prompt $
" { pass "block_data_transfer_tests" }
638 -re
"$gdb_prompt $" { fail "block_data_transfer_tests" }
639 timeout
{ fail
"(timeout) block_data_transfer_tests" }
644 all_set_machine_h8300s
652 all_movfpe_movtpe_tests
654 # Arithmetic operations
655 all_add_sub_addx_subx_tests
656 all_inc_dec_adds_subs_tests
665 all_logic_operations_tests
674 all_band_bor_bxor_tests
681 all_system_control_tests
683 # Block data transfer
684 all_block_data_transfer_tests