From: Richard Henderson <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
Reviewed-by: Peter Maydell <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
(cherry picked from commit 32953700108cc3305f27b591d66b5fb73806266a)
Signed-off-by: Michael Tokarev <[email protected]>
diff --git a/tests/tcg/aarch64/Makefile.target
b/tests/tcg/aarch64/Makefile.target
index 9fa86874534..23e5fad5255 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -191,8 +191,9 @@ endif
endif
ifneq ($(CROSS_CC_HAS_SVE2),)
-AARCH64_TESTS += test-826
-test-826: CFLAGS += $(CROSS_CC_HAS_SVE2)
+SVE2_TESTS = test-826 sve-while-ptr
+$(SVE2_TESTS): CFLAGS += $(CROSS_CC_HAS_SVE2)
+AARCH64_TESTS += $(SVE2_TESTS)
endif
TESTS += $(AARCH64_TESTS)
diff --git a/tests/tcg/aarch64/sve-while-ptr.c
b/tests/tcg/aarch64/sve-while-ptr.c
new file mode 100644
index 00000000000..7db3b9cc035
--- /dev/null
+++ b/tests/tcg/aarch64/sve-while-ptr.c
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* WHILEWR / WHILERW regression test */
+
+#include <sys/prctl.h>
+#include <assert.h>
+
+int main(int argc, char **argv)
+{
+ unsigned short p;
+ int set_vl_ret;
+
+ set_vl_ret = prctl(PR_SVE_SET_VL, 16, 0, 0, 0, 0);
+ assert(set_vl_ret == 16);
+
+ p = 0xdead;
+ asm("whilewr p0.s, %0, %1\n\t"
+ "str p0, [%2]"
+ : : "r"(8), "r"(11), "r"(&p) : "memory", "p0");
+ assert(p == 0x1111);
+
+ p = 0xdead;
+ asm("whilerw p0.s, %0, %1\n\t"
+ "str p0, [%2]"
+ : : "r"(8), "r"(11), "r"(&p) : "memory", "p0");
+ assert(p == 0x1111);
+
+ return 0;
+}
--
2.47.3