* gdb.arch/i386-sse.exp, gdb.arch/i386-sse.c: New tests.
[external/binutils.git] / gdb / testsuite / gdb.arch / i386-sse.exp
1 # Copyright 2004 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 2 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, write to the Free Software
15 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
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
22 if $tracelevel {
23     strace $tracelevel
24 }
25
26 set prms_id 0
27 set bug_id 0
28
29 if ![istarget "i?86-*-*"] then {
30     verbose "Skipping i386 SSE tests."
31     return
32 }
33
34 set testfile "i386-sse"
35 set srcfile ${testfile}.c
36 set binfile ${objdir}/${subdir}/${testfile}
37 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
38     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39 }
40
41 gdb_exit
42 gdb_start
43 gdb_reinitialize_dir $srcdir/$subdir
44 gdb_load ${binfile}
45
46 if ![runto_main] then {
47     gdb_suppress_tests
48 }
49
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     }
65 }
66
67 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
68          "Breakpoint .* at .*i386-sse.c.*" \
69          "set breakpoint in main"
70 gdb_continue_to_breakpoint "continue to first breakpoint in main"
71
72 foreach r {0 1 2 3 4 5 6 7} {
73     gdb_test "print \$xmm$r.v4_float" \
74         ".. = {$r, $r.25, $r.5, $r.75}.*" \
75         "check contents of %xmm$r"
76 }
77
78 foreach r {0 1 2 3 4 5 6 7} {
79     gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r"
80 }
81
82 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
83          "Breakpoint .* at .*i386-sse.c.*" \
84          "set breakpoint in main"
85 gdb_continue_to_breakpoint "continue to second breakpoint in main"
86
87 foreach r {0 1 2 3 4 5 6 7} {
88     gdb_test "print data\[$r\]" \
89         ".. = {f = {[expr $r + 10], $r.25, $r.5, $r.75}}.*" \
90         "check contents of data\[$r\]"
91 }