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