]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-sse.exp
Update copyright year range in all GDB files
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-sse.exp
CommitLineData
3666a048 1# Copyright 2004-2021 Free Software Foundation, Inc.
83ecb59f
JB
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
e22f8b7c 5# the Free Software Foundation; either version 3 of the License, or
83ecb59f
JB
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
e22f8b7c 14# along with this program. If not, see <http://www.gnu.org/licenses/>.
83ecb59f
JB
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
83ecb59f 21
701e355d
DE
22if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
23 verbose "Skipping x86 SSE tests."
83ecb59f
JB
24 return
25}
26
de5f37e1 27standard_testfile .c
b1a9c082 28
4c93b1db 29if [get_compiler_info] {
b1a9c082
MK
30 return -1
31}
32
33set additional_flags ""
9fcafd23 34if { [test_compiler_info gcc*] || [test_compiler_info clang*] } {
125f8a3d 35 set additional_flags "additional_flags=-msse -I${srcdir}/.."
b1a9c082
MK
36}
37
38if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
4ac6f39d
MC
39 unsupported "compiler does not support SSE"
40 return
83ecb59f
JB
41}
42
de5f37e1 43clean_restart ${binfile}
83ecb59f
JB
44
45if ![runto_main] then {
c8ee3f04
PW
46 fail "can't run to main"
47 return 0
83ecb59f
JB
48}
49
50send_gdb "print have_sse ()\r"
51gdb_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 }
65}
66
67gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
68 "Breakpoint .* at .*i386-sse.c.*" \
2faca73a 69 "set first breakpoint in main"
83ecb59f
JB
70gdb_continue_to_breakpoint "continue to first breakpoint in main"
71
31224d9d 72if [is_amd64_regs_target] {
701e355d 73 set nr_regs 16
31224d9d
L
74} else {
75 set nr_regs 8
701e355d
DE
76}
77
78for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f 79 gdb_test "print \$xmm$r.v4_float" \
8d5df71a 80 ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
e784b426
JK
81 "check float contents of %xmm$r"
82 gdb_test "print \$xmm$r.v16_int8" \
ea37ba09 83 ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
e784b426 84 "check int8 contents of %xmm$r"
83ecb59f
JB
85}
86
701e355d 87for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f
JB
88 gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
89}
90
91gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
92 "Breakpoint .* at .*i386-sse.c.*" \
2faca73a 93 "set second breakpoint in main"
83ecb59f
JB
94gdb_continue_to_breakpoint "continue to second breakpoint in main"
95
701e355d 96for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f 97 gdb_test "print data\[$r\]" \
8d5df71a 98 ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
83ecb59f
JB
99 "check contents of data\[$r\]"
100}