Automatic date update in version.in
[binutils-gdb.git] / gdb / testsuite / gdb.reverse / i386-avx-reverse.exp
blobf927960157eb8fff895d39e189d23219c4d3cf4e
1 # Copyright 2009-2023 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 # This file is part of the gdb testsuite.
19 # This test tests i386 AVX instructions for reverse execution.  This
20 # is supposed to test all supported instructions eventually.
23 require supports_reverse
24 require have_avx
25 require have_avx2
27 # TODO: this is the case because I used xmm15 all over the test.
28 # Some parts of the test require xmm15 to validate some code paths, but
29 # that could be done only on 64bit targets and the rest could use xmm7
30 # instead.
31 if {![istarget "x86_64-*-*"]} {
32     verbose "avx-reverse requires 64 bit targets"
33     return
36 standard_testfile
38 # some targets have leading underscores on assembly symbols.
39 set additional_flags [gdb_target_symbol_prefix_flags]
40 lappend_include_file alloc_lib $srcdir/lib/precise-aligned-alloc.c
42 if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
43          [list debug $additional_flags $alloc_lib]]} {
44     return -1
47 # Shorthand to test reversing through one instruction and
48 # testing if a register has the expected value.
49 # Prefix, if included, should end with a colon and space.
51 proc test_one_register {insn register value {prefix ""}} {
52     gdb_test "reverse-step" "$insn.*" \
53         "${prefix}reverse-step from $insn to test register $register"
55     if {[regexp {^ymm} $register]} {
56         set value "\\\{$value\\\}"
57     }
59     gdb_test "info register $register" \
60         "$register.*int128 = $value.*" \
61         "${prefix}verify $register before $insn"
64 # Shorthand to test reversing through one instruction and
65 # testing if a general purpose register has the expected value.
66 # Prefix, if included, should end with a colon and space.
68 proc test_one_general_register {insn register value {prefix ""}} {
69     gdb_test "reverse-step" "$insn.*" \
70         "${prefix}reverse-step from $insn to test register $register"
72     gdb_test "info register $register" \
73         "$register\\s+$value.*" \
74         "${prefix}verify $register before $insn"
77 # Shorthand to test reversing through one instruction and
78 # testing if a variable has the expected value.
79 # Value should always be the start of the stored values in the memory,
80 # not something found in the middle of it.
81 # Prefix, if used, should end with a colon and space.
83 proc test_one_memory {insn mem value {dynamic false} {prefix ""}} {
84     gdb_test "reverse-step" "$insn.*" \
85         "${prefix}reverse-step from $insn to test memory $mem"
87     # For the dynamic buffer, we have to cast and dereference the pointer
88     set cast ""
89     if {$dynamic == true} {
90         set cast {(char [32]) *}
91     }
93     gdb_test "p/x $cast$mem" \
94         ".*$value.*" \
95         "${prefix}verify $mem before $insn"
99 # Record the execution for the whole function, and stop at its end
100 # to check if we can correctly reconstruct the state.
101 # In the source code, the function must be FUNCTION_test, and
102 # at the end, it must have a comment in the form:
103 # /* end FUNCTION_test */
104 # Returns true if the full function could be recorded, false otherwise.
105 proc record_full_function {function} {
106     set end [gdb_get_line_number "end ${function}_test "]
107     set start [gdb_get_line_number "start ${function}_test"]
108     gdb_breakpoint $start temporary
109     gdb_breakpoint $end temporary
110     gdb_continue_to_breakpoint "start ${function}_test"
112     if [supports_process_record] {
113         # Activate process record/replay.
114         gdb_test_no_output "record" "${function}: turn on process record"
115     }
117     # We return early in gdb_test_multiple because the rest of the
118     # function is aborting recording and cleaning up to put us back in
119     # a known location.
120     gdb_test_multiple "continue" "continue to end of ${function}_test" {
121         -re " end ${function}_test .*\r\n$::gdb_prompt $" {
122             pass $gdb_test_name
123             return true
124         }
125         -re " Illegal instruction.*\r\n$::gdb_prompt $" {
126             fail $gdb_test_name
127         }
128         -re "Process record does not support VEX instruction.*" {
129             fail $gdb_test_name
130         }
131     }
133     gdb_test "record stop" "Process record is stopped.*" \
134         "delete failed record history"
135     # If we didn't exit early, the temporary breakpoint at the end of
136     # the function hasn't been hit yet, so we can just continue.
137     gdb_continue_to_breakpoint "end ${function}_test" ".*end ${function}_test.*"
139     return false
142 runto_main
144 global hex
145 global decimal
147 # Record all the execution for vmov tests first.
149 if {[record_full_function "vmov"] == true} {
150     # Now execute backwards, checking all instructions.
152     # Explicitly test for the start of the array, since the value repeats.
153     test_one_memory "vmovaps" "dyn_buf1" \
154         "\\\{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28" true
155     test_one_memory "vmovapd" "dyn_buf1" \
156         "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28" true
157     test_one_register "vmovapd" "xmm15" ".*" "dynamic buffer: "
158     test_one_register "vmovaps" "xmm0" ".*" "dynamic buffer: "
160     test_one_memory "vmovups" "dyn_buf1" \
161         "\\\{0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28" true
162     test_one_memory "vmovupd" "dyn_buf1" \
163         "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x28" true
164     test_one_register "vmovupd" "xmm15" ".*" "dynamic buffer: "
165     test_one_register "vmovups" "xmm0" ".*" "dynamic buffer: "
167     test_one_memory "vmovups" "global_buf1" \
168         "\\\{0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18"
169     test_one_memory "vmovupd" "global_buf1" \
170         "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x18"
171     test_one_register "vmovupd" "xmm15" ".*" "global buffer: "
172     test_one_register "vmovups" "xmm0" ".*" "global buffer: "
174     test_one_memory "vmovups" "buf1" \
175         "\\\{0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38"
176     test_one_memory "vmovupd" "buf1" \
177         "\\\{0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38"
178     test_one_register "vmovupd" "xmm15" "0xbff8000000000000" "local buffer: "
179     test_one_register "vmovups" "xmm0" "0xc004000000000000" "local buffer: "
181     gdb_test "rs 3" "vmovq %%xmm3.*"
183     test_one_register "vmovsd" "xmm1" "0xbff8000000000000" "from register: "
184     test_one_register "vmovsd" "xmm15" "0xc004000000000000" "from register: "
185     test_one_register "vmovsd" "xmm8" "0x40866666" "from register: "
186     test_one_register "vmovsd" "xmm2" "0x40866666" "from register: "
188     test_one_memory "vmovsd" "d1" "0xbff8000000000000"
189     test_one_memory "vmovsd" "d2" "0xc004000000000000"
190     test_one_register "vmovsd" "xmm15" "0x3fc00000"
191     test_one_register "vmovsd" "xmm1" "0x40866666"
193     # Reverse step over the line initializing the floats.
194     gdb_test "rs" "double .*" "step over double initialization"
196     test_one_register "vmovss" "xmm1" "0x3fc00000" "from register: "
197     test_one_register "vmovss" "xmm15" "0x40866666" "from register: "
198     test_one_register "vmovss" "xmm8" "0" "from register: "
199     test_one_register "vmovss" "xmm2" "0" "from register: "
201     test_one_memory "vmovss" "f1" "0x3fc00000"
202     test_one_memory "vmovss" "f2" "0x40866666"
203     test_one_register "vmovss" "xmm15" "0x0"
204     test_one_register "vmovss" "xmm1" "0x0"
206     # Reverse step over the line initializing the floats.
207     gdb_test "rs" "float .*" "step over float initialization"
209     test_one_register "vmovdqa" "ymm0" \
210         "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
211         "from register: "
212     test_one_register "vmovdqu" "ymm15" \
213         "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
214         "from register: "
215     test_one_register "vmovdqu" "ymm0" \
216         "0x2f2e2d2c2b2a29282726252423222120, 0x2f2e2d2c2b2a29282726252423222120" \
217         "from register: "
219     test_one_memory "vmovdqu" "dyn_buf1" \
220             "0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29" \
221         true "dynamic buffer: "
222     test_one_register "vmovdqu" "ymm0" \
223         "0x1f1e1d1c1b1a19181716151413121110, 0x1f1e1d1c1b1a19181716151413121110" \
224         "dynamic buffer: "
225     test_one_memory "vmovdqa" "dyn_buf1" "0x0 .repeats 32 times" true
226     test_one_register "vmovdqa" "ymm15" "0x0, 0x0"
228     # Don't check the full buffer because that'd be too long
229     test_one_memory "vmovdqu" "global_buf1" \
230         "0x0 .repeats 32 times" \
231         false "global buffer: "
232     test_one_register "vmovdqu" "ymm0" \
233         "0x3f3e3d3c3b3a39383736353433323130, 0x3f3e3d3c3b3a39383736353433323130" \
234         "global buffer: "
236     test_one_memory "vmovdqu" "buf1" "0x0 .repeats 32 times"
237     test_one_register "vmovdqu" "ymm0" "0x2726252423222120, 0x0" "local buffer: "
239     test_one_register "vmovq" "xmm15" "0x3736353433323130" "reg_reset: "
240     test_one_register "vmovq" "xmm15" "0x0"
241     test_one_register "vmovd" "xmm15" "0x33323130" "reg_reset: "
242     test_one_register "vmovd" "xmm15" "0x0"
244     with_test_prefix buffer_reset {
245         test_one_memory "vmovq" "dyn_buf1" \
246             "0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x0" true
247         test_one_memory "vmovq" "global_buf1" \
248             "0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x0"
249         test_one_memory "vmovq" "buf1" \
250             "0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x0"
251     }
253     with_test_prefix dynamic_buffers {
254         test_one_memory "vmovq" "dyn_buf1" "0x20, 0x21, 0x22, 0x23, 0x0" true
255         test_one_register "vmovq" "xmm0" "0x23222120"
256         test_one_memory "vmovd" "dyn_buf1" "0x0 .repeats 32 times" true
257         test_one_register "vmovd" "xmm0" "0x1716151413121110"
258     }
260     with_test_prefix global_buffers {
261         test_one_memory "vmovq" "global_buf1" "0x10, 0x11, 0x12, 0x13, 0x0"
262         test_one_register "vmovq" "xmm0" "0x13121110"
263         test_one_memory "vmovd" "global_buf1" "0x0 .repeats 32 times"
264         test_one_register "vmovd" "xmm0" "0x3736353433323130"
265     }
267     with_test_prefix local_buffers {
268         test_one_memory "vmovq" "buf1" "0x30, 0x31, 0x32, 0x33, 0x0"
269         test_one_register "vmovq" "xmm0" "0x33323130"
270         test_one_memory "vmovd" "buf1" "0x0 .repeats 32 times"
271         test_one_register "vmovd" "xmm0" "0xbeef"
272     }
274     # regular registers don't have uint128 members, so do it manually.
275     with_test_prefix registers {
276         test_one_register "vmovq" "xmm15" "0xbeef" "reset xmm15: "
278         test_one_register "vmovq" "xmm15" "0x0" "xmm0 to xmm15: "
280         gdb_test "reverse-step" "vmovd %xmm0, %rcx.*" \
281             "reverse step to check rcx recording"
282         gdb_test "print/x \$rcx" "= 0x0" "rcx was recorded"
284         test_one_register "vmovd" "xmm0" "0x0"
285     }
287     # Stop recording to get a clean history.
288     gdb_test "record stop" "Process record is stopped.*" \
289         "delete history for vmov_test"
290 } else {
291     untested "could not record vmov_test"
294 # Move to the end of vmov_test to set up next.
295 gdb_test "finish" "Run till exit from.*vmov_test.*" "leaving vmov_test"
297 # Starting vpunpck tests.
298 gdb_test_no_output \
299     "set \$ymm0.v4_int64 = {0x1716151413121110, 0x1f1e1d1c1b1a1918, 0x2726252423222120, 0x2f2e2d2c2b2a2928}"
300 gdb_test_no_output \
301     "set \$ymm1.v4_int64 = {0x3736353433323130, 0x3f3e3d3c3b3a3938, 0x4746454443424140, 0x4f4e4d4c4b4a4948}"
302 gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0x0}"
303 gdb_test_no_output "set \$ymm15.v2_int128 = {0xdead, 0xbeef}"
304 if {[record_full_function "vpunpck"] == true} {
305     # Floating point unpack instructions.
306     test_one_register "vunpckhpd" "ymm15" \
307         "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x0"
308     test_one_register "vunpckhpd" "ymm2" \
309         "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x2f2e2d2c4f4e4d4c2b2a29284b4a4948"
310     test_one_register "vunpckhps" "ymm2" \
311         "0x17161514131211103736353433323130, 0x0"
312     test_one_register "vunpckhps" "ymm15" \
313         "0x17161514131211103736353433323130, 0x27262524232221204746454443424140"
314     test_one_register "vunpcklpd" "ymm15" \
315         "0x17161514373635341312111033323130, 0x0"
316     test_one_register "vunpcklpd" "ymm2" \
317         "0x17161514373635341312111033323130, 0x27262524474645442322212043424140"
318     test_one_register "vunpcklps" "ymm2" \
319         "0x1f1e1d1c1b1a19183f3e3d3c3b3a3938, 0x0"
320     test_one_register "vunpcklps" "ymm15" \
321         "0x1f1e1d1c1b1a19183f3e3d3c3b3a3938, 0x2f2e2d2c2b2a29284f4e4d4c4b4a4948"
324     test_one_register "vpunpckhqdq" "ymm15" \
325         "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x2f2e2d2c4f4e4d4c2b2a29284b4a4948" \
326         "ymm: "
327     test_one_register "vpunpckhdq" "ymm15" \
328         "0x17163736151435341312333211103130, 0x27264746252445442322434221204140" \
329         "ymm: "
330     test_one_register "vpunpcklwd" "ymm15" \
331         "0x17371636153514341333123211311030, 0x27472646254524442343224221412040" \
332         "ymm: "
333     test_one_register "vpunpcklbw" "ymm15" \
334         "0x1f1e3f3e1d1c3d3c1b1a3b3a19183938, 0x0" "ymm: "
336     test_one_register "vpunpckhqdq" "ymm2" \
337         "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x0"
338     test_one_register "vpunpckhdq" "ymm2" \
339         "0x17161514131211103736353433323130, 0x0"
340     test_one_register "vpunpckhwd" "ymm15" \
341         "0x1f3f1e3e1d3d1c3c1b3b1a3a19391838, 0x0"
342     test_one_register "vpunpckhbw" "ymm15" \
343         "0x17163736151435341312333211103130, 0x0"
345     test_one_register "vpunpcklqdq" "ymm2" \
346         "0x17161514373635341312111033323130, 0x0"
347     test_one_register "vpunpckldq" "ymm2" "0x0, 0x0"
348     test_one_register "vpunpcklwd" "ymm15" \
349         "0x17371636153514341333123211311030, 0x0"
350     test_one_register "vpunpcklbw" "ymm15" "0xdead, 0xbeef"
352     # Move to the end of vmov_test to set up next.
353     # Stop recording in case of recording errors.
354     gdb_test "record stop" "Process record is stopped.*" \
355         "delete history for vpunpck_test"
356 } else {
357     untested "couldn't test vpunpck tests"
360 gdb_test "finish" "Run till exit from.*vpunpck_test.*" "leaving vpunpck_test"
362 # Start vpbroadcast tests
363 gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x0}" "set xmm0 for vpbroadcast"
364 gdb_test_no_output "set \$xmm1.v2_int64 = {0x1716151413121110, 0x1f1e1d1c1b1a1918}" \
365     "set xmm1 for vpbroadcast"
366 gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0x0}" "set xmm15 for vpbroadcast"
367 if {[record_full_function "vpbroadcast"] == true} {
368     test_one_register "vpbroadcastq" "ymm15" "0x13121110131211101312111013121110, 0x0"
369     test_one_register "vpbroadcastq" "ymm0"  "0x13121110131211101312111013121110, 0x0"
371     test_one_register "vpbroadcastd" "ymm15" \
372         "0x11101110111011101110111011101110, 0x11101110111011101110111011101110"
373     test_one_register "vpbroadcastd" "ymm0"  \
374         "0x11101110111011101110111011101110, 0x11101110111011101110111011101110"
376     test_one_register "vpbroadcastw" "ymm15" "0x10101010101010101010101010101010, 0x0"
377     test_one_register "vpbroadcastw" "ymm0"  "0x10101010101010101010101010101010, 0x0"
379     test_one_register "vpbroadcastb" "ymm15" "0x0, 0x0"
380     test_one_register "vpbroadcastb" "ymm0"  "0x0, 0x0"
382     gdb_test "record stop" "Process record is stopped.*" \
383         "delete history for vpbroadcast_test"
384 } else {
385     untested "couldn't run vpbroadcast tests"
388 gdb_test "finish" "Run till exit from.*vpbroadcast_test.*" \
389     "leaving vpbroadcast"
391 # Preparation and testing of vzeroupper
392 gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vzeroupper"
393 gdb_test_no_output "set \$ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0}" \
394     "set ymm1 for vzeroupper"
395 gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vzeroupper"
396 gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpbroadcast"
397 if {[record_full_function "vzeroupper"] == true} {
398     # Since vzeroupper needs to save 8 or 16 registers, let's check what was
399     # actually recorded, instead of just undoing an instruction.  Only
400     # really check the values of egisters 0, 1, 2 and 15 because those are
401     # the only ones we're setting.
402     gdb_test "maint print record-instruction" \
403         [multi_line "Register ymm0h changed: 74565" \
404             "Register ymm1h changed: 0" \
405             "Register ymm2h changed: 48879" \
406             "Register ymm3h changed: ${decimal}" \
407             "Register ymm4h changed: ${decimal}" \
408             "Register ymm5h changed: ${decimal}" \
409             "Register ymm6h changed: ${decimal}" \
410             "Register ymm7h changed: ${decimal}" \
411             "Register ymm8h changed: ${decimal}" \
412             "Register ymm9h changed: ${decimal}" \
413             "Register ymm10h changed: ${decimal}" \
414             "Register ymm11h changed: ${decimal}" \
415             "Register ymm12h changed: ${decimal}" \
416             "Register ymm13h changed: ${decimal}" \
417             "Register ymm14h changed: ${decimal}" \
418             "Register ymm15h changed: 3405707982" \
419             "Register rip changed: \[^\r\n\]+" ] \
420         "verify vzeroupper recording"
422     gdb_test "record stop" "Process record is stopped.*" \
423         "delete history for vzeroupper_test"
424 } else {
425     untested "couldn't run vzeroupper tests"
428 gdb_test "finish" "Run till exit from.*vzeroupper_test.*" \
429     "leaving vzeroupper"
431 # Preparation and testing vpxor instructions.
432 gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vpor_xor"
433 gdb_test_no_output "set \$ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0}" \
434     "set ymm1 for vpor_xor"
435 gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vpor_xor"
436 gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpor_xor"
438 if {[record_full_function "vpor_xor"] == true} {
439     test_one_register "vpor" "ymm15" "0x0, 0xcafe4421"
440     test_one_register "vpor" "ymm2" "0x0, 0x0"
441     test_one_register "vpor" "ymm1" "0x0, 0xcafe4421"
442     test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "first: "
443     test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "second: "
445     test_one_register "vpxor" "ymm15" "0x0, 0xcafeface"
446     test_one_register "vpxor" "ymm2" "0x0, 0xbeef"
447     test_one_register "vpxor" "ymm1" "0x1f1e1d1c1b1a1918, 0x0"
448     test_one_register "vpxor" "ymm0" "0x0, 0x0" "first: "
449     test_one_register "vpxor" "ymm0" "0x0, 0x12345" "second: "
451     gdb_test "record stop" "Process record is stopped.*" \
452         "delete history for vpor_xor_test"
453 } else {
454     untested "couldn't run vpor_xor tests"
456 gdb_test "finish" "Run till exit from.*vpor_xor_test.*" \
457     "leaving vpor_xor"
459 # Preparation and testing vpcmpeq instructions.
460 gdb_test_no_output "set \$ymm0.v2_int128 = {0x12345, 0x12345}" \
461     "set ymm0 for vpcmpeq"
462 gdb_test_no_output \
463     "set \$ymm1.v8_int32 = {0xcafe, 0xbeef, 0xff, 0x1234, 0x0, 0xff00, 0xff0000ff, 0xface0f0f}" \
464     "set ymm1 for vpcmpeq"
465 gdb_test_no_output \
466     "set \$ymm2.v8_int32 = {0xcafe0, 0xbeef, 0xff00, 0x12345678, 0x90abcdef, 0xffff00, 0xff, 0xf}" \
467     "set ymm2 for vpcmpeq"
468 gdb_test_no_output "set \$ymm15.v2_int128 = {0xcafeface, 0xcafeface}" \
469     "set ymm15 for vpcmpeq"
471 if {[record_full_function "vpcmpeq"] == true} {
472     test_one_register "vpcmpeqd" "ymm15" \
473         "0xffff0000ffffffff00000000, 0xffff0000ffff00000000" "ymm: "
474     test_one_register "vpcmpeqw" "ymm15" \
475         "0xffff0000ffffffffff000000, 0xff00ffffffff00ffff00000000" "ymm: "
476     test_one_register "vpcmpeqb" "ymm15" \
477         "0xffffffff00000000, 0x0" "ymm: "
478     test_one_register "vpcmpeqd" "ymm15" \
479         "0xffff0000ffffffff00000000, 0x0" "xmm: "
480     test_one_register "vpcmpeqw" "ymm15" \
481         "0xffff0000ffffffffff000000, 0x0" "xmm: "
482     test_one_register "vpcmpeqb" "ymm15" "0xcafeface, 0xcafeface" "xmm: "
484     test_one_register "vpcmpeqd" "ymm0" \
485         "0xffff0000ffffffff00000000, 0xffff0000ffff00000000" "ymm: "
486     test_one_register "vpcmpeqw" "ymm0" \
487         "0xffff0000ffffffffff000000, 0xff00ffffffff00ffff00000000" "ymm: "
488     test_one_register "vpcmpeqb" "ymm0" \
489         "0xffffffff00000000, 0x0" "ymm: "
490     test_one_register "vpcmpeqd" "ymm0" \
491         "0xffff0000ffffffff00000000, 0x0" "xmm: "
492     test_one_register "vpcmpeqw" "ymm0" \
493         "0xffff0000ffffffffff000000, 0x0" "xmm: "
494     test_one_register "vpcmpeqb" "ymm0" "0x12345, 0x12345" "xmm: "
496     gdb_test "record stop" "Process record is stopped.*" \
497         "delete history for vpcmpeq_test"
498 } else {
499     untested "couldn't run vpcmpeq tests"
501 gdb_test "finish" "Run till exit from.*vpcmpeq_test.*" \
502     "leaving vpcmpeq"
504 # Preparation and testing vpcmpeq instructions.
505 gdb_test_no_output "set \$rbx = 2" "set rbx for vpmovmskb"
506 gdb_test_no_output "set \$r8 = 3" "set r8 for vpmovmskb"
507 gdb_test_no_output "set \$r9 = 4" "set ymm15 for vpmovmskb"
509 if {[record_full_function "vpmovmskb"] == true} {
510     test_one_general_register "vpmovmskb" "r9" "0x4"
511     test_one_general_register "vpmovmskb" "r8" "0x3"
512     test_one_general_register "vpmovmskb" "rbx" "0x2"
513     # Because of the infrastructure of the test, we can't set rax.
514     # However, it seems to always be set to 0, so this should be fine.
515     test_one_general_register "vpmovmskb" "rax" "0x0"
517     gdb_test "record stop" "Process record is stopped.*" \
518         "delete history for vpmovmskb_test"
519 } else {
520     untested "couldn't run vpmovmskb tests"
522 gdb_test "finish" "Run till exit from.*vpmovmskb_test.*" \
523     "leaving vpmovmskb"
525 # Preparation and testing arithmetic instructions.
526 gdb_test_no_output \
527     "set \$ymm0.v8_float = {0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5}"
528 gdb_test_no_output \
529     "set \$ymm1.v8_float = {0, 1, 2, 3, 4, 5, 6, 7}"
530 gdb_test_no_output "set \$ymm15.v2_int128 = {0,0}"
532 if {[record_full_function "arith"] == true} {
533     test_one_register "vmaxsd" "ymm15" \
534         "0x40400000400000003f8000003f000000, 0x0" "ymm operation: "
535     test_one_register "vmaxss" "ymm15" \
536         "0x40600000402000003fc000003f000000, 0x40f0000040d0000040b0000040900000" \
537         "xmm operation: "
538     test_one_register "vmaxpd" "ymm15" \
539         "0x40600000402000003fc000003f000000, 0x0" "ymm operation: "
540     test_one_register "vmaxpd" "ymm15" \
541         "0x40600000402000003fc000003f000000, 0x40f0000040d0000040b0000040900000" \
542         "xmm operation: "
543     test_one_register "vmaxps" "ymm15" \
544         "0x40600000402000003fc000003f000000, 0x0" "ymm operation: "
545     test_one_register "vmaxps" "ymm15" \
546         "0x40400000400000003f80000000000000, 0x0" "xmm operation: "
548     test_one_register "vminsd" "ymm15" \
549         "0x40400000400000003f80000000000000, 0x0" "ymm operation: "
550     test_one_register "vminss" "ymm15" \
551         "0x40400000400000003f80000000000000, 0x40e0000040c0000040a0000040800000" \
552         "xmm operation: "
553     test_one_register "vminpd" "ymm15" \
554         "0x40400000400000003f80000000000000, 0x0" "ymm operation: "
555     test_one_register "vminpd" "ymm15" \
556         "0x40400000400000003f80000000000000, 0x40e0000040c0000040a0000040800000" \
557         "xmm operation: "
558     test_one_register "vminps" "ymm15" \
559         "0x40400000400000003f80000000000000, 0x0" "ymm operation: "
560     test_one_register "vminps" "ymm15" \
561         "0x40400000400000003fafffff820001f0, 0x0" "xmm operation: "
563     test_one_register "vdivsd" "ymm15" \
564         "0x40400000400000003f80000000000000, 0x0" "ymm operation: "
565     test_one_register "vdivss" "ymm15" \
566         "0x3fcfffffffc000013fafffff820001f0, 0x3fdfffffffe000013fdfffffffe00001" \
567         "xmm operation: "
568     test_one_register "vdivpd" "ymm15" \
569         "0x3fcfffffffc000013fafffff820001f0, 0x0" "ymm operation: "
570     test_one_register "vdivpd" "ymm15" \
571         "0x3f5b6db73f4ccccd3f2aaaab00000000, 0x3f6eeeef3f6c4ec53f68ba2f3f638e39" \
572         "xmm operation: "
573     test_one_register "vdivps" "ymm15" \
574         "0x3f5b6db73f4ccccd3f2aaaab00000000, 0x0" "ymm operation: "
575     test_one_register "vdivps" "ymm15" \
576         "0x4040000040000000bfbe00007e000000, 0x0" "xmm operation: "
578     test_one_register "vsubsd" "ymm15" \
579         "0x40400000400000003f800000bf000000, 0x0" "ymm operation: "
580     test_one_register "vsubss" "ymm15" \
581         "0xc058000060400000bfbe00007e000000, 0xc0e0000040e00000c0a0000040a00000" \
582         "xmm operation: "
583     test_one_register "vsubpd" "ymm15" \
584         "0xc058000060400000bfbe00007e000000, 0x0" "ymm operation: "
585     test_one_register "vsubpd" "ymm15" \
586         "0xbf000000bf000000bf000000bf000000, 0xbf000000bf000000bf000000bf000000" \
587         "xmm operation: "
588     test_one_register "vsubps" "ymm15" \
589         "0xbf000000bf000000bf000000bf000000, 0x0" "ymm operation: "
590     test_one_register "vsubps" "ymm15" \
591         "0x40400000400000003f5000003f000000, 0x0" "xmm operation: "
593     test_one_register "vmulsd" "ymm15" \
594         "0x40400000400000003f80000000000000, 0x0" "ymm operation: "
595     test_one_register "vmulss" "ymm15" \
596         "0x40b00000802001003f5000003f000000, 0x41e00000819001064160000081100104" \
597         "xmm operation: "
598     test_one_register "vmulpd" "ymm15" \
599         "0x40b00000802001003f5000003f000000, 0x0" "ymm operation: "
600     test_one_register "vmulpd" "ymm15" \
601         "0x4128000040a000003fc0000000000000, 0x42520000421c000041dc000041900000" \
602         "xmm operation: "
603     test_one_register "vmulps" "ymm15" \
604         "0x4128000040a000003fc0000000000000, 0x0" "ymm operation: "
605     test_one_register "vmulps" "ymm15" \
606         "0x40400000400000003fc100003f000000, 0x0" "xmm operation: "
608     test_one_register "vaddsd" "ymm15" \
609         "0x40400000400000003f8000003f000000, 0x0" "ymm operation: "
610     test_one_register "vaddss" "ymm15" \
611         "0x40640000502000003fc100003f000000, 0x40f800006130000040b8000060d00000" \
612         "xmm operation: "
613     test_one_register "vaddpd" "ymm15" \
614         "0x40640000502000003fc100003f000000, 0x0" "ymm operation: "
615     test_one_register "vaddpd" "ymm15" \
616         "0x40d0000040900000402000003f000000, 0x41680000414800004128000041080000" \
617         "xmm operation: "
618     test_one_register "vaddps" "ymm15" \
619         "0x40d0000040900000402000003f000000, 0x0" "ymm operation: "
620     test_one_register "vaddps" "ymm15" "0x0, 0x0" "xmm operation: "
622     gdb_test "record stop" "Process record is stopped.*" \
623         "delete history for arith_test"
624 } else {
625     untested "couldn't run arith tests"
627 gdb_test "finish" "Run till exit from.*arith_test.*" \
628     "leaving arith"