Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2004, 2005, 2007, 2008, 2009, 2010 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 | ||
21 | if $tracelevel { | |
22 | strace $tracelevel | |
23 | } | |
24 | ||
25 | set prms_id 0 | |
26 | set bug_id 0 | |
27 | ||
701e355d DE |
28 | if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { |
29 | verbose "Skipping x86 SSE tests." | |
83ecb59f JB |
30 | return |
31 | } | |
32 | ||
33 | set testfile "i386-sse" | |
34 | set srcfile ${testfile}.c | |
35 | set binfile ${objdir}/${subdir}/${testfile} | |
b1a9c082 MK |
36 | |
37 | if [get_compiler_info ${binfile}] { | |
38 | return -1 | |
39 | } | |
40 | ||
41 | set additional_flags "" | |
42 | if [test_compiler_info gcc*] { | |
43 | set additional_flags "additional_flags=-msse" | |
44 | } | |
45 | ||
46 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { | |
4ac6f39d MC |
47 | unsupported "compiler does not support SSE" |
48 | return | |
83ecb59f JB |
49 | } |
50 | ||
51 | gdb_exit | |
52 | gdb_start | |
53 | gdb_reinitialize_dir $srcdir/$subdir | |
54 | gdb_load ${binfile} | |
55 | ||
56 | if ![runto_main] then { | |
57 | gdb_suppress_tests | |
58 | } | |
59 | ||
60 | send_gdb "print have_sse ()\r" | |
61 | gdb_expect { | |
62 | -re ".. = 1\r\n$gdb_prompt " { | |
63 | pass "check whether processor supports SSE" | |
64 | } | |
65 | -re ".. = 0\r\n$gdb_prompt " { | |
66 | verbose "processor does not support SSE; skipping SSE tests" | |
67 | return | |
68 | } | |
69 | -re ".*$gdb_prompt $" { | |
70 | fail "check whether processor supports SSE" | |
71 | } | |
72 | timeout { | |
73 | fail "check whether processor supports SSE (timeout)" | |
74 | } | |
75 | } | |
76 | ||
77 | gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ | |
78 | "Breakpoint .* at .*i386-sse.c.*" \ | |
2faca73a | 79 | "set first breakpoint in main" |
83ecb59f JB |
80 | gdb_continue_to_breakpoint "continue to first breakpoint in main" |
81 | ||
701e355d DE |
82 | if [istarget i?86-*-*] { |
83 | set nr_regs 8 | |
84 | } else { | |
85 | set nr_regs 16 | |
86 | } | |
87 | ||
88 | for { set r 0 } { $r < $nr_regs } { incr r } { | |
83ecb59f | 89 | gdb_test "print \$xmm$r.v4_float" \ |
8d5df71a | 90 | ".. = \\{$r, $r.25, $r.5, $r.75\\}.*" \ |
e784b426 JK |
91 | "check float contents of %xmm$r" |
92 | gdb_test "print \$xmm$r.v16_int8" \ | |
ea37ba09 | 93 | ".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \ |
e784b426 | 94 | "check int8 contents of %xmm$r" |
83ecb59f JB |
95 | } |
96 | ||
701e355d | 97 | for { set r 0 } { $r < $nr_regs } { incr r } { |
83ecb59f JB |
98 | gdb_test "set var \$xmm$r.v4_float\[0\] = $r + 10" "" "set %xmm$r" |
99 | } | |
100 | ||
101 | gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ | |
102 | "Breakpoint .* at .*i386-sse.c.*" \ | |
2faca73a | 103 | "set second breakpoint in main" |
83ecb59f JB |
104 | gdb_continue_to_breakpoint "continue to second breakpoint in main" |
105 | ||
701e355d | 106 | for { set r 0 } { $r < $nr_regs } { incr r } { |
83ecb59f | 107 | gdb_test "print data\[$r\]" \ |
8d5df71a | 108 | ".. = \\{f = \\{[expr $r + 10], $r.25, $r.5, $r.75\\}\\}.*" \ |
83ecb59f JB |
109 | "check contents of data\[$r\]" |
110 | } |