qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Simpson <ltaylorsimpson@gmail.com>
To: qemu-devel@nongnu.org
Cc: brian.cain@oss.qualcomm.com, matheus.bernardino@oss.qualcomm.com,
	sid.manning@oss.qualcomm.com, marco.liebel@oss.qualcomm.com,
	richard.henderson@linaro.org, philmd@linaro.org, ale@rev.ng,
	anjo@rev.ng, ltaylorsimpson@gmail.com
Subject: [PATCH v2 3/3] Hexagon (tests/tcg/hexagon) Add test for USR changes in packet
Date: Tue,  4 Nov 2025 15:25:48 -0700	[thread overview]
Message-ID: <20251104222548.108264-4-ltaylorsimpson@gmail.com> (raw)
In-Reply-To: <20251104222548.108264-1-ltaylorsimpson@gmail.com>

Signed-off-by: Taylor Simpson <ltaylorsimpson@gmail.com>
---
 tests/tcg/hexagon/usr.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tests/tcg/hexagon/usr.c b/tests/tcg/hexagon/usr.c
index f0b23d312b..8becd8195d 100644
--- a/tests/tcg/hexagon/usr.c
+++ b/tests/tcg/hexagon/usr.c
@@ -608,6 +608,30 @@ TEST_CMP_xx(uint32_t, uint32_t, FUNC, SRC1, SRC2, RES, USR_RES)
 #define TEST_CMP_PP(FUNC, SRC1, SRC2, RES, USR_RES) \
 TEST_CMP_xx(uint64_t, uint64_t, FUNC, SRC1, SRC2, RES, USR_RES)
 
+static void test_usr_packets(void)
+{
+    uint32_t usr;
+    /* Test setting USR bits inside and outside packets */
+    asm(CLEAR_USRBITS \
+        "r10 = satub(%1)              /* Set usr.OVF */\n\t"
+        "{\n\t"
+        "    r11 = convert_uw2sf(%4)  /* Set usr.FPINPF */\n\t"
+        "    r10 = memw(%5)           /* Force pkt commit */\n\t"
+        "}\n\t"
+        "{\n\t"
+        "    r11 = sfadd(%2, %3)      /* Set usr.FPINVF */\n\t"
+        "    r10 = add(r10, #1)       /* Doesn't force pkt commit */\n\t"
+        "}\n\t"
+        "%0 = usr\n\t"
+        : "=r"(usr)
+        : "r"(0xfff),
+          "r"(SF_one), "r"(SF_SNaN),
+          "r"(0x010020a5),
+          "m"(err)
+        : "r2", "r10", "r11", "usr");
+    check32(usr & 0x3f, USR_OVF | USR_FPINVF | USR_FPINPF);
+}
+
 int main()
 {
     TEST_R_OP_R(satub,       0,         0,         USR_CLEAR);
@@ -1097,6 +1121,8 @@ int main()
     TEST_Rp_OP_R(sfinvsqrta, SF_small_neg,  SF_HEX_NaN,       0x00, USR_FPINVF);
     TEST_Rp_OP_R(sfinvsqrta, SF_SNaN,       SF_HEX_NaN,       0x00, USR_FPINVF);
 
+    test_usr_packets();
+
     puts(err ? "FAIL" : "PASS");
     return err;
 }
-- 
2.43.0



  parent reply	other threads:[~2025-11-04 22:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 22:25 [PATCH v2 0/3] Hexagon (target/hexagon) Improve USR handling Taylor Simpson
2025-11-04 22:25 ` [PATCH v2 1/3] Hexagon (target/hexagon) Add pkt_need_commit argument to arch_fpop_end Taylor Simpson
2025-11-05  2:40   ` Brian Cain
2025-11-04 22:25 ` [PATCH v2 2/3] Hexagon (target/hexagon) Implicit writes to USR don't force packet commit Taylor Simpson
2025-11-04 22:25 ` Taylor Simpson [this message]
2025-11-05  2:38   ` [PATCH v2 3/3] Hexagon (tests/tcg/hexagon) Add test for USR changes in packet Brian Cain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251104222548.108264-4-ltaylorsimpson@gmail.com \
    --to=ltaylorsimpson@gmail.com \
    --cc=ale@rev.ng \
    --cc=anjo@rev.ng \
    --cc=brian.cain@oss.qualcomm.com \
    --cc=marco.liebel@oss.qualcomm.com \
    --cc=matheus.bernardino@oss.qualcomm.com \
    --cc=philmd@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=sid.manning@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).