2011-05-16 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-sse.exp
CommitLineData
7b6bb8da
JB
1# Copyright 2004, 2005, 2007, 2008, 2009, 2010, 2011
2# Free Software Foundation, Inc.
83ecb59f
JB
3
4# This program is free software; you can redistribute it and/or modify
5# it under the terms of the GNU General Public License as published by
e22f8b7c 6# the Free Software Foundation; either version 3 of the License, or
83ecb59f
JB
7# (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU General Public License for more details.
13#
14# You should have received a copy of the GNU General Public License
e22f8b7c 15# along with this program. If not, see <http://www.gnu.org/licenses/>.
83ecb59f
JB
16
17# Please email any bugs, comments, and/or additions to this file to:
18# bug-gdb@gnu.org
19
20# This file is part of the gdb testsuite.
21
22if $tracelevel {
23 strace $tracelevel
24}
25
83ecb59f 26
701e355d
DE
27if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
28 verbose "Skipping x86 SSE tests."
83ecb59f
JB
29 return
30}
31
32set testfile "i386-sse"
33set srcfile ${testfile}.c
34set binfile ${objdir}/${subdir}/${testfile}
b1a9c082
MK
35
36if [get_compiler_info ${binfile}] {
37 return -1
38}
39
40set additional_flags ""
41if [test_compiler_info gcc*] {
42 set additional_flags "additional_flags=-msse"
43}
44
45if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
4ac6f39d
MC
46 unsupported "compiler does not support SSE"
47 return
83ecb59f
JB
48}
49
50gdb_exit
51gdb_start
52gdb_reinitialize_dir $srcdir/$subdir
53gdb_load ${binfile}
54
55if ![runto_main] then {
56 gdb_suppress_tests
57}
58
59send_gdb "print have_sse ()\r"
60gdb_expect {
61 -re ".. = 1\r\n$gdb_prompt " {
62 pass "check whether processor supports SSE"
63 }
64 -re ".. = 0\r\n$gdb_prompt " {
65 verbose "processor does not support SSE; skipping SSE tests"
66 return
67 }
68 -re ".*$gdb_prompt $" {
69 fail "check whether processor supports SSE"
70 }
71 timeout {
72 fail "check whether processor supports SSE (timeout)"
73 }
74}
75
76gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
77 "Breakpoint .* at .*i386-sse.c.*" \
2faca73a 78 "set first breakpoint in main"
83ecb59f
JB
79gdb_continue_to_breakpoint "continue to first breakpoint in main"
80
add265ae 81if [is_ilp32_target] {
701e355d
DE
82 set nr_regs 8
83} else {
84 set nr_regs 16
85}
86
87for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f 88 gdb_test "print \$xmm$r.v4_float" \
8d5df71a 89 ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \
e784b426
JK
90 "check float contents of %xmm$r"
91 gdb_test "print \$xmm$r.v16_int8" \
ea37ba09 92 ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
e784b426 93 "check int8 contents of %xmm$r"
83ecb59f
JB
94}
95
701e355d 96for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f
JB
97 gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
98}
99
100gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
101 "Breakpoint .* at .*i386-sse.c.*" \
2faca73a 102 "set second breakpoint in main"
83ecb59f
JB
103gdb_continue_to_breakpoint "continue to second breakpoint in main"
104
701e355d 105for { set r 0 } { $r < $nr_regs } { incr r } {
83ecb59f 106 gdb_test "print data\[$r\]" \
8d5df71a 107 ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \
83ecb59f
JB
108 "check contents of data\[$r\]"
109}
This page took 0.66404 seconds and 4 git commands to generate.