xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/mips-fcr.exp (revision 6881a4007f077b54e5f51159c52b9b25f57deb0d)
1# Copyright (C) 2016-2023 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# Contributed by Imagination Technologies, written by Maciej W. Rozycki.
17
18# Test MIPS Floating Point Control Register handling.
19
20if {![istarget "mips*-*-*"]} {
21    verbose "Skipping MIPS Floating Point Control Register tests."
22    return
23}
24
25standard_testfile
26
27if { [prepare_for_testing "failed to prepare" ${testfile}] } {
28    return
29}
30
31if ![runto_main] {
32    return
33}
34
35# First check if we have an FPU available in the first place.
36gdb_test_multiple "show mipsfpu" "check for MIPS floating-point coprocessor" {
37    -re "The MIPS floating-point coprocessor .*\(absent\|unknown\).*$gdb_prompt $" {
38	unsupported "no MIPS floating-point coprocessor in the processor"
39	return
40    }
41    -re "The MIPS floating-point coprocessor .*$gdb_prompt $" {
42	verbose "MIPS floating-point coprocessor check successful."
43    }
44    default {
45	fail
46	return
47    }
48}
49
50# Now check that FCRs are accessible and 32-bit wide.
51gdb_test "info registers \$fcsr" "fcsr: $hex"
52gdb_test "print sizeof \$fcsr" "\\\$$decimal = 4"
53gdb_test "info registers \$fir" "fir: $hex"
54gdb_test "print sizeof \$fir" "\\\$$decimal = 4"
55