A packet containing HLX operations defer stores to the end of the
packet, make sure this doesn't interfere with scalar :mem_noshuf
ordering.

Signed-off-by: Anton Johansson <[email protected]>
---
 tests/tcg/hexagon/hlx_mem.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/tests/tcg/hexagon/hlx_mem.c b/tests/tcg/hexagon/hlx_mem.c
index 643b499fd9..f5af95115a 100644
--- a/tests/tcg/hexagon/hlx_mem.c
+++ b/tests/tcg/hexagon/hlx_mem.c
@@ -229,6 +229,25 @@ static void test_store_fault(void)
     check_h("LX_S16b_new (fault)", buf_out, expected, HLX_HALF_ELEMS);
 }
 
+static void test_preserve_scalar_noshuf(void)
+{
+    uint32_t ret = 0;
+    uint32_t ptr = 0;
+    uint32_t val = 0x1234;
+    asm volatile("{\n"
+                 ".word 0xe5007822\n"
+                 "    memw(%1) = %2\n"
+                 "    %0 = memw(%1)\n"
+                 "}:mem_noshuf\n"
+                 : "=r"(ret)
+                 : "r"(&ptr), "r"(val)
+                 : "memory");
+    if (ret != val) {
+        printf("FAIL broken scalar :mem_noshuf ordering\n");
+        err++;
+    }
+}
+
 int main(void)
 {
     init_vtcm();
@@ -253,6 +272,9 @@ int main(void)
     /* Store in a faulting packet */
     test_store_fault();
 
+    /* Make sure HLX packets preserve scalar :mem_noshuf ordering */
+    test_preserve_scalar_noshuf();
+
     puts(err ? "FAIL" : "PASS");
     return err;
 }
-- 
2.52.0


Reply via email to