]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-avx.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-avx.exp
1 # Copyright 2010-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 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@gnu.org
18
19 # This file is part of the gdb testsuite.
20
21
22 if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
23 verbose "Skipping x86 AVX tests."
24 return
25 }
26
27 if { ![have_avx] } {
28 verbose "Skipping x86 AVX tests."
29 return
30 }
31
32 standard_testfile .c
33
34 set flags { debug }
35
36 # C11 for _Alignas, gnu for asm.
37 lappend flags additional_flags=-std=gnu11
38
39 if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
40 lappend flags "additional_flags=-mavx -I${srcdir}/.."
41 }
42
43 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
44 $flags] != "" } {
45 unsupported "compiler does not support AVX"
46 return
47 }
48
49 clean_restart ${binfile}
50
51 if {![runto_main]} {
52 return 0
53 }
54
55 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
56 "Breakpoint .* at .*i386-avx.c.*" \
57 "set first breakpoint in main"
58 gdb_continue_to_breakpoint "continue to first breakpoint in main"
59
60 if [is_amd64_regs_target] {
61 set nr_regs 16
62 } else {
63 set nr_regs 8
64 }
65
66 for { set r 0 } { $r < $nr_regs } { incr r } {
67 gdb_test "print \$ymm$r.v8_float" \
68 ".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \
69 "check float contents of %ymm$r"
70 gdb_test "print \$ymm$r.v32_int8" \
71 ".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \
72 "check int8 contents of %ymm$r"
73 }
74
75 for { set r 0 } { $r < $nr_regs } { incr r } {
76 gdb_test "set var \$ymm$r.v8_float\[0\] = $r + 10" "" "set %ymm$r"
77 }
78
79 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
80 "Breakpoint .* at .*i386-avx.c.*" \
81 "set second breakpoint in main"
82 gdb_continue_to_breakpoint "continue to second breakpoint in main"
83
84 for { set r 0 } { $r < $nr_regs } { incr r } {
85 gdb_test "print data\[$r\]" \
86 ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
87 "check contents of data\[$r\]"
88 }
89
90 # If testing with a remote protocol target, check that we can
91 # force-disable the use of XML descriptions. This should make the
92 # client/server fallback to the pre-XML register file.
93
94 with_test_prefix "force-disable xml descriptions" {
95 if {[target_info gdb_protocol] == "remote"
96 || [target_info gdb_protocol] == "extended-remote"} {
97
98 save_vars { GDBFLAGS } {
99 append GDBFLAGS " -ex \"set remote target-features-packet off\""
100 clean_restart ${binfile}
101 }
102
103 if {![runto_main]} {
104 return
105 }
106
107 # With qXfer:features:read disabled, we won't know anything
108 # about YMM registers.
109 gdb_test "print \$ymm0" " = void"
110 gdb_test "print \$xmm0" "v4_float.*"
111 }
112 }