blob: bf5dcb9c31b3b0d749838116415b716329dfd56f [file] [log] [blame]
# Copyright 2017-2021 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 {
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"
##########################################