qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Hexagon (target/hexagon) make VyV operands use a unique temp


From: Philippe Mathieu-Daudé
Subject: Re: [PATCH] Hexagon (target/hexagon) make VyV operands use a unique temp
Date: Tue, 7 Jun 2022 12:15:31 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.1

On 7/6/22 00:23, Taylor Simpson wrote:
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++) {

Nitpicking, possibly 4 -> sizeof(v0.uw[0]).

+        v0.uw[i] = splat;
+        v1.uw[i] = splat;
+    }

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]