i386-avx-reverse.exp revision 1.1 1 1.1 christos # Copyright 2009-2023 Free Software Foundation, Inc.
2 1.1 christos
3 1.1 christos # This program is free software; you can redistribute it and/or modify
4 1.1 christos # it under the terms of the GNU General Public License as published by
5 1.1 christos # the Free Software Foundation; either version 3 of the License, or
6 1.1 christos # (at your option) any later version.
7 1.1 christos #
8 1.1 christos # This program is distributed in the hope that it will be useful,
9 1.1 christos # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 1.1 christos # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 1.1 christos # GNU General Public License for more details.
12 1.1 christos #
13 1.1 christos # You should have received a copy of the GNU General Public License
14 1.1 christos # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 1.1 christos
16 1.1 christos # This file is part of the gdb testsuite.
17 1.1 christos
18 1.1 christos #
19 1.1 christos # This test tests i386 AVX instructions for reverse execution. This
20 1.1 christos # is supposed to test all supported instructions eventually.
21 1.1 christos #
22 1.1 christos
23 1.1 christos require supports_reverse
24 1.1 christos require have_avx
25 1.1 christos
26 1.1 christos # TODO: this is the case because I used xmm15 all over the test.
27 1.1 christos # Some parts of the test require xmm15 to validate some code paths, but
28 1.1 christos # that could be done only on 64bit targets and the rest could use xmm7
29 1.1 christos # instead.
30 1.1 christos if {![istarget "x86_64-*-*"]} {
31 1.1 christos verbose "avx-reverse requires 64 bit targets"
32 1.1 christos return
33 1.1 christos }
34 1.1 christos
35 1.1 christos standard_testfile
36 1.1 christos
37 1.1 christos # some targets have leading underscores on assembly symbols.
38 1.1 christos set additional_flags [gdb_target_symbol_prefix_flags]
39 1.1 christos lappend_include_file alloc_lib $srcdir/lib/precise-aligned-alloc.c
40 1.1 christos
41 1.1 christos if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
42 1.1 christos [list debug $additional_flags $alloc_lib]]} {
43 1.1 christos return -1
44 1.1 christos }
45 1.1 christos
46 1.1 christos # Shorthand to test reversing through one instruction and
47 1.1 christos # testing if a register has the expected value.
48 1.1 christos # Prefix, if included, should end with a colon and space.
49 1.1 christos
50 1.1 christos proc test_one_register {insn register value {prefix ""}} {
51 1.1 christos gdb_test "reverse-step" "$insn.*" \
52 1.1 christos "${prefix}reverse-step from $insn to test register $register"
53 1.1 christos
54 1.1 christos if {[regexp {^ymm} $register]} {
55 1.1 christos set value "\\\{$value\\\}"
56 1.1 christos }
57 1.1 christos
58 1.1 christos gdb_test "info register $register" \
59 1.1 christos "$register.*int128 = $value.*" \
60 1.1 christos "${prefix}verify $register before $insn"
61 1.1 christos }
62 1.1 christos
63 1.1 christos # Shorthand to test reversing through one instruction and
64 1.1 christos # testing if a general purpose register has the expected value.
65 1.1 christos # Prefix, if included, should end with a colon and space.
66 1.1 christos
67 1.1 christos proc test_one_general_register {insn register value {prefix ""}} {
68 1.1 christos gdb_test "reverse-step" "$insn.*" \
69 1.1 christos "${prefix}reverse-step from $insn to test register $register"
70 1.1 christos
71 1.1 christos gdb_test "info register $register" \
72 1.1 christos "$register\\s+$value.*" \
73 1.1 christos "${prefix}verify $register before $insn"
74 1.1 christos }
75 1.1 christos
76 1.1 christos # Shorthand to test reversing through one instruction and
77 1.1 christos # testing if a variable has the expected value.
78 1.1 christos # Prefix, if used, should end with a colon and space.
79 1.1 christos
80 1.1 christos proc test_one_memory {insn mem value {dynamic false} {prefix ""}} {
81 1.1 christos gdb_test "reverse-step" "$insn.*" \
82 1.1 christos "${prefix}reverse-step from $insn to test memory $mem"
83 1.1 christos
84 1.1 christos # For the dynamic buffer, we have to cast and dereference the pointer
85 1.1 christos set cast ""
86 1.1 christos if {$dynamic == true} {
87 1.1 christos set cast {(char [32]) *}
88 1.1 christos }
89 1.1 christos
90 1.1 christos gdb_test "p/x $cast$mem" \
91 1.1 christos ".*$value.*" \
92 1.1 christos "${prefix}verify $mem before $insn"
93 1.1 christos
94 1.1 christos }
95 1.1 christos
96 1.1 christos # Record the execution for the whole function, and stop at its end
97 1.1 christos # to check if we can correctly reconstruct the state.
98 1.1 christos # In the source code, the function must be FUNCTION_test, and
99 1.1 christos # at the end, it must have a comment in the form:
100 1.1 christos # /* end FUNCTION_test */
101 1.1 christos # Returns true if the full function could be recorded, false otherwise.
102 1.1 christos proc record_full_function {function} {
103 1.1 christos set end [gdb_get_line_number "end ${function}_test "]
104 1.1 christos set start [gdb_get_line_number "start ${function}_test"]
105 1.1 christos gdb_breakpoint $start temporary
106 1.1 christos gdb_breakpoint $end temporary
107 1.1 christos gdb_continue_to_breakpoint "start ${function}_test"
108 1.1 christos
109 1.1 christos if [supports_process_record] {
110 1.1 christos # Activate process record/replay.
111 1.1 christos gdb_test_no_output "record" "${function}: turn on process record"
112 1.1 christos }
113 1.1 christos
114 1.1 christos # We return early in gdb_test_multiple because the rest of the
115 1.1 christos # function is aborting recording and cleaning up to put us back in
116 1.1 christos # a known location.
117 1.1 christos gdb_test_multiple "continue" "continue to end of ${function}_test" {
118 1.1 christos -re " end ${function}_test .*\r\n$::gdb_prompt $" {
119 1.1 christos pass $gdb_test_name
120 1.1 christos return true
121 1.1 christos }
122 1.1 christos -re " Illegal instruction.*\r\n$::gdb_prompt $" {
123 1.1 christos fail $gdb_test_name
124 1.1 christos }
125 1.1 christos -re "Process record does not support VEX instruction.*" {
126 1.1 christos fail $gdb_test_name
127 1.1 christos }
128 1.1 christos }
129 1.1 christos
130 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
131 1.1 christos "delete failed record history"
132 1.1 christos # If we didn't exit early, the temporary breakpoint at the end of
133 1.1 christos # the function hasn't been hit yet, so we can just continue.
134 1.1 christos gdb_continue_to_breakpoint "end ${function}_test" ".*end ${function}_test.*"
135 1.1 christos
136 1.1 christos return false
137 1.1 christos }
138 1.1 christos
139 1.1 christos runto_main
140 1.1 christos
141 1.1 christos global hex
142 1.1 christos global decimal
143 1.1 christos
144 1.1 christos # Record all the execution for vmov tests first.
145 1.1 christos
146 1.1 christos if {[record_full_function "vmov"] == true} {
147 1.1 christos # Now execute backwards, checking all instructions.
148 1.1 christos test_one_register "vmovdqa" "ymm0" \
149 1.1 christos "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
150 1.1 christos "from register: "
151 1.1 christos test_one_register "vmovdqu" "ymm15" \
152 1.1 christos "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
153 1.1 christos "from register: "
154 1.1 christos test_one_register "vmovdqu" "ymm0" \
155 1.1 christos "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
156 1.1 christos "from register: "
157 1.1 christos
158 1.1 christos test_one_memory "vmovdqu" "dyn_buf1" \
159 1.1 christos "0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29" \
160 1.1 christos true "dynamic buffer: "
161 1.1 christos test_one_register "vmovdqu" "ymm0" \
162 1.1 christos "0x1f1e1d1c1b1a19181716151413121110, 0x1f1e1d1c1b1a19181716151413121110" \
163 1.1 christos "dynamic buffer: "
164 1.1 christos test_one_memory "vmovdqa" "dyn_buf1" "0x0 .repeats 32 times" true
165 1.1 christos test_one_register "vmovdqa" "ymm15" "0x0, 0x0"
166 1.1 christos
167 1.1 christos # Don't check the full buffer because that'd be too long
168 1.1 christos test_one_memory "vmovdqu" "global_buf1" \
169 1.1 christos "0x0 .repeats 32 times" \
170 1.1 christos false "global buffer: "
171 1.1 christos test_one_register "vmovdqu" "ymm0" \
172 1.1 christos "0x3f3e3d3c3b3a39383736353433323130, 0x3f3e3d3c3b3a39383736353433323130" \
173 1.1 christos "global buffer: "
174 1.1 christos
175 1.1 christos test_one_memory "vmovdqu" "buf1" "0x0 .repeats 32 times"
176 1.1 christos test_one_register "vmovdqu" "ymm0" "0x2726252423222120, 0x0" "local buffer: "
177 1.1 christos
178 1.1 christos test_one_register "vmovq" "xmm15" "0x3736353433323130" "reg_reset: "
179 1.1 christos test_one_register "vmovq" "xmm15" "0x0"
180 1.1 christos test_one_register "vmovd" "xmm15" "0x33323130" "reg_reset: "
181 1.1 christos test_one_register "vmovd" "xmm15" "0x0"
182 1.1 christos
183 1.1 christos with_test_prefix buffer_reset {
184 1.1 christos test_one_memory "vmovq" "dyn_buf1" \
185 1.1 christos "0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x0" true
186 1.1 christos test_one_memory "vmovq" "global_buf1" \
187 1.1 christos "0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x0"
188 1.1 christos test_one_memory "vmovq" "buf1" \
189 1.1 christos "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x0"
190 1.1 christos }
191 1.1 christos
192 1.1 christos with_test_prefix dynamic_buffers {
193 1.1 christos test_one_memory "vmovq" "dyn_buf1" "0x20, 0x21, 0x22, 0x23, 0x0" true
194 1.1 christos test_one_register "vmovq" "xmm0" "0x23222120"
195 1.1 christos test_one_memory "vmovd" "dyn_buf1" "0x0 .repeats 32 times" true
196 1.1 christos test_one_register "vmovd" "xmm0" "0x1716151413121110"
197 1.1 christos }
198 1.1 christos
199 1.1 christos with_test_prefix global_buffers {
200 1.1 christos test_one_memory "vmovq" "global_buf1" "0x10, 0x11, 0x12, 0x13, 0x0"
201 1.1 christos test_one_register "vmovq" "xmm0" "0x13121110"
202 1.1 christos test_one_memory "vmovd" "global_buf1" "0x0 .repeats 32 times"
203 1.1 christos test_one_register "vmovd" "xmm0" "0x3736353433323130"
204 1.1 christos }
205 1.1 christos
206 1.1 christos with_test_prefix local_buffers {
207 1.1 christos test_one_memory "vmovq" "buf1" "0x30, 0x31, 0x32, 0x33, 0x0"
208 1.1 christos test_one_register "vmovq" "xmm0" "0x33323130"
209 1.1 christos test_one_memory "vmovd" "buf1" "0x0 .repeats 32 times"
210 1.1 christos test_one_register "vmovd" "xmm0" "0xbeef"
211 1.1 christos }
212 1.1 christos
213 1.1 christos # regular registers don't have uint128 members, so do it manually.
214 1.1 christos with_test_prefix registers {
215 1.1 christos test_one_register "vmovq" "xmm15" "0xbeef" "reset xmm15: "
216 1.1 christos
217 1.1 christos test_one_register "vmovq" "xmm15" "0x0" "xmm0 to xmm15: "
218 1.1 christos
219 1.1 christos gdb_test "reverse-step" "vmovd %xmm0, %rcx.*" \
220 1.1 christos "reverse step to check rcx recording"
221 1.1 christos gdb_test "print/x \$rcx" "= 0x0" "rcx was recorded"
222 1.1 christos
223 1.1 christos test_one_register "vmovd" "xmm0" "0x0"
224 1.1 christos }
225 1.1 christos
226 1.1 christos # Stop recording to get a clean history.
227 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
228 1.1 christos "delete history for vmov_test"
229 1.1 christos } else {
230 1.1 christos untested "could not record vmov_test"
231 1.1 christos }
232 1.1 christos
233 1.1 christos # Move to the end of vmov_test to set up next.
234 1.1 christos gdb_test "finish" "Run till exit from.*vmov_test.*" "leaving vmov_test"
235 1.1 christos
236 1.1 christos # Starting vpunpck tests.
237 1.1 christos gdb_test_no_output \
238 1.1 christos "set \$ymm0.v4_int64 = {0x1716151413121110, 0x1f1e1d1c1b1a1918, 0x2726252423222120, 0x2f2e2d2c2b2a2928}"
239 1.1 christos gdb_test_no_output \
240 1.1 christos "set \$ymm1.v4_int64 = {0x3736353433323130, 0x3f3e3d3c3b3a3938, 0x4746454443424140, 0x4f4e4d4c4b4a4948}"
241 1.1 christos gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0x0}"
242 1.1 christos gdb_test_no_output "set \$ymm15.v2_int128 = {0xdead, 0xbeef}"
243 1.1 christos if {[record_full_function "vpunpck"] == true} {
244 1.1 christos test_one_register "vpunpckhqdq" "ymm15" \
245 1.1 christos "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x2f2e2d2c4f4e4d4c2b2a29284b4a4948" \
246 1.1 christos "ymm: "
247 1.1 christos test_one_register "vpunpckhdq" "ymm15" \
248 1.1 christos "0x17163736151435341312333211103130, 0x27264746252445442322434221204140" \
249 1.1 christos "ymm: "
250 1.1 christos test_one_register "vpunpcklwd" "ymm15" \
251 1.1 christos "0x17371636153514341333123211311030, 0x27472646254524442343224221412040" \
252 1.1 christos "ymm: "
253 1.1 christos test_one_register "vpunpcklbw" "ymm15" \
254 1.1 christos "0x1f1e3f3e1d1c3d3c1b1a3b3a19183938, 0x0" "ymm: "
255 1.1 christos
256 1.1 christos test_one_register "vpunpckhqdq" "ymm2" \
257 1.1 christos "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x0"
258 1.1 christos test_one_register "vpunpckhdq" "ymm2" \
259 1.1 christos "0x17161514131211103736353433323130, 0x0"
260 1.1 christos test_one_register "vpunpckhwd" "ymm15" \
261 1.1 christos "0x1f3f1e3e1d3d1c3c1b3b1a3a19391838, 0x0"
262 1.1 christos test_one_register "vpunpckhbw" "ymm15" \
263 1.1 christos "0x17163736151435341312333211103130, 0x0"
264 1.1 christos
265 1.1 christos test_one_register "vpunpcklqdq" "ymm2" \
266 1.1 christos "0x17161514373635341312111033323130, 0x0"
267 1.1 christos test_one_register "vpunpckldq" "ymm2" "0x0, 0x0"
268 1.1 christos test_one_register "vpunpcklwd" "ymm15" \
269 1.1 christos "0x17371636153514341333123211311030, 0x0"
270 1.1 christos test_one_register "vpunpcklbw" "ymm15" "0xdead, 0xbeef"
271 1.1 christos } else {
272 1.1 christos untested "couldn't test vpunpck tests"
273 1.1 christos }
274 1.1 christos
275 1.1 christos # Move to the end of vmov_test to set up next.
276 1.1 christos # Stop recording in case of recording errors.
277 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
278 1.1 christos "delete history for vpunpck_test"
279 1.1 christos gdb_test "finish" "Run till exit from.*vpunpck_test.*" "leaving vpunpck_test"
280 1.1 christos
281 1.1 christos # Start vpbroadcast tests
282 1.1 christos gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x0}" "set xmm0 for vpbroadcast"
283 1.1 christos gdb_test_no_output "set \$xmm1.v2_int64 = {0x1716151413121110, 0x1f1e1d1c1b1a1918}" \
284 1.1 christos "set xmm1 for vpbroadcast"
285 1.1 christos gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0x0}" "set xmm15 for vpbroadcast"
286 1.1 christos if {[record_full_function "vpbroadcast"] == true} {
287 1.1 christos test_one_register "vpbroadcastq" "ymm15" "0x13121110131211101312111013121110, 0x0"
288 1.1 christos test_one_register "vpbroadcastq" "ymm0" "0x13121110131211101312111013121110, 0x0"
289 1.1 christos
290 1.1 christos test_one_register "vpbroadcastd" "ymm15" \
291 1.1 christos "0x11101110111011101110111011101110, 0x11101110111011101110111011101110"
292 1.1 christos test_one_register "vpbroadcastd" "ymm0" \
293 1.1 christos "0x11101110111011101110111011101110, 0x11101110111011101110111011101110"
294 1.1 christos
295 1.1 christos test_one_register "vpbroadcastw" "ymm15" "0x10101010101010101010101010101010, 0x0"
296 1.1 christos test_one_register "vpbroadcastw" "ymm0" "0x10101010101010101010101010101010, 0x0"
297 1.1 christos
298 1.1 christos test_one_register "vpbroadcastb" "ymm15" "0x0, 0x0"
299 1.1 christos test_one_register "vpbroadcastb" "ymm0" "0x0, 0x0"
300 1.1 christos
301 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
302 1.1 christos "delete history for vpbroadcast_test"
303 1.1 christos } else {
304 1.1 christos untested "couldn't run vpbroadcast tests"
305 1.1 christos }
306 1.1 christos
307 1.1 christos gdb_test "finish" "Run till exit from.*vpbroadcast_test.*" \
308 1.1 christos "leaving vpbroadcast"
309 1.1 christos
310 1.1 christos # Preparation and testing of vzeroupper
311 1.1 christos gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vzeroupper"
312 1.1 christos gdb_test_no_output "set \$ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0}" \
313 1.1 christos "set ymm1 for vzeroupper"
314 1.1 christos gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vzeroupper"
315 1.1 christos gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpbroadcast"
316 1.1 christos if {[record_full_function "vzeroupper"] == true} {
317 1.1 christos # Since vzeroupper needs to save 8 or 16 registers, let's check what was
318 1.1 christos # actually recorded, instead of just undoing an instruction. Only
319 1.1 christos # really check the values of egisters 0, 1, 2 and 15 because those are
320 1.1 christos # the only ones we're setting.
321 1.1 christos gdb_test "maint print record-instruction" \
322 1.1 christos [multi_line "Register ymm0h changed: 74565" \
323 1.1 christos "Register ymm1h changed: 0" \
324 1.1 christos "Register ymm2h changed: 48879" \
325 1.1 christos "Register ymm3h changed: ${decimal}" \
326 1.1 christos "Register ymm4h changed: ${decimal}" \
327 1.1 christos "Register ymm5h changed: ${decimal}" \
328 1.1 christos "Register ymm6h changed: ${decimal}" \
329 1.1 christos "Register ymm7h changed: ${decimal}" \
330 1.1 christos "Register ymm8h changed: ${decimal}" \
331 1.1 christos "Register ymm9h changed: ${decimal}" \
332 1.1 christos "Register ymm10h changed: ${decimal}" \
333 1.1 christos "Register ymm11h changed: ${decimal}" \
334 1.1 christos "Register ymm12h changed: ${decimal}" \
335 1.1 christos "Register ymm13h changed: ${decimal}" \
336 1.1 christos "Register ymm14h changed: ${decimal}" \
337 1.1 christos "Register ymm15h changed: 3405707982" \
338 1.1 christos "Register rip changed: \[^\r\n\]+" ] \
339 1.1 christos "verify vzeroupper recording"
340 1.1 christos
341 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
342 1.1 christos "delete history for vzeroupper_test"
343 1.1 christos } else {
344 1.1 christos untested "couldn't run vzeroupper tests"
345 1.1 christos }
346 1.1 christos
347 1.1 christos gdb_test "finish" "Run till exit from.*vzeroupper_test.*" \
348 1.1 christos "leaving vzeroupper"
349 1.1 christos
350 1.1 christos # Preparation and testing vpxor instructions.
351 1.1 christos gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vpor_xor"
352 1.1 christos gdb_test_no_output "set \$ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0}" \
353 1.1 christos "set ymm1 for vpor_xor"
354 1.1 christos gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vpor_xor"
355 1.1 christos gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpor_xor"
356 1.1 christos
357 1.1 christos if {[record_full_function "vpor_xor"] == true} {
358 1.1 christos test_one_register "vpor" "ymm15" "0x0, 0xcafe4421"
359 1.1 christos test_one_register "vpor" "ymm2" "0x0, 0x0"
360 1.1 christos test_one_register "vpor" "ymm1" "0x0, 0xcafe4421"
361 1.1 christos test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "first: "
362 1.1 christos test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "second: "
363 1.1 christos
364 1.1 christos test_one_register "vpxor" "ymm15" "0x0, 0xcafeface"
365 1.1 christos test_one_register "vpxor" "ymm2" "0x0, 0xbeef"
366 1.1 christos test_one_register "vpxor" "ymm1" "0x1f1e1d1c1b1a1918, 0x0"
367 1.1 christos test_one_register "vpxor" "ymm0" "0x0, 0x0" "first: "
368 1.1 christos test_one_register "vpxor" "ymm0" "0x0, 0x12345" "second: "
369 1.1 christos
370 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
371 1.1 christos "delete history for vpor_xor_test"
372 1.1 christos } else {
373 1.1 christos untested "couldn't run vpor_xor tests"
374 1.1 christos }
375 1.1 christos gdb_test "finish" "Run till exit from.*vpor_xor_test.*" \
376 1.1 christos "leaving vpor_xor"
377 1.1 christos
378 1.1 christos # Preparation and testing vpcmpeq instructions.
379 1.1 christos gdb_test_no_output "set \$ymm0.v2_int128 = {0x12345, 0x12345}" \
380 1.1 christos "set ymm0 for vpcmpeq"
381 1.1 christos gdb_test_no_output \
382 1.1 christos "set \$ymm1.v8_int32 = {0xcafe, 0xbeef, 0xff, 0x1234, 0x0, 0xff00, 0xff0000ff, 0xface0f0f}" \
383 1.1 christos "set ymm1 for vpcmpeq"
384 1.1 christos gdb_test_no_output \
385 1.1 christos "set \$ymm2.v8_int32 = {0xcafe0, 0xbeef, 0xff00, 0x12345678, 0x90abcdef, 0xffff00, 0xff, 0xf}" \
386 1.1 christos "set ymm2 for vpcmpeq"
387 1.1 christos gdb_test_no_output "set \$ymm15.v2_int128 = {0xcafeface, 0xcafeface}" \
388 1.1 christos "set ymm15 for vpcmpeq"
389 1.1 christos
390 1.1 christos if {[record_full_function "vpcmpeq"] == true} {
391 1.1 christos test_one_register "vpcmpeqd" "ymm15" \
392 1.1 christos "0xffff0000ffffffff00000000, 0xffff0000ffff00000000" "ymm: "
393 1.1 christos test_one_register "vpcmpeqw" "ymm15" \
394 1.1 christos "0xffff0000ffffffffff000000, 0xff00ffffffff00ffff00000000" "ymm: "
395 1.1 christos test_one_register "vpcmpeqb" "ymm15" \
396 1.1 christos "0xffffffff00000000, 0x0" "ymm: "
397 1.1 christos test_one_register "vpcmpeqd" "ymm15" \
398 1.1 christos "0xffff0000ffffffff00000000, 0x0" "xmm: "
399 1.1 christos test_one_register "vpcmpeqw" "ymm15" \
400 1.1 christos "0xffff0000ffffffffff000000, 0x0" "xmm: "
401 1.1 christos test_one_register "vpcmpeqb" "ymm15" "0xcafeface, 0xcafeface" "xmm: "
402 1.1 christos
403 1.1 christos test_one_register "vpcmpeqd" "ymm0" \
404 1.1 christos "0xffff0000ffffffff00000000, 0xffff0000ffff00000000" "ymm: "
405 1.1 christos test_one_register "vpcmpeqw" "ymm0" \
406 1.1 christos "0xffff0000ffffffffff000000, 0xff00ffffffff00ffff00000000" "ymm: "
407 1.1 christos test_one_register "vpcmpeqb" "ymm0" \
408 1.1 christos "0xffffffff00000000, 0x0" "ymm: "
409 1.1 christos test_one_register "vpcmpeqd" "ymm0" \
410 1.1 christos "0xffff0000ffffffff00000000, 0x0" "xmm: "
411 1.1 christos test_one_register "vpcmpeqw" "ymm0" \
412 1.1 christos "0xffff0000ffffffffff000000, 0x0" "xmm: "
413 1.1 christos test_one_register "vpcmpeqb" "ymm0" "0x12345, 0x12345" "xmm: "
414 1.1 christos
415 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
416 1.1 christos "delete history for vpcmpeq_test"
417 1.1 christos } else {
418 1.1 christos untested "couldn't run vpcmpeq tests"
419 1.1 christos }
420 1.1 christos gdb_test "finish" "Run till exit from.*vpcmpeq_test.*" \
421 1.1 christos "leaving vpcmpeq"
422 1.1 christos
423 1.1 christos # Preparation and testing vpcmpeq instructions.
424 1.1 christos gdb_test_no_output "set \$rbx = 2" "set rbx for vpmovmskb"
425 1.1 christos gdb_test_no_output "set \$r8 = 3" "set r8 for vpmovmskb"
426 1.1 christos gdb_test_no_output "set \$r9 = 4" "set ymm15 for vpmovmskb"
427 1.1 christos
428 1.1 christos if {[record_full_function "vpmovmskb"] == true} {
429 1.1 christos test_one_general_register "vpmovmskb" "r9" "0x4"
430 1.1 christos test_one_general_register "vpmovmskb" "r8" "0x3"
431 1.1 christos test_one_general_register "vpmovmskb" "rbx" "0x2"
432 1.1 christos # Because of the infrastructure of the test, we can't set rax.
433 1.1 christos # However, it seems to always be set to 0, so this should be fine.
434 1.1 christos test_one_general_register "vpmovmskb" "rax" "0x0"
435 1.1 christos
436 1.1 christos gdb_test "record stop" "Process record is stopped.*" \
437 1.1 christos "delete history for vpmovmskb_test"
438 1.1 christos } else {
439 1.1 christos untested "couldn't run vpmovmskb tests"
440 1.1 christos }
441 1.1 christos gdb_test "finish" "Run till exit from.*vpmovmskb_test.*" \
442 1.1 christos "leaving vpmovmskb"
443