]>
Commit | Line | Data |
---|---|---|
1d506c26 | 1 | # Copyright 2007-2024 Free Software Foundation, Inc. |
fb1e4ffc DJ |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
fb1e4ffc DJ |
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 | |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
fb1e4ffc DJ |
15 | # |
16 | ||
17 | # Tests for ARM iWMMXt register setting and fetching. | |
18 | ||
73c06197 | 19 | require {istarget "arm*-*-*"} |
fb1e4ffc DJ |
20 | |
21 | set testfile "iwmmxt-regs" | |
22 | set binfile ${objdir}/${subdir}/${testfile} | |
23 | set src1 ${srcdir}/${subdir}/${testfile}.c | |
24 | ||
25 | # Try to compile the test case. If we can't, assume this is not an | |
26 | # iWMMXt toolchain and bail out. | |
27 | if { [gdb_compile ${src1} ${binfile} executable {quiet debug}] != "" } { | |
28 | verbose "Skipping iWMMXt register tests." | |
29 | return | |
30 | } | |
31 | ||
32 | gdb_start | |
33 | gdb_reinitialize_dir $srcdir/$subdir | |
34 | gdb_load ${binfile} | |
35 | ||
36 | # | |
37 | # Run to `main' where we begin our tests. | |
38 | # | |
39 | ||
75b6f386 | 40 | if {![runto_main]} { |
c8ee3f04 | 41 | return 0 |
fb1e4ffc DJ |
42 | } |
43 | ||
44 | # Set all the registers to arbitrary values. | |
45 | for {set i 0} {$i < 16} {incr i 1} { | |
ff6f572f | 46 | gdb_test "set \$wR$i.u64 = ((${i}LL << 32) | ${i})" "" "set reg wR$i" |
fb1e4ffc | 47 | } |
ff6f572f DJ |
48 | gdb_test "set \$wCSSF = 300" "" "set reg wCSSF" |
49 | gdb_test "set \$wCASF = 200" "" "set reg wCASF" | |
fb1e4ffc | 50 | for {set i 0} {$i < 4} {incr i 1} { |
ff6f572f | 51 | gdb_test "set \$wCGR$i = 100 + $i" "" "set reg wCGR$i" |
fb1e4ffc DJ |
52 | } |
53 | ||
54 | # See if the sets stuck. | |
55 | gdb_test "next" ".*write_regs.*" "next over read_regs" | |
56 | ||
57 | for {set i 0} {$i < 16} {incr i 1} { | |
ff6f572f | 58 | gdb_test "p \$wR$i.u64 == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test reg wR$i" |
fb1e4ffc | 59 | } |
ff6f572f DJ |
60 | # Don't test wCSSF. |
61 | gdb_test "p \$wCASF" "\\\$$decimal = 200" "test reg wCASF" | |
fb1e4ffc | 62 | for {set i 0} {$i < 4} {incr i 1} { |
ff6f572f | 63 | gdb_test "p \$wCGR$i == 100 + $i" "\\\$$decimal = 1" "test reg wCGR$i" |
fb1e4ffc DJ |
64 | } |
65 | ||
66 | # Also verify the copies read by the target. | |
67 | for {set i 0} {$i < 16} {incr i 1} { | |
ff6f572f | 68 | gdb_test "p regs\[$i\] == ((${i}LL << 32) | ${i})" "\\\$$decimal = 1" "test stored wR$i" |
fb1e4ffc DJ |
69 | } |
70 | # Don't test wcssf. | |
ff6f572f | 71 | gdb_test "p control_regs\[1\]" "\\\$$decimal = 200" "test stored wCASF" |
fb1e4ffc | 72 | for {set i 0} {$i < 4} {incr i 1} { |
ff6f572f | 73 | gdb_test "p control_regs\[$i + 2\] == 100 + $i" "\\\$$decimal = 1" "test stored wCGR$i" |
fb1e4ffc | 74 | } |