This commit adds support for the following instructions VPACK[S|U]S[WB|DW] and associated tests.
case 0x0d: /* VPERMILPD with register and VBLENDPD. */
case 0x0e: /* VPBLENDW. */
case 0x1a: /* VBROADCASTF128. */
+ case 0x2b: /* VPACKUSDW. */
case 0x36: /* VPERMD. */
case 0x40: /* VPMULLD */
case 0x46: /* VPERM2I128. */
case 0x5d: /* VMIN[P|S][S|D] */
case 0x5e: /* VDIV[P|S][S|D] */
case 0x5f: /* VMAX[P|S][S|D] */
+ case 0x63: /* VPACKSSWB. */
+ case 0X67: /* VPACKUSWB. */
+ case 0x6b: /* VPACKSSDW. */
case 0x70: /* VPSHUF[B|D|HW|LW]. */
case 0x78: /* VPBROADCASTB */
case 0x79: /* VPBROADCASTW */
return 0; /* end compare_test */
}
+int
+pack_test ()
+{
+ /* start pack_test. */
+ /* Using GDB, load these values onto registers for testing.
+ xmm0.v4_float = {0, 1.5, 2, 0}
+ xmm1.v4_float = {0, 1, 2.5, -1}
+ xmm2.v4_float = {0, 1, 2.5, -1}
+ xmm15.v4_float = {-1, -2, 10, 100}
+ this way it's easy to confirm we're undoing things correctly. */
+
+ asm volatile ("vpacksswb %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpacksswb %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpackssdw %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpackssdw %ymm1, %ymm2, %ymm0");
+ asm volatile ("vpackuswb %xmm1, %xmm2, %xmm0");
+ asm volatile ("vpackuswb %ymm1, %ymm2, %ymm15");
+ asm volatile ("vpackusdw %xmm1, %xmm2, %xmm15");
+ asm volatile ("vpackusdw %ymm1, %ymm2, %ymm0");
+
+ return 0; /* end pack_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. */
extract_insert_test ();
blend_test ();
compare_test ();
+ pack_test ();
return 0; /* end of main */
}
}
gdb_test "finish" "Run till exit from.*compare_test.*" \
"leaving compare"
+
+# Preparation and testing pack instructions.
+gdb_test_no_output \
+ "set \$ymm0.v2_int128 = {0, 0}" "set ymm0 for pack"
+gdb_test_no_output \
+ "set \$ymm1.v16_int16 = {0x1020, 0x1121, 0x1222, 0x1323, 0x1424, 0x1525, 0x1626, 0x1727, 0x1828, 0x1929, 0x1a2a, 0x1b2b, 0x1c2c, 0x1d2d, 0x1e2e, 0x1f2f}" \
+ "set ymm1 for pack"
+gdb_test_no_output \
+ "set \$ymm2.v16_int16 = {0x3040, 0x3141, 0x3242, 0x3343, 0x3444, 0x3545, 0x3646, 0x3747, 0x3848, 0x3949, 0x3a4a, 0x3b4b, 0x3c4c, 0x3d4d, 0x3e4e, 0x3f4f}" \
+ "set ymm2 for pack"
+gdb_test_no_output \
+ "set \$ymm15.v2_int128 = {0, 0}" "set ymm15 for pack"
+
+if {[record_full_function "pack"] == true} {
+ test_one_register "vpackusdw" "ymm0" \
+ "0xffffffffffffffffffffffffffffffff, 0x0"
+ test_one_register "vpackusdw" "ymm15" \
+ "0xffffffffffffffffffffffffffffffff, 0xffffffffffffffffffffffffffffffff"
+ test_one_register "vpackuswb" "ymm15" \
+ "0x7fff7fff7fff7fff7fff7fff7fff7fff, 0x0"
+ test_one_register "vpackuswb" "ymm0" \
+ "0x7fff7fff7fff7fff7fff7fff7fff7fff, 0x7fff7fff7fff7fff7fff7fff7fff7fff"
+ test_one_register "vpackssdw" "ymm0" \
+ "0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f, 0x0"
+ test_one_register "vpackssdw" "ymm15" \
+ "0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f, 0x7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f"
+ test_one_register "vpacksswb" "ymm15" "0x0, 0x0"
+ test_one_register "vpacksswb" "ymm0" "0x0, 0x0"
+
+ gdb_test "record stop" "Process record is stopped.*" \
+ "delete history for pack_test"
+} else {
+ untested "couldn't run pack tests"
+}
+gdb_test "finish" "Run till exit from.*pack_test.*" \
+ "leaving pack"