diff options
author | Guinevere Larsen <guinevere@redhat.com> | 2024-11-12 17:45:05 -0300 |
---|---|---|
committer | Guinevere Larsen <guinevere@redhat.com> | 2024-11-22 17:40:25 -0300 |
commit | b19c86e2db1c9556a4199a6d9c67d9585fa6be24 (patch) | |
tree | fc2f024311e4a654a439f2d80fe0f96128b5fbd2 | |
parent | f21055a4e9a2c3c2c7769e4ff7de246555dcd9be (diff) | |
download | binutils-b19c86e2db1c9556a4199a6d9c67d9585fa6be24.zip binutils-b19c86e2db1c9556a4199a6d9c67d9585fa6be24.tar.gz binutils-b19c86e2db1c9556a4199a6d9c67d9585fa6be24.tar.bz2 |
gdb/record: Add support for recording vpmovmskb
This commit adds support for recording the AVX instruction vpmovmskb,
and tests to the relevant file. The test didn't really support checking
general purpose registers, so this commit also adds a proc to
gdb.reverse/i386-avx-reverse.exp, which can be used to test them
Approved-By: Tom Tromey <tom@tromey.com>
-rw-r--r-- | gdb/i386-tdep.c | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/i386-avx-reverse.c | 18 | ||||
-rw-r--r-- | gdb/testsuite/gdb.reverse/i386-avx-reverse.exp | 34 |
3 files changed, 61 insertions, 0 deletions
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 2a07670..0f366da 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -4992,6 +4992,15 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r, break; } + case 0xd7: /* VPMOVMSKB */ + { + i386_record_modrm (ir); + record_full_arch_list_add_reg (ir->regcache, + ir->regmap[X86_RECORD_REAX_REGNUM + + ir->reg + 8 * vex_r]); + } + break; + case 0xef: { i386_record_modrm (ir); diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c index 57b53d1..02fd3da 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c @@ -260,6 +260,23 @@ vpcmpeq_test () return 0; /* end vpcmpeq_test */ } +int +vpmovmskb_test () +{ + /* start vpmovmskb_test. */ + /* Using GDB, load these values onto registers for testing. + rbx = 2 + r8 = 3 + r9 = 4 + this way it's easy to confirm we're undoing things correctly. */ + asm volatile ("vpmovmskb %ymm0, %eax"); + asm volatile ("vpmovmskb %ymm0, %ebx"); + + asm volatile ("vpmovmskb %ymm0, %r8"); + asm volatile ("vpmovmskb %ymm0, %r9"); + return 0; /* end vpmovmskb_test */ +} + /* This include is used to allocate the dynamic buffer and have the pointers aligned to a 32-bit boundary, so we can test instructions that require aligned memory. */ @@ -287,5 +304,6 @@ main () vzeroupper_test (); vpxor_test (); vpcmpeq_test (); + vpmovmskb_test (); return 0; /* end of main */ } diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp index b4f0e3b..198025e 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp @@ -64,6 +64,19 @@ proc test_one_register {insn register value {prefix ""}} { } # Shorthand to test reversing through one instruction and +# testing if a general purpose register has the expected value. +# Prefix, if included, should end with a colon and space. + +proc test_one_general_register {insn register value {prefix ""}} { + gdb_test "reverse-step" "$insn.*" \ + "${prefix}reverse-step from $insn to test register $register" + + gdb_test "info register $register" \ + "$register\\s+$value.*" \ + "${prefix}verify $register before $insn" +} + +# Shorthand to test reversing through one instruction and # testing if a variable has the expected value. # Prefix, if used, should end with a colon and space. @@ -403,3 +416,24 @@ if {[record_full_function "vpcmpeq"] == true} { } gdb_test "finish" "Run till exit from.*vpcmpeq_test.*" \ "leaving vpcmpeq" + +# Preparation and testing vpcmpeq instructions. +gdb_test_no_output "set \$rbx = 2" "set rbx for vpmovmskb" +gdb_test_no_output "set \$r8 = 3" "set r8 for vpmovmskb" +gdb_test_no_output "set \$r9 = 4" "set ymm15 for vpmovmskb" + +if {[record_full_function "vpmovmskb"] == true} { + test_one_general_register "vpmovmskb" "r9" "0x4" + test_one_general_register "vpmovmskb" "r8" "0x3" + test_one_general_register "vpmovmskb" "rbx" "0x2" + # Because of the infrastructure of the test, we can't set rax. + # However, it seems to always be set to 0, so this should be fine. + test_one_general_register "vpmovmskb" "rax" "0x0" + + gdb_test "record stop" "Process record is stopped.*" \ + "delete history for vpmovmskb_test" +} else { + untested "couldn't run vpmovmskb tests" +} +gdb_test "finish" "Run till exit from.*vpmovmskb_test.*" \ + "leaving vpmovmskb" |