aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2024-06-09 08:14:27 -0700
committerRichard Henderson <richard.henderson@linaro.org>2024-06-09 08:14:27 -0700
commit593aab332f048347bd19893071caf44e1fb742ff (patch)
treebbfe892bf127e17a043594ef9135d3726cef2be4 /tests
parent3e246da2c3f85298b52f8a1154b832acf36aa656 (diff)
parent1967a1ea985299c090dfd3efc1e5323ce60d75df (diff)
downloadqemu-593aab332f048347bd19893071caf44e1fb742ff.zip
qemu-593aab332f048347bd19893071caf44e1fb742ff.tar.gz
qemu-593aab332f048347bd19893071caf44e1fb742ff.tar.bz2
Merge tag 'pull-hex-20240608' of https://github.com/quic/qemu into staging
idef-parser cleanup, HVX & PC-alignment fixes # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCgAdFiEEPWaq5HRZSCTIjOD4GlSvuOVkbDIFAmZk/L4ACgkQGlSvuOVk # bDLKag//ZzAuoChJOkz7EPeRzFKWuz4QL9cXA6+FrWRoD43geXiJ/eDihlLIjFvr # JN2deqaYZTyqlfbWR1BUIgkPxYnwBFlaqCnOO4xgbAaUJSxtdmkuWr8GBlftZt2s # PV2Nm9pDjDOEJrnfbSA2f3nMkMa7e64N+tXZ5Svt8pJC8DOZg3oI3KXWX6uZZ5YA # 9DAGgiHBlZONKQk/EebQ1DAcc+RDu68f+UtzsQ9Q4MiO/Mga/Z2u5wdOdrXmk5Lh # ba6W4sLqBNU8oB6hkA5sy+5EhlzPIhX1+G1c21fRSlLR74BFK8ByZ802kWSVY1j/ # /MS01yH46Kb3aFVqpMvoYzBZ+kGlbMVKYY4c9AXtrH5tojHQ83ijnl2V/0y+s+i8 # f6bqErchbDZPM8H6vVDdbUewx3Sq/KA7WhiK9GCgnHWc0Z5kj15l121vJr6JVMwS # fkccK1s8fOTUNCZNJiu4czakNQTGsf4jWGjcOo7EREstIXin0E/cUxZKrJWYshzc # 88Ys1pxSk+1f7ajla4+uQ3oDw+RDqkA1unUA5cfJz/61ho5TWx6dcd5XKziNk7o4 # PyOhxfoLSV9j5+XczAO+nugpN0zQUHb7lz2k0sNiypScbXVSIw/ebKgYMVlLyMSf # yEZTh8p+rbzmmJbkJBB5X/8kpU0qyp6fK5dRv1wvNPau0ExBwcs= # =CwAl # -----END PGP SIGNATURE----- # gpg: Signature made Sat 08 Jun 2024 05:52:14 PM PDT # gpg: using RSA key 3D66AAE474594824C88CE0F81A54AFB8E5646C32 # gpg: Good signature from "Brian Cain (QUIC) <quic_bcain@quicinc.com>" [unknown] # gpg: aka "Brian Cain <bcain@kernel.org>" [unknown] # gpg: aka "Brian Cain (QuIC) <bcain@quicinc.com>" [unknown] # gpg: aka "Brian Cain (CAF) <bcain@codeaurora.org>" [unknown] # gpg: aka "bcain" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 6350 20F9 67A7 7164 79EF 49E0 175C 464E 541B 6D47 # Subkey fingerprint: 3D66 AAE4 7459 4824 C88C E0F8 1A54 AFB8 E564 6C32 * tag 'pull-hex-20240608' of https://github.com/quic/qemu: target/hexagon: idef-parser simplify predicate init target/hexagon: idef-parser fix leak of init_list target/hexagon: idef-parser remove undefined functions target/hexagon: idef-parser remove unused defines Hexagon: add PC alignment check and exception Hexagon: fix HVX store new Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/tcg/hexagon/Makefile.target2
-rw-r--r--tests/tcg/hexagon/hvx_misc.c23
-rw-r--r--tests/tcg/hexagon/unaligned_pc.c107
3 files changed, 132 insertions, 0 deletions
diff --git a/tests/tcg/hexagon/Makefile.target b/tests/tcg/hexagon/Makefile.target
index f839b2c..e5182c0 100644
--- a/tests/tcg/hexagon/Makefile.target
+++ b/tests/tcg/hexagon/Makefile.target
@@ -51,6 +51,7 @@ HEX_TESTS += scatter_gather
HEX_TESTS += hvx_misc
HEX_TESTS += hvx_histogram
HEX_TESTS += invalid-slots
+HEX_TESTS += unaligned_pc
run-and-check-exception = $(call run-test,$2,$3 2>$2.stderr; \
test $$? -eq 1 && grep -q "exception $(strip $1)" $2.stderr)
@@ -107,6 +108,7 @@ overflow: overflow.c hex_test.h
preg_alias: preg_alias.c hex_test.h
read_write_overlap: read_write_overlap.c hex_test.h
reg_mut: reg_mut.c hex_test.h
+unaligned_pc: unaligned_pc.c
# This test has to be compiled for the -mv67t target
usr: usr.c hex_test.h
diff --git a/tests/tcg/hexagon/hvx_misc.c b/tests/tcg/hexagon/hvx_misc.c
index 1fe14b5..90c3733 100644
--- a/tests/tcg/hexagon/hvx_misc.c
+++ b/tests/tcg/hexagon/hvx_misc.c
@@ -474,6 +474,27 @@ static void test_vcombine(void)
check_output_w(__LINE__, BUFSIZE);
}
+void test_store_new()
+{
+ asm volatile(
+ "r0 = #0x12345678\n"
+ "v0 = vsplat(r0)\n"
+ "r0 = #0xff00ff00\n"
+ "v1 = vsplat(r0)\n"
+ "{\n"
+ " vdeal(v1,v0,r0)\n"
+ " vmem(%0) = v0.new\n"
+ "}\n"
+ :
+ : "r"(&output[0])
+ : "r0", "v0", "v1", "memory"
+ );
+ for (int i = 0; i < MAX_VEC_SIZE_BYTES / 4; i++) {
+ expect[0].w[i] = 0x12345678;
+ }
+ check_output_w(__LINE__, 1);
+}
+
int main()
{
init_buffers();
@@ -515,6 +536,8 @@ int main()
test_vcombine();
+ test_store_new();
+
puts(err ? "FAIL" : "PASS");
return err ? 1 : 0;
}
diff --git a/tests/tcg/hexagon/unaligned_pc.c b/tests/tcg/hexagon/unaligned_pc.c
new file mode 100644
index 0000000..e9dc7cb
--- /dev/null
+++ b/tests/tcg/hexagon/unaligned_pc.c
@@ -0,0 +1,107 @@
+#include <stdio.h>
+#include <signal.h>
+#include <setjmp.h>
+#include <stdlib.h>
+
+/* will be changed in signal handler */
+volatile sig_atomic_t completed_tests;
+static jmp_buf after_test;
+static int nr_tests;
+
+void __attribute__((naked)) test_return(void)
+{
+ asm volatile(
+ "allocframe(#0x8)\n"
+ "r0 = #0xffffffff\n"
+ "framekey = r0\n"
+ "dealloc_return\n"
+ :
+ :
+ : "r0", "r29", "r30", "r31", "framekey");
+}
+
+void test_endloop(void)
+{
+ asm volatile(
+ "loop0(1f, #2)\n"
+ "1: r0 = #0x3\n"
+ "sa0 = r0\n"
+ "{ nop }:endloop0\n"
+ :
+ :
+ : "r0", "sa0", "lc0", "usr");
+}
+
+asm(
+ ".pushsection .text.unaligned\n"
+ ".org 0x3\n"
+ ".global test_multi_cof_unaligned\n"
+ "test_multi_cof_unaligned:\n"
+ " jumpr r31\n"
+ ".popsection\n"
+);
+
+#define SYS_EXIT 94
+
+void test_multi_cof(void)
+{
+ asm volatile(
+ "p0 = cmp.eq(r0, r0)\n"
+ "{\n"
+ " if (p0) jump test_multi_cof_unaligned\n"
+ " if (!p0) jump 1f\n"
+ "}\n"
+ "1:"
+ " r0 = #1\n"
+ " r6 = #%0\n"
+ " trap0(#1)\n"
+ :
+ : "i"(SYS_EXIT)
+ : "p0", "r0", "r6");
+}
+
+void sigbus_handler(int signum)
+{
+ /* retore framekey after test_return */
+ asm volatile(
+ "r0 = #0\n"
+ "framekey = r0\n"
+ :
+ :
+ : "r0", "framekey");
+ printf("Test %d complete\n", completed_tests);
+ completed_tests++;
+ siglongjmp(after_test, 1);
+}
+
+void test_done(void)
+{
+ int err = (completed_tests != nr_tests);
+ puts(err ? "FAIL" : "PASS");
+ exit(err);
+}
+
+typedef void (*test_fn)(void);
+
+int main()
+{
+ test_fn tests[] = { test_return, test_endloop, test_multi_cof, test_done };
+ nr_tests = (sizeof(tests) / sizeof(tests[0])) - 1;
+
+ struct sigaction sa = {
+ .sa_sigaction = sigbus_handler,
+ .sa_flags = SA_SIGINFO
+ };
+
+ if (sigaction(SIGBUS, &sa, NULL) < 0) {
+ perror("sigaction");
+ return EXIT_FAILURE;
+ }
+
+ sigsetjmp(after_test, 1);
+ tests[completed_tests]();
+
+ /* should never get here */
+ puts("FAIL");
+ return 1;
+}