xref: /netbsd-src/external/gpl3/gdb.old/dist/gdb/testsuite/gdb.arch/x86-avx512fp16.exp (revision 32d1c65c71fbdb65a012e8392a62a757dd6853e9)
1# Copyright 2021-2023 Free Software Foundation, Inc.
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
14# along with this program.  If not, see <http://www.gnu.org/licenses/>.
15
16# Test fp16 support in AVX512 registers.
17
18if { [skip_avx512fp16_tests] } {
19    unsupported "target does not support AVX512fp16"
20    return -1
21}
22
23standard_testfile
24
25if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
26    return -1
27}
28
29if { ![runto_main] } {
30    return -1
31}
32
33# Test xmm.
34set line1 [gdb_get_line_number "first breakpoint here"]
35gdb_breakpoint $line1
36gdb_continue_to_breakpoint "line1" ".*$srcfile:$line1.*"
37
38gdb_test "print \$xmm0.v8_half" \
39    "= \\{0.5, 0.625, 0.75, 0.875, 0, 0, 0, 0\\}"
40
41gdb_test "print \$xmm6.v8_half" \
42    "= \\{3.5, 3.625, 3.75, 3.875, 0, 0, 0, 0\\}"
43
44# Test ymm.
45set line2 [gdb_get_line_number "second breakpoint here"]
46gdb_breakpoint $line2
47gdb_continue_to_breakpoint "line2" ".*$srcfile:$line2.*"
48
49gdb_test "print \$ymm0.v16_half\[1\]" "= 10.25"
50gdb_test "print \$ymm6.v16_half\[1\]" "= 22.25"
51
52# Test zmm.
53set line3 [gdb_get_line_number "third breakpoint here"]
54gdb_breakpoint $line3
55gdb_continue_to_breakpoint "line3" ".*$srcfile:$line3.*"
56
57gdb_test "print \$zmm0.v32_half\[1\]" "= 28.5"
58gdb_test "print \$zmm6.v32_half\[1\]" "= 76.5"
59
60# Test setting of half values.
61gdb_test_no_output "set var \$xmm0.v8_half\[0\] = 32.25"
62gdb_test_no_output "set var \$ymm3.v16_half\[1\] = 33.5"
63gdb_test_no_output "set var \$zmm7.v32_half\[2\] = 22.75"
64
65gdb_test "p \$xmm0.v8_half\[0\]" "= 32.25"
66gdb_test "p \$ymm3.v16_half\[1\]" "= 33.5"
67gdb_test "p \$zmm7.v32_half\[2\]" "= 22.75"
68