From: Brian Cain <brian.cain@oss.qualcomm.com>
To: qemu-devel@nongnu.org
Cc: "Pierrick Bouvier" <pierrick.bouvier@oss.qualcomm.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Brian Cain" <brian.cain@oss.qualcomm.com>,
sid.manning@oss.qualcomm.com
Subject: [PATCH 16/17] tests/tcg/hexagon: add scalar+HVX and masked store tests
Date: Sat, 5 Sep 2026 11:09:48 -0700 [thread overview]
Message-ID: <20260905180949.1852673-17-brian.cain@oss.qualcomm.com> (raw)
In-Reply-To: <20260905180949.1852673-1-brian.cain@oss.qualcomm.com>
Test a packet with both a scalar store and an HVX store, and test
a non-inverted masked store (if (q0) vmem) to verify the invert=false
path in masked store generation.
Signed-off-by: Brian Cain <brian.cain@oss.qualcomm.com>
---
tests/tcg/hexagon/hvx_misc.c | 66 ++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)
diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c
index f20afc8e670..0285886c2a5 100644
--- a/tests/tcg/hexagon/hvx_misc.c
+++ b/tests/tcg/hexagon/hvx_misc.c
@@ -566,6 +566,69 @@ void test_store_new()
check_output_w(__LINE__, 1);
}
+/*
+ * Test a packet with both a scalar store and an HVX store.
+ */
+static uint32_t scalar_store_dst;
+
+static void test_scalar_hvx_store(void)
+{
+ scalar_store_dst = 0;
+ memset(&expect[0], 0, sizeof(MMVector));
+
+ /* Fill v0 with 0xABCD pattern */
+ for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {
+ expect[0].uw[i] = 0xABCDABCD;
+ }
+
+ asm("r0 = #0xABCDABCD\n\t"
+ "v0 = vsplat(r0)\n\t"
+ "r1 = #42\n\t"
+ "{\n\t"
+ " memw(%[scalar]) = r1\n\t"
+ " vmem(%[hvx]) = v0\n\t"
+ "}\n\t"
+ :
+ : [scalar] "r"(&scalar_store_dst),
+ [hvx] "r"(&output[0])
+ : "r0", "r1", "v0", "memory");
+
+ check_output_w(__LINE__, 1);
+ if (scalar_store_dst != 42) {
+ printf("ERROR at line %d: scalar_store_dst = %d, expected 42\n",
+ __LINE__, scalar_store_dst);
+ err++;
+ }
+}
+
+/*
+ * Test non-inverted masked store: if (Qv) vmem(Rt) = Vs.
+ * Existing tests only cover the inverted form (!Qv).
+ * Use an all-true Q predicate to unconditionally store.
+ */
+static void test_masked_store_noninvert(void)
+{
+ void *p0 = buffer0;
+ void *pout = output;
+
+ memset(&output[0], 0xff, sizeof(MMVector));
+
+ for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {
+ expect[0].uw[i] = buffer0[0].uw[i];
+ }
+
+ asm("v5 = vmem(%[src] + #0)\n\t"
+ "r0 = #-1\n\t"
+ "v6 = vsplat(r0)\n\t"
+ "q0 = vand(v6, r0)\n\t"
+ "if (q0) vmem(%[dst]) = v5\n\t"
+ :
+ : [src] "r"(p0), [dst] "r"(pout)
+ : "r0", "v5", "v6", "q0", "memory");
+
+ check_output_w(__LINE__, 1);
+}
+
int main()
{
init_buffers();
@@ -615,6 +678,9 @@ int main()
test_store_new();
+ test_scalar_hvx_store();
+ test_masked_store_noninvert();
+
puts(err ? "FAIL" : "PASS");
return err ? 1 : 0;
}
--
2.34.1
next prev parent reply other threads:[~2026-09-05 18:11 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 18:09 [PATCH 00/17] hexagon: TCG test coverage + ubsan fixes Brian Cain
2026-09-05 18:09 ` [PATCH 01/17] tests/tcg/hexagon: fix undefined signed left shift in circ.c Brian Cain
2026-09-08 15:54 ` Sid Manning
2026-09-05 18:09 ` [PATCH 02/17] tests/tcg/hexagon: fix undefined signed left shift in brev.c Brian Cain
2026-09-09 14:43 ` Sid Manning
2026-09-05 18:09 ` [PATCH 03/17] tests/tcg/hexagon: fix undefined signed integer overflow in hvx_misc Brian Cain
2026-09-09 14:50 ` Sid Manning
2026-09-05 18:09 ` [PATCH 04/17] tests/tcg/hexagon: fix undefined integer overflow in v69_hvx.c Brian Cain
2026-09-09 14:51 ` Sid Manning
2026-09-05 18:09 ` [PATCH 05/17] tests/tcg/multiarch: suppress UBSan for float-to-int conversions Brian Cain
2026-09-14 19:43 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 06/17] tests/tcg/hexagon: add FP classification, conversion, and fixup tests Brian Cain
2026-09-14 19:43 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 07/17] tests/tcg/hexagon: add bit interleave and convergent rounding tests Brian Cain
2026-09-10 17:54 ` Sid Manning
2026-09-05 18:09 ` [PATCH 08/17] tests/tcg/hexagon: add cond call, tstbit-jump, and endloop01 tests Brian Cain
2026-09-14 19:44 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 09/17] tests/tcg/hexagon: add dczeroa cache line zero test Brian Cain
2026-09-10 18:14 ` Sid Manning
2026-09-05 18:09 ` [PATCH 10/17] tests/tcg/hexagon: add HVX vwhist tests Brian Cain
2026-09-14 21:21 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 11/17] tests/tcg/hexagon: add sfrecipa edge case tests Brian Cain
2026-09-14 21:22 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 12/17] tests/tcg/hexagon: add dfmpyhh Brian Cain
2026-09-14 21:22 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 13/17] tests/tcg/hexagon: add unconditional store-immediate tests Brian Cain
2026-09-14 21:23 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 14/17] tests/tcg/hexagon: add predicate register transfer test Brian Cain
2026-09-14 21:23 ` Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 15/17] tests/tcg/hexagon: add rounding conv, sffma:lib, and sfinvsqrta Brian Cain
2026-09-14 21:23 ` Pierrick Bouvier
2026-09-05 18:09 ` Brian Cain [this message]
2026-09-14 21:24 ` [PATCH 16/17] tests/tcg/hexagon: add scalar+HVX and masked store tests Pierrick Bouvier
2026-09-05 18:09 ` [PATCH 17/17] tests/tcg/hexagon: add decbin MPS test case Brian Cain
2026-09-14 21:24 ` Pierrick Bouvier
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=20260905180949.1852673-17-brian.cain@oss.qualcomm.com \
--to=brian.cain@oss.qualcomm.com \
--cc=alex.bennee@linaro.org \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.