]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.arch/i386-sse.exp
Update copyright year range in header of all files managed by GDB
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-sse.exp
1 # Copyright 2004-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 standard_testfile .c
25
26 set flags { debug }
27
28 # C11 for _Alignas, gnu for asm.
29 lappend flags additional_flags=-std=gnu11
30
31 if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
32 lappend flags "additional_flags=-msse -I${srcdir}/.."
33 }
34
35 lappend_include_file flags $srcdir/lib/precise-aligned-alloc.c
36
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
38 $flags] != "" } {
39 unsupported "compiler does not support SSE"
40 return
41 }
42
43 clean_restart ${binfile}
44
45 if {![runto_main]} {
46 return 0
47 }
48
49 send_gdb "print have_sse ()\r"
50 gdb_expect {
51 -re ".. = 1\r\n$gdb_prompt " {
52 pass "check whether processor supports SSE"
53 }
54 -re ".. = 0\r\n$gdb_prompt " {
55 verbose "processor does not support SSE; skipping SSE tests"
56 return
57 }
58 -re ".*$gdb_prompt $" {
59 fail "check whether processor supports SSE"
60 }
61 timeout {
62 fail "check whether processor supports SSE (timeout)"
63 }
64 }
65
66 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
67 "Breakpoint .* at .*i386-sse.c.*" \
68 "set first breakpoint in main"
69 gdb_continue_to_breakpoint "continue to first breakpoint in main"
70
71 if [is_amd64_regs_target] {
72 set nr_regs 16
73 } else {
74 set nr_regs 8
75 }
76
77 for { set r 0 } { $r < $nr_regs } { incr r } {
78 gdb_test "print \$xmm$r.v4_float" \
79 ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
80 "check float contents of %xmm$r"
81 gdb_test "print \$xmm$r.v16_int8" \
82 ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
83 "check int8 contents of %xmm$r"
84 }
85
86 for { set r 0 } { $r < $nr_regs } { incr r } {
87 gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
88 }
89
90 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
91 "Breakpoint .* at .*i386-sse.c.*" \
92 "set second breakpoint in main"
93 gdb_continue_to_breakpoint "continue to second breakpoint in main"
94
95 for { set r 0 } { $r < $nr_regs } { incr r } {
96 gdb_test "print data\[$r\]" \
97 ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
98 "check contents of data\[$r\]"
99 }