On 10/8/2025 4:51 PM, [email protected] wrote:

-----Original Message-----
From: Brian Cain <[email protected]>
Sent: Tuesday, October 7, 2025 7:48 PM
To: [email protected]
Cc: [email protected]; [email protected];
[email protected]; [email protected]; [email protected];
[email protected]; [email protected]; [email protected];
[email protected]; [email protected];
[email protected]
Subject: [PATCH 2/2] tests/tcg/hexagon: Add cs{0,1} coverage

Cover cs0,1 register corruption in the signal_context test case.

Signed-off-by: Brian Cain <[email protected]>
---
  tests/tcg/hexagon/signal_context.c | 22 +++++++++++++++++++---
  1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/tests/tcg/hexagon/signal_context.c
b/tests/tcg/hexagon/signal_context.c
index 7202fa64b6..00bbb3efc7 100644
--- a/tests/tcg/hexagon/signal_context.c
+++ b/tests/tcg/hexagon/signal_context.c
@@ -26,7 +26,11 @@ void sig_user(int sig, siginfo_t *info, void *puc)
          "p1 = r7\n\t"
          "p2 = r7\n\t"
          "p3 = r7\n\t"
-        : : : "r7", "p0", "p1", "p2", "p3");
+        "r6 = #0x12345678\n\t"
+        "cs0 = r6\n\t"
+        "r6 = #0x87654321\n\t"
+        "cs1 = r6\n\t"
+        : : : "r6", "r7", "p0", "p1", "p2", "p3");
Add cs0, cs1 to the clobber list.

I will fix it.



  }

  int main()
@@ -52,7 +56,11 @@ int main()
      it.it_value.tv_nsec = 100000;
      timer_settime(tid, 0, &it, NULL);

-    asm("loop0(1f, %1)\n\t"
+    asm("r9 = #0xdeadbeef\n\t"
+        "   cs0 = r9\n\t"
+        "   r9 = #0xbadc0fee\n\t"
+        "   cs1 = r9\n\t"
Should these be inside the loop?


I think I might've misunderstood the design of the test case.  So yes I think so.  I will look into this.



+        "   loop0(1f, %1)\n\t"
          "1: r8 = #0xff\n\t"
          "   p0 = r8\n\t"
          "   p1 = r8\n\t"
@@ -74,10 +82,18 @@ int main()
          "   r8 = p3\n\t"
          "   p0 = cmp.eq(r8, #0xff)\n\t"
          "   if (!p0) jump 2b\n\t"
+        "   r8 = cs0\n\t"
+        "   r9 = #0xdeadbeef\n\t"
+        "   p0 = cmp.eq(r8, r9)\n\t"
+        "   if (!p0) jump 2b\n\t"
+        "   r8 = cs1\n\t"
+        "   r9 = #0xbadc0fee\n\t"
+        "   p0 = cmp.eq(r8, r9)\n\t"
+        "   if (!p0) jump 2b\n\t"
          "4: {}: endloop0\n\t"
          :
          : "r"(&err), "r"(i)
-        : "memory", "r8", "p0", "p1", "p2", "p3");
+        : "memory", "r8", "r9", "p0", "p1", "p2", "p3");
Add cs0, cs1 to the clobber list.  Also, add sa0, lc0 due to the loop0 
instruction.


I will fix it, thanks!


      puts(err ? "FAIL" : "PASS");
      return err;
--
2.34.1


Reply via email to