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