gdb/
[binutils-gdb.git] / gdb / testsuite / gdb.disasm / sh3.exp
1 # Copyright (C) 1992, 1997, 2007, 2008, 2009, 2010, 2011
2 # 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@cs.utah.edu)
18
19 if $tracelevel then {
20 strace $tracelevel
21 }
22
23 if ![istarget "sh3*-*-*"] {
24 verbose "Tests ignored for all but sh3 based targets."
25 return
26 }
27
28
29 set testfile "sh3"
30 set srcfile ${srcdir}/${subdir}/${testfile}.s
31 set binfile ${objdir}/${subdir}/${testfile}
32 if { [gdb_compile "${srcfile}" "${binfile}" executable ""] != "" } {
33 untested sh3.exp
34 return -1
35 }
36
37 proc all_fp_move_and_load_tests { } {
38 global gdb_prompt
39 global hex
40 global decimal
41
42 send_gdb "x/9i fp_move_and_load_tests\n"
43 gdb_expect {
44 -re "
45 .*fmov.s\t@r0,fr0.*
46 .*fmov.s\tfr0,@r0.*
47 .*fmov.s\t@r0\\+,fr0.*
48 .*fmov.s\tfr0,@-r0.*
49 .*fmov.s\t@\\(r0,r0\\),fr0.*
50 .*fmov.s\tfr0,@\\(r0,r0\\).*
51 .*fmov\tfr0,fr1.*
52 .*fldi0\tfr0.*
53 .*fldi1\tfr0.*
54 .*$gdb_prompt $" { pass "fp_move_and_load_tests" }
55 -re "$gdb_prompt $" { fail "fp_move_and_load_tests" }
56 timeout { fail "(timeout) fp_move_and_load_tests" }
57 }
58 }
59
60 proc all_fp_arithmetic_tests { } {
61 global gdb_prompt
62 global hex
63 global decimal
64
65 send_gdb "x/13i fp_arithmetic_tests\n"
66 gdb_expect {
67 -re "
68 .*fadd\tfr0,fr1.*
69 .*fsub\tfr0,fr1.*
70 .*fmul\tfr0,fr1.*
71 .*fdiv\tfr0,fr1.*
72 .*fmac\tfr0,fr0,fr1.*
73 .*fcmp/eq\tfr0,fr1.*
74 .*fcmp/gt\tfr0,fr1.*
75 .*ftst/nan\tfr0.*
76 .*fneg\tfr0.*
77 .*fabs\tfr0.*
78 .*fsqrt\tfr0.*
79 .*float\tfpul,fr0.*
80 .*ftrc\tfr0,fpul.*
81 .*$gdb_prompt $" { pass "fp_arithmetic_tests" }
82 -re "$gdb_prompt $" { fail "fp_arithmetic_tests" }
83 timeout { fail "(timeout) fp_arithmetic_tests" }
84 }
85 }
86
87 proc all_fp_misc_tests { } {
88 global gdb_prompt
89 global hex
90 global decimal
91
92 send_gdb "x/10i fp_misc_tests\n"
93 gdb_expect {
94 -re "
95 .*fsts\tfpul,fr0.*
96 .*flds\tfr0,fpul.*
97 .*lds\tr3,fpul.*
98 .*lds\\.l\t@r3\\+,fpul.*
99 .*lds\tr3,fpscr.*
100 .*lds\\.l\t@r3\\+,fpscr.*
101 .*sts\tfpul,r3.*
102 .*sts\\.l\tfpul,@-r3.*
103 .*sts\tfpscr,r3.*
104 .*sts\\.l\tfpscr,@-r3.*
105 .*$gdb_prompt $" { pass "fp_misc_tests" }
106 -re "$gdb_prompt $" { fail "fp_misc_tests" }
107 timeout { fail "(timeout) fp_misc_tests" }
108 }
109 }
110
111 gdb_exit
112 gdb_start
113 gdb_reinitialize_dir $srcdir/$subdir
114 gdb_load $binfile
115
116 all_fp_move_and_load_tests
117 all_fp_arithmetic_tests
118 all_fp_misc_tests
119