]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/aarch64-fp.exp
Automatic date update in version.in
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / aarch64-fp.exp
CommitLineData
1d506c26 1# Copyright 2008-2024 Free Software Foundation, Inc.
bf330350
CU
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
1cc75e92 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
bf330350
CU
15#
16# This file is part of the gdb testsuite.
17
18# PR server/17457
19# Test aarch64 floating point registers q0, q1, v0, v1, fpsr, fpcr
20
d9050fb8 21require is_aarch64_target
bf330350
CU
22
23standard_testfile
5b362f04 24if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
bf330350
CU
25 return -1
26}
27
28if ![runto_main] {
bf330350
CU
29 return -1
30}
31
805acca0 32set endianness [get_endianness]
bf330350
CU
33
34gdb_test "break ${srcfile}:[gdb_get_line_number "return"]" \
35 "Breakpoint $decimal at 0x\[0-9a-fA-F\]+: file .*${srcfile}.*\\\." \
36 "set the breakpoint after setting the fp registers"
37
38gdb_test "continue" \
39 "Continuing.*Breakpoint $decimal.*" \
40 "continue until breakpoint"
41
42if {$endianness == "little"} {
43 set reg_value0 "0x1f1e1d1c1b1a19181716151413121110"
44 set reg_value1 "0x2f2e2d2c2b2a29282726252423222120"
45} else {
46 set reg_value0 "0x101112131415161718191a1b1c1d1e1f"
47 set reg_value1 "0x202122232425262728292a2b2c2d2e2f"
48}
49
f7a7000d 50gdb_test "p/x \$q0" \
bf330350
CU
51 "q0.*{u = $reg_value0, s = $reg_value0.*" \
52 "check register q0 value"
53
f7a7000d 54gdb_test "p/x \$q1" \
bf330350
CU
55 "q1.*{u = $reg_value1, s = $reg_value1.*" \
56 "check register q1 value"
57
f7a7000d 58gdb_test "p/x \$v0" \
bf330350
CU
59 "v0.*$reg_value0}}}" \
60 "check register v0 value"
61
f7a7000d 62gdb_test "p/x \$v1" \
bf330350
CU
63 "v1.*$reg_value1}}}" \
64 "check register v1 value"
65
f7a7000d 66gdb_test "p/x \$fpsr" \
bf330350
CU
67 "fpsr.*0x\[0-9a-fA-F\].*" \
68 "check register fpsr value"
69
f7a7000d 70gdb_test "p/x \$fpcr" \
bf330350
CU
71 "fpcr.*0x\[0-9a-fA-F\].*" \
72 "check register fpcr value"
73
5291fe3c
SP
74with_test_prefix "bfloat16" {
75 gdb_test "set \$h0.bf = 1.185e-38" \
76 ".*" \
77 "set h0.bf to 129"
78
79 gdb_test "p \$h0" \
80 "h0.*{bf = 1.185e-38, f = 7.689e-06, u = 129, s = 129}" \
81 "h0 fields are valid"
82
83 gdb_test "set \$v0.h.bf\[0\] = 0" \
84 "v0.* = 0" \
85 "set v0.h.bf\[0\] to 0"
86
87 gdb_test "p \$v0.h.s\[0\]" \
88 "v0.* = 0" \
89 "v0.h.s\[0\] is 0"
90
91 gdb_test "set \$v0.h.bf\[0\] = 1.185e-38" \
92 "v0.* = 1.185e-38" \
93 "set v0.h.bf\[0\] to 129"
94
95 gdb_test "p \$v0.h.s\[0\]" \
96 "v0.* = 129" \
97 "v0.h.s\[0\] is 129"
98}