1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
# Copyright 2014-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Please email any bugs, comments, and/or additions to this file to:
# bug-gdb@gnu.org
# This file is part of the gdb testsuite.
if { ![istarget i?86-*-*] && ![istarget x86_64-*-* ] } {
verbose "Skipping x86 AVX512 tests."
return
}
standard_testfile
set comp_flags "-mavx512f -I${srcdir}/../nat"
if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
[list debug nowarnings additional_flags=${comp_flags}]] } {
return -1
}
if ![runto_main] {
untested "could not run to main"
return -1
}
set supports_avx512 0
set test "probe AVX512 support"
gdb_test_multiple "print have_avx512()" $test {
-re ".. = 1\r\n$gdb_prompt $" {
pass $test
set supports_avx512 1
}
-re ".. = 0\r\n$gdb_prompt $" {
pass $test
}
}
if { !$supports_avx512 } {
unsupported "processor does not support AVX512"
return
}
gdb_test "break [gdb_get_line_number "first breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set first breakpoint in main"
gdb_continue_to_breakpoint "continue to first breakpoint in main"
set nr_regs 8
for { set r 1 } { $r < $nr_regs } { incr r } {
gdb_test "print/x \$k$r" \
".. = 0x[format %x $r]2[format %x $r]1" \
"check contents of %k$r"
}
for { set r 1 } { $r < $nr_regs } { incr r } {
gdb_test "set var \$k$r = 0x$r$r$r$r" "" "set %k$r"
}
gdb_test "break [gdb_get_line_number "second breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set second breakpoint in main"
gdb_continue_to_breakpoint "continue to second breakpoint in main"
set nr_regs 7
for { set r 0 } { $r < $nr_regs } { incr r } {
set val [expr $r + 1]
gdb_test "print/x k_data\[$r\]" \
".. = 0x$val$val$val$val" \
"check contents of k_data\[$r\]"
}
gdb_test "break [gdb_get_line_number "third breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set third breakpoint in main"
gdb_continue_to_breakpoint "continue to third breakpoint in main"
if [is_amd64_regs_target] {
set nr_regs 8
} else {
set nr_regs 32
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print \$zmm$r.v8_double" \
".. = \\{$r, $r.125, $r.25, $r.375, $r.5, $r.625, $r.75, $r.875\\}.*" \
"check double contents of %zmm$r"
gdb_test "print \$zmm$r.v32_int16" \
".. = \\{(-?\[0-9\]+, ){31}-?\[0-9\]+\\}.*" \
"check int16 contents of %zmm$r"
gdb_test "print \$ymm$r.v4_double" \
".. = \\{$r, $r.125, $r.25, $r.375\\}.*" \
"check float contents of %ymm$r"
gdb_test "print \$ymm$r.v16_int16" \
".. = \\{(-?\[0-9\]+, ){15}-?\[0-9\]+\\}.*" \
"check int16 contents of %ymm$r"
gdb_test "print \$xmm$r.v2_double" \
".. = \\{$r, $r.125\\}.*" \
"check float contents of %xmm$r"
gdb_test "print \$xmm$r.v8_int16" \
".. = \\{(-?\[0-9\]+, ){7}-?\[0-9\]+\\}.*" \
"check int16 contents of %xmm$r"
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "set var \$zmm$r.v8_double\[0\] = $r + 10" "" "set %zmm$r.v8_double\[0\]"
gdb_test "set var \$zmm$r.v8_double\[1\] = $r + 10.125" "" "set %zmm$r.v8_double\[1\]"
gdb_test "set var \$zmm$r.v8_double\[2\] = $r + 10.25" "" "set %zmm$r.v8_double\[2\]"
gdb_test "set var \$zmm$r.v8_double\[3\] = $r + 10.375" "" "set %zmm$r.v8_double\[3\]"
gdb_test "set var \$zmm$r.v8_double\[4\] = $r + 10.5" "" "set %zmm$r.v8_double\[4\]"
gdb_test "set var \$zmm$r.v8_double\[5\] = $r + 10.625" "" "set %zmm$r.v8_double\[5\]"
gdb_test "set var \$zmm$r.v8_double\[6\] = $r + 10.75" "" "set %zmm$r.v8_double\[6\]"
gdb_test "set var \$zmm$r.v8_double\[7\] = $r + 10.875" "" "set %zmm$r.v8_double\[7\]"
}
gdb_test "break [gdb_get_line_number "fourth breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set fourth breakpoint in main"
gdb_continue_to_breakpoint "continue to fourth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
".. = \\{f = \\{[expr $r + 10], [expr $r.125 + 10], [expr $r.25 + 10], [expr $r.375 + 10], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing ZMM regs"
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "set var \$ymm$r.v4_double\[0\] = $r + 20" "" "set %ymm$r.v4_double\[0\]"
gdb_test "set var \$ymm$r.v4_double\[1\] = $r + 20.125" "" "set %ymm$r.v4_double\[1\]"
gdb_test "set var \$ymm$r.v4_double\[2\] = $r + 20.25" "" "set %ymm$r.v4_double\[2\]"
gdb_test "set var \$ymm$r.v4_double\[3\] = $r + 20.375" "" "set %ymm$r.v4_double\[3\]"
}
gdb_test "break [gdb_get_line_number "fifth breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set fifth breakpoint in main"
gdb_continue_to_breakpoint "continue to fifth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
".. = \\{f = \\{[expr $r + 20], [expr $r.125 + 20], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing YMM regs"
}
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "set var \$xmm$r.v2_double\[0\] = $r + 30" "" "set %xmm$r.v2_double\[0\]"
gdb_test "set var \$xmm$r.v2_double\[1\] = $r + 30.125" "" "set %xmm$r.v2_double\[1\]"
}
gdb_test "break [gdb_get_line_number "sixth breakpoint here"]" \
"Breakpoint .* at .*i386-avx512.c.*" \
"set sixth breakpoint in main"
gdb_continue_to_breakpoint "continue to sixth breakpoint in main"
for { set r 0 } { $r < $nr_regs } { incr r } {
gdb_test "print zmm_data\[$r\]" \
".. = \\{f = \\{[expr $r + 30], [expr $r.125 + 30], [expr $r.25 + 20], [expr $r.375 + 20], [expr $r.5 + 10], [expr $r.625 + 10], [expr $r.75 + 10], [expr $r.875 + 10]\\}\\}.*" \
"check contents of zmm_data\[$r\] after writing XMM regs"
}
|