From: Guinevere Larsen Date: Thu, 14 Nov 2024 12:31:00 +0000 (-0300) Subject: gdb/record: introduce recoding support for vpor X-Git-Tag: gdb-16-branchpoint~347 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab8c2180a3de1461f361c75c420e4d37ac709e0b;p=thirdparty%2Fbinutils-gdb.git gdb/record: introduce recoding support for vpor This commit adds recording support for the AVX instruction vpor, and the AVX2 extension. Since the encoding of vpor and vpxor are the same, and their semantics are basically the same, modulo the mathematical operation, they are handled by the same switch case block. This also updates the vpxor function, to test vpor and vpxor, and updates the name to vpor_xor_test to better reflect what it does. Approved-By: Tom Tromey --- diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 0f366daa29f..eb8ddfc43c0 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -5001,7 +5001,8 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r, } break; - case 0xef: + case 0xef: /* VPXOR */ + case 0xeb: /* VPOR */ { i386_record_modrm (ir); int reg_offset = ir->reg + vex_r * 8; diff --git a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c index 02fd3da3fc0..5ce363f31ef 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.c +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.c @@ -211,9 +211,9 @@ vzeroupper_test () } int -vpxor_test () +vpor_xor_test () { - /* start vpxor_test. */ + /* start vpor_xor_test. */ /* Using GDB, load this value onto the register, for ease of testing. ymm0.v2_int128 = {0x0, 0x12345} ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0} @@ -226,7 +226,13 @@ vpxor_test () asm volatile ("vpxor %ymm2, %ymm15, %ymm1"); asm volatile ("vpxor %xmm2, %xmm15, %xmm2"); asm volatile ("vpxor %ymm2, %ymm1, %ymm15"); - return 0; /* end vpxor_test */ + + asm volatile ("vpor %ymm0, %ymm0, %ymm0"); + asm volatile ("vpor %xmm0, %xmm1, %xmm0"); + asm volatile ("vpor %ymm2, %ymm15, %ymm1"); + asm volatile ("vpor %xmm2, %xmm15, %xmm2"); + asm volatile ("vpor %ymm2, %ymm1, %ymm15"); + return 0; /* end vpor_xor_test */ } int @@ -302,7 +308,7 @@ main () vpunpck_test (); vpbroadcast_test (); vzeroupper_test (); - vpxor_test (); + vpor_xor_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 198025ed885..6d8990067f2 100644 --- a/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp +++ b/gdb/testsuite/gdb.reverse/i386-avx-reverse.exp @@ -351,26 +351,32 @@ gdb_test "finish" "Run till exit from.*vzeroupper_test.*" \ "leaving vzeroupper" # Preparation and testing vpxor instructions. -gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vpxor" +gdb_test_no_output "set \$ymm0.v2_int128 = {0x0, 0x12345}" "set ymm0 for vpor_xor" gdb_test_no_output "set \$ymm1.v2_int128 = {0x1f1e1d1c1b1a1918, 0x0}" \ - "set ymm1 for vpxor" -gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vpxor" -gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpxor" + "set ymm1 for vpor_xor" +gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0xbeef}" "set ymm2 for vpor_xor" +gdb_test_no_output "set \$ymm15.v2_int128 = {0x0, 0xcafeface}" "set ymm15 for vpor_xor" + +if {[record_full_function "vpor_xor"] == true} { + test_one_register "vpor" "ymm15" "0x0, 0xcafe4421" + test_one_register "vpor" "ymm2" "0x0, 0x0" + test_one_register "vpor" "ymm1" "0x0, 0xcafe4421" + test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "first: " + test_one_register "vpor" "ymm0" "0x1f1e1d1c1b1a1918, 0x0" "second: " -if {[record_full_function "vpxor"] == true} { test_one_register "vpxor" "ymm15" "0x0, 0xcafeface" test_one_register "vpxor" "ymm2" "0x0, 0xbeef" test_one_register "vpxor" "ymm1" "0x1f1e1d1c1b1a1918, 0x0" - test_one_register "vpxor" "ymm0" "0x0, 0x0" "first" - test_one_register "vpxor" "ymm0" "0x0, 0x12345" "second" + test_one_register "vpxor" "ymm0" "0x0, 0x0" "first: " + test_one_register "vpxor" "ymm0" "0x0, 0x12345" "second: " gdb_test "record stop" "Process record is stopped.*" \ - "delete history for vpxor_test" + "delete history for vpor_xor_test" } else { - untested "couldn't run vpxor tests" + untested "couldn't run vpor_xor tests" } -gdb_test "finish" "Run till exit from.*vpxor_test.*" \ - "leaving vpxor" +gdb_test "finish" "Run till exit from.*vpor_xor_test.*" \ + "leaving vpor_xor" # Preparation and testing vpcmpeq instructions. gdb_test_no_output "set \$ymm0.v2_int128 = {0x12345, 0x12345}" \