Commit | Line | Data |
---|---|---|
618f726f | 1 | # Copyright 2010-2016 Free Software Foundation, Inc. |
c302619d L |
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 3 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, see <http://www.gnu.org/licenses/>. | |
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 | ||
c302619d L |
21 | |
22 | if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } { | |
23 | verbose "Skipping x86 AVX tests." | |
24 | return | |
25 | } | |
26 | ||
de5f37e1 | 27 | standard_testfile .c |
c302619d | 28 | |
4c93b1db | 29 | if [get_compiler_info] { |
c302619d L |
30 | return -1 |
31 | } | |
32 | ||
33 | set additional_flags "" | |
34 | if [test_compiler_info gcc*] { | |
125f8a3d | 35 | set additional_flags "additional_flags=-mavx -I${srcdir}/.." |
c302619d L |
36 | } |
37 | ||
38 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } { | |
39 | unsupported "compiler does not support AVX" | |
40 | return | |
41 | } | |
42 | ||
de5f37e1 | 43 | clean_restart ${binfile} |
c302619d L |
44 | |
45 | if ![runto_main] then { | |
46 | gdb_suppress_tests | |
47 | } | |
48 | ||
49 | send_gdb "print have_avx ()\r" | |
50 | gdb_expect { | |
51 | -re ".. = 1\r\n$gdb_prompt " { | |
52 | pass "check whether processor supports AVX" | |
53 | } | |
54 | -re ".. = 0\r\n$gdb_prompt " { | |
55 | verbose "processor does not support AVX; skipping AVX tests" | |
56 | return | |
57 | } | |
58 | -re ".*$gdb_prompt $" { | |
59 | fail "check whether processor supports AVX" | |
60 | } | |
61 | timeout { | |
62 | fail "check whether processor supports AVX (timeout)" | |
63 | } | |
64 | } | |
65 | ||
66 | gdb_test "break [gdb_get_line_number "first breakpoint here"]" \ | |
67 | "Breakpoint .* at .*i386-avx.c.*" \ | |
68 | "set first breakpoint in main" | |
69 | gdb_continue_to_breakpoint "continue to first breakpoint in main" | |
70 | ||
31224d9d | 71 | if [is_amd64_regs_target] { |
c302619d | 72 | set nr_regs 16 |
31224d9d L |
73 | } else { |
74 | set nr_regs 8 | |
c302619d L |
75 | } |
76 | ||
77 | for { set r 0 } { $r < $nr_regs } { incr r } { | |
78 | gdb_test "print \$ymm$r.v8_float" \ | |
79 | ".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \ | |
80 | "check float contents of %ymm$r" | |
81 | gdb_test "print \$ymm$r.v32_int8" \ | |
82 | ".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \ | |
83 | "check int8 contents of %ymm$r" | |
84 | } | |
85 | ||
86 | for { set r 0 } { $r < $nr_regs } { incr r } { | |
87 | gdb_test "set var \$ymm$r.v8_float\[0\] = $r + 10" "" "set %ymm$r" | |
88 | } | |
89 | ||
90 | gdb_test "break [gdb_get_line_number "second breakpoint here"]" \ | |
91 | "Breakpoint .* at .*i386-avx.c.*" \ | |
92 | "set second breakpoint in main" | |
93 | gdb_continue_to_breakpoint "continue to second breakpoint in main" | |
94 | ||
95 | for { set r 0 } { $r < $nr_regs } { incr r } { | |
96 | gdb_test "print data\[$r\]" \ | |
97 | ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \ | |
98 | "check contents of data\[$r\]" | |
99 | } |