This commit adds support for the AVX instructions vunpck[l|h][ps|pd]
instructions, which was pretty straightforward.
This commit also fixes a mistake in the test, where "record stop" was
used after the recording was already stopped, if it failed during
vpunpck_test recording. It also improved the documentation at the start
of the relevant .c function.
---
gdb/i386-tdep.c | 6 ++++
gdb/testsuite/gdb.reverse/i386-avx-reverse.c | 20 +++++++++++++
.../gdb.reverse/i386-avx-reverse.exp | 28 ++++++++++++++++---
3 files changed, 50 insertions(+), 4 deletions(-)
@@ -4849,6 +4849,12 @@ i386_record_vex (struct i386_record_s *ir, uint8_t vex_w, uint8_t vex_r,
i386_record_lea_modrm (ir);
}
break;
+ case 0x14: /* VUNPCKL[PS|PD]. */
+ case 0x15: /* VUNPCKH [PS|PD]. */
+ i386_record_modrm (ir);
+ record_full_arch_list_add_reg (ir->regcache,
+ tdep->ymm0_regnum + ir->reg + vex_r * 8);
+ break;
case 0x6e: /* VMOVD XMM, reg/mem */
/* This is moving from a regular register or memory region into an
XMM register. */
@@ -182,6 +182,7 @@ vpunpck_test ()
/* Using GDB, load these values onto registers, for ease of testing.
ymm0.v2_int128 = {0x1f1e1d1c1b1a19181716151413121110, 0x2f2e2d2c2b2a29282726252423222120}
ymm1.v2_int128 = {0x4f4e4d4c4b4a49484746454443424140, 0x3f3e3d3c3b3a39383736353433323130}
+ ymm2.v2_int128 = {0x0, 0x0}
ymm15.v2_int128 = {0xdead, 0xbeef}
so that's easy to confirm that the unpacking went as expected. */
@@ -220,6 +221,25 @@ vpunpck_test ()
asm volatile ("vpunpckhdq %ymm0, %ymm1, %ymm15");
/* 17 16 15 14 13 12 11 10 ...*/
asm volatile ("vpunpckhqdq %ymm0, %ymm1, %ymm15");
+
+ /* Test some of the floating point unpack instructions. */
+ /* 17 27 16 26 15 25 14 24 ...*/
+ asm volatile ("vunpcklps %xmm0, %xmm1, %xmm15");
+ /* 17 16 27 26 15 14 25 24 ...*/
+ asm volatile ("vunpcklps %ymm0, %ymm1, %ymm2");
+ /* 17 16 15 14 27 26 25 24 ...*/
+ asm volatile ("vunpcklpd %xmm0, %xmm1, %xmm2");
+ /* 17 16 15 14 13 12 11 10 ...*/
+ asm volatile ("vunpcklpd %ymm0, %ymm1, %ymm15");
+ /* 17 27 16 26 15 25 14 24 ...*/
+ asm volatile ("vunpckhps %xmm0, %xmm1, %xmm15");
+ /* 17 16 27 26 15 14 25 24 ...*/
+ asm volatile ("vunpckhps %ymm0, %ymm1, %ymm2");
+ /* 17 16 15 14 27 26 25 24 ...*/
+ asm volatile ("vunpckhpd %xmm0, %xmm1, %xmm2");
+ /* 17 16 15 14 13 12 11 10 ...*/
+ asm volatile ("vunpckhpd %ymm0, %ymm1, %ymm15");
+
/* We have a return statement to deal with
epilogue in different compilers. */
return 0; /* end vpunpck_test */
@@ -298,6 +298,25 @@ gdb_test_no_output \
gdb_test_no_output "set \$ymm2.v2_int128 = {0x0, 0x0}"
gdb_test_no_output "set \$ymm15.v2_int128 = {0xdead, 0xbeef}"
if {[record_full_function "vpunpck"] == true} {
+ # Floating point unpack instructions.
+ test_one_register "vunpckhpd" "ymm15" \
+ "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x0"
+ test_one_register "vunpckhpd" "ymm2" \
+ "0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x2f2e2d2c4f4e4d4c2b2a29284b4a4948"
+ test_one_register "vunpckhps" "ymm2" \
+ "0x17161514131211103736353433323130, 0x0"
+ test_one_register "vunpckhps" "ymm15" \
+ "0x17161514131211103736353433323130, 0x27262524232221204746454443424140"
+ test_one_register "vunpcklpd" "ymm15" \
+ "0x17161514373635341312111033323130, 0x0"
+ test_one_register "vunpcklpd" "ymm2" \
+ "0x17161514373635341312111033323130, 0x27262524474645442322212043424140"
+ test_one_register "vunpcklps" "ymm2" \
+ "0x1f1e1d1c1b1a19183f3e3d3c3b3a3938, 0x0"
+ test_one_register "vunpcklps" "ymm15" \
+ "0x1f1e1d1c1b1a19183f3e3d3c3b3a3938, 0x2f2e2d2c2b2a29284f4e4d4c4b4a4948"
+
+
test_one_register "vpunpckhqdq" "ymm15" \
"0x1f1e1d1c3f3e3d3c1b1a19183b3a3938, 0x2f2e2d2c4f4e4d4c2b2a29284b4a4948" \
"ymm: "
@@ -325,14 +344,15 @@ if {[record_full_function "vpunpck"] == true} {
test_one_register "vpunpcklwd" "ymm15" \
"0x17371636153514341333123211311030, 0x0"
test_one_register "vpunpcklbw" "ymm15" "0xdead, 0xbeef"
+
+ # Move to the end of vmov_test to set up next.
+ # Stop recording in case of recording errors.
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for vpunpck_test"
} else {
untested "couldn't test vpunpck tests"
}
-# Move to the end of vmov_test to set up next.
-# Stop recording in case of recording errors.
-gdb_test "record stop" "Process record is stopped.*" \
- "delete history for vpunpck_test"
gdb_test "finish" "Run till exit from.*vpunpck_test.*" "leaving vpunpck_test"
# Start vpbroadcast tests