VyV operand is only used in the vshuff and vdeal instructions. These
instructions write to both VyV and VxV operands. In the case where
both operands are the same register, we need a separate location for
VyV. We use the existing vtmp field in CPUHexagonState.
Test case added in tests/tcg/hexagon/hvx_misc.c
Signed-off-by: Taylor Simpson <tsimpson@quicinc.com>
---
tests/tcg/hexagon/hvx_misc.c | 45 +++++++++++++++++++++++++++++++++
target/hexagon/gen_tcg_funcs.py | 9 +++----
2 files changed, 49 insertions(+), 5 deletions(-)
+static void test_vshuff(void)
+{
+ /* Test that vshuff works when the two operands are the same register */
+ const uint32_t splat = 0x089be55c;
+ const uint32_t shuff = 0x454fa926;
+ MMVector v0, v1;
+
+ memset(expect, 0x12, sizeof(MMVector));
+ memset(output, 0x34, sizeof(MMVector));
+
+ asm volatile("v25 = vsplat(%0)\n\t"
+ "vshuff(v25, v25, %1)\n\t"
+ "vmem(%2 + #0) = v25\n\t"
+ : /* no outputs */
+ : "r"(splat), "r"(shuff), "r"(output)
+ : "v25", "memory");
+
+ /*
+ * The semantics of Hexagon are the operands are pass-by-value, so create
+ * two copies of the vsplat result.
+ */
+ for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {