1 # Copyright 2007 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 # Tests for ARM iWMMXt register setting and fetching.
20 if ![istarget "arm*-*-*"] then {
21 verbose "Skipping iWMMXt register tests."
25 set testfile "iwmmxt-regs"
26 set binfile ${objdir}/${subdir}/${testfile}
27 set src1 ${srcdir}/${subdir}/${testfile}.c
29 # Try to compile the test case. If we can't, assume this is not an
30 # iWMMXt toolchain and bail out.
31 if { [gdb_compile ${src1} ${binfile} executable {quiet debug}] != "" } {
32 verbose "Skipping iWMMXt register tests."
37 gdb_reinitialize_dir $srcdir/$subdir
41 # Run to `main' where we begin our tests.
44 if ![runto_main] then {
48 # Set all the registers to arbitrary values.
49 for {set i 0} {$i < 16} {incr i 1} {
50 gdb_test "set \$wr$i.u64 = ((${i}LL << 32) | ${i})" "" "set reg wr$i"
52 gdb_test "set \$wcssf = 300" "" "set reg wcssf"
53 gdb_test "set \$wcasf = 200" "" "set reg wcasf"
54 for {set i 0} {$i < 4} {incr i 1} {
55 gdb_test "set \$wcgr$i = 100 + $i" "" "set reg wcgr$i"
58 # See if the sets stuck.
59 gdb_test "next" ".*write_regs.*" "next over read_regs"
61 for {set i 0} {$i < 16} {incr i 1} {
62 gdb_test "p \$wr$i.u64 == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test reg wr$i"
65 gdb_test "p \$wcasf" "\\\$$decimal = 200" "test reg wcasf"
66 for {set i 0} {$i < 4} {incr i 1} {
67 gdb_test "p \$wcgr$i == 100 + $i" "\\\$$decimal = 1" "test reg wcgr$i"
70 # Also verify the copies read by the target.
71 for {set i 0} {$i < 16} {incr i 1} {
72 gdb_test "p regs\[$i\] == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test stored wr$i"
75 gdb_test "p control_regs\[1\]" "\\\$$decimal = 200" "test stored wcasf"
76 for {set i 0} {$i < 4} {incr i 1} {
77 gdb_test "p control_regs\[$i + 2\] == 100 + $i" "\\\$$decimal = 1" "test stored wcgr$i"