summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.arch/sparc64-regs.exp
blob: 1d6c967dd061c6716d565a7d1a706218c2af7a78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Copyright 2017-2020 Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# This file is part of the gdb testsuite.

# Tests decoding of various sparc64 registers.
# At the moment, only few registers are tested, but more can be added in future.

if ![istarget "sparc64*-*-linux*"] then {
    verbose "Skipping sparc64 register tests."
    return 0
}

standard_testfile .S

if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
    return -1
}

if ![runto_main] then {
    untested "could not run to main"
    return 0
}

##########################################
gdb_test "break $srcfile:test_ccr" "Breakpoint \[0-9\] at .*"
gdb_test "continue" "Continuing.*"
gdb_test "si" "wr .*" "single step to the first %ccr test"

proc test_ccr {exp_value exp_text {exp_insn "wr .*"}} {
    gdb_test "info register ccr" \
        "ccr            $exp_value	.*$exp_text.*" \
        "check %ccr register value equal to $exp_text"

    gdb_test "si" "$exp_insn" "single step to a next %ccr test after $exp_text"
}

test_ccr "0x1" "icc.c"
test_ccr "0x2" "icc.v"
test_ccr "0x3" "icc.c icc.v"
test_ccr "0x4" "icc.z"
test_ccr "0x5" "icc.c icc.z"
test_ccr "0x6" "icc.v icc.z"
test_ccr "0x7" "icc.c icc.v icc.z"
test_ccr "0x8" "icc.n"
test_ccr "0x9" "icc.c icc.n"
test_ccr "0xa" "icc.v icc.n"
test_ccr "0xb" "icc.c icc.v icc.n"
test_ccr "0xc" "icc.z icc.n"
test_ccr "0xd" "icc.c icc.z icc.n"
test_ccr "0xe" "icc.v icc.z icc.n"
test_ccr "0xf" "icc.c icc.v icc.z icc.n"

test_ccr "0x10" "xcc.c"
test_ccr "0x20" "xcc.v"
test_ccr "0x30" "xcc.c xcc.v"
test_ccr "0x40" "xcc.z"
test_ccr "0x50" "xcc.c xcc.z"
test_ccr "0x60" "xcc.v xcc.z"
test_ccr "0x70" "xcc.c xcc.v xcc.z"
test_ccr "0x80" "xcc.n"
test_ccr "0x90" "xcc.c xcc.n"
test_ccr "0xa0" "xcc.v xcc.n"
test_ccr "0xb0" "xcc.c xcc.v xcc.n"
test_ccr "0xc0" "xcc.z xcc.n"
test_ccr "0xd0" "xcc.c xcc.z xcc.n"
test_ccr "0xe0" "xcc.v xcc.z xcc.n" "retl"
test_ccr "0xf0" "xcc.c xcc.v xcc.z xcc.n" "nop"
##########################################


##########################################
set lno [gdb_get_line_number "sparc64-regs.exp: after first %fsr" $srcfile]
gdb_test "break $srcfile:$lno" "Breakpoint \[0-9\] at .*" \
    "forward breakpoint to first %fsr test"
gdb_test "continue" "Continuing.*"

proc test_fsr {exp_value exp_text} {
    gdb_test "info register fsr" \
        "fsr            $exp_value	.*$exp_text.*" \
        "check %fsr register value equal to $exp_text"

    gdb_test "si" "stx .*" "single step to a next %fsr test (I.) after $exp_text"
    gdb_test "si" "ldx .*" "single step to a next %fsr test (II.) after $exp_text"
    gdb_test "si" "sllx .*" "single step to a next %fsr test (III.) after $exp_text"
}

test_fsr "0x1" "NXC"
test_fsr "0x2" "DZC"
test_fsr "0x4" "UFC"
test_fsr "0x8" "OFC"
test_fsr "0x10" "NVC"
test_fsr "0x20" "NXA"
test_fsr "0x40" "DZA"
test_fsr "0x80" "UFA"
test_fsr "0x100" "OFA"
test_fsr "0x200" "NVA"
test_fsr "0x800000" "NXM"
test_fsr "0x1000000" "DZM"
test_fsr "0x2000000" "UFM"
test_fsr "0x4000000" "OFM"
test_fsr "0x8000000" "NVM"
##########################################