1 # Copyright 2010-2013 Free Software Foundation, Inc.
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.
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.
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/>.
16 # Please email any bugs, comments, and/or additions to this file to:
19 # This file is part of the gdb testsuite.
22 if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
23 verbose "Skipping x86 AVX tests."
27 set testfile "i386-avx"
28 set srcfile ${testfile}.c
29 set binfile ${objdir}/${subdir}/${testfile}
31 if [get_compiler_info] {
35 set additional_flags ""
36 if [test_compiler_info gcc*] {
37 set additional_flags "additional_flags=-mavx -I${srcdir}/../common"
40 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug $additional_flags]] != "" } {
41 unsupported "compiler does not support AVX"
47 gdb_reinitialize_dir $srcdir/$subdir
50 if ![runto_main] then {
54 send_gdb "print have_avx ()\r"
56 -re ".. = 1\r\n$gdb_prompt " {
57 pass "check whether processor supports AVX"
59 -re ".. = 0\r\n$gdb_prompt " {
60 verbose "processor does not support AVX; skipping AVX tests"
63 -re ".*$gdb_prompt $" {
64 fail "check whether processor supports AVX"
67 fail "check whether processor supports AVX (timeout)"
71 gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
72 "Breakpoint .* at .*i386-avx.c.*" \
73 "set first breakpoint in main"
74 gdb_continue_to_breakpoint "continue to first breakpoint in main"
76 if [is_amd64_regs_target] {
82 for { set r 0 } { $r < $nr_regs } { incr r } {
83 gdb_test "print \$ymm$r.v8_float" \
84 ".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \
85 "check float contents of %ymm$r"
86 gdb_test "print \$ymm$r.v32_int8" \
87 ".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \
88 "check int8 contents of %ymm$r"
91 for { set r 0 } { $r < $nr_regs } { incr r } {
92 gdb_test "set var \$ymm$r.v8_float\[0\] = $r + 10" "" "set %ymm$r"
95 gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
96 "Breakpoint .* at .*i386-avx.c.*" \
97 "set second breakpoint in main"
98 gdb_continue_to_breakpoint "continue to second breakpoint in main"
100 for { set r 0 } { $r < $nr_regs } { incr r } {
101 gdb_test "print data\[$r\]" \
102 ".. = \\{f = \\{[expr $r + 10], $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}\\}.*" \
103 "check contents of data\[$r\]"