Update copyright year range in header of all files managed by GDB
[binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-sse.exp
bloba178247e066fa5a64d7db573a95de08181893ce6
1 # Copyright 2004-2023 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Please email any bugs, comments, and/or additions to this file to:
17 # bug-gdb@gnu.org
19 # This file is part of the gdb testsuite.
22 if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
23     verbose "Skipping x86 SSE tests."
24     return
27 standard_testfile .c
29 set flags { debug }
31 # C11 for _Alignas, gnu for asm.
32 lappend flags additional_flags=-std=gnu11
34 if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
35     lappend flags "additional_flags=-msse -I${srcdir}/.."
38 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
39           $flags] != "" } {
40     unsupported "compiler does not support SSE"
41     return
44 clean_restart ${binfile}
46 if {![runto_main]} {
47     return 0
50 send_gdb "print have_sse ()\r"
51 gdb_expect {
52     -re ".. = 1\r\n$gdb_prompt " {
53         pass "check whether processor supports SSE"
54     }
55     -re ".. = 0\r\n$gdb_prompt " {
56         verbose "processor does not support SSE; skipping SSE tests"
57         return
58     }
59     -re ".*$gdb_prompt $" {
60         fail "check whether processor supports SSE"
61     }
62     timeout {
63         fail "check whether processor supports SSE (timeout)"
64     }
67 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
68          "Breakpoint .* at .*i386-sse.c.*" \
69          "set first breakpoint in main"
70 gdb_continue_to_breakpoint "continue to first breakpoint in main"
72 if [is_amd64_regs_target] {
73     set nr_regs 16
74 } else {
75     set nr_regs 8
78 for { set r 0 } { $r < $nr_regs } { incr r } {
79     gdb_test "print \$xmm$r.v4_float" \
80         ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
81         "check float contents of %xmm$r"
82     gdb_test "print \$xmm$r.v16_int8" \
83         ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
84         "check int8 contents of %xmm$r"
87 for { set r 0 } { $r < $nr_regs } { incr r } {
88     gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
91 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
92          "Breakpoint .* at .*i386-sse.c.*" \
93          "set second breakpoint in main"
94 gdb_continue_to_breakpoint "continue to second breakpoint in main"
96 for { set r 0 } { $r < $nr_regs } { incr r } {
97     gdb_test "print data\[$r\]" \
98         ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
99         "check contents of data\[$r\]"