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