tests/tcg/aarch64: Add regression test for whilewr/whilerw
Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 20260811191540.79882-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Richard Henderson committed
Aug 11, 2026 at 12:15 UTC
32953700108cc3305f27b591d66b5fb73806266a
2 files changed
+31
-2
tests/tcg/aarch64/Makefile.target
+3
-2
@@ -203,8 +203,9 @@ endif
203
endif
204
205
ifneq ($(CROSS_CC_HAS_SVE2),)
206
-AARCH64_TESTS += test-826
207
-test-826: CFLAGS += $(CROSS_CC_HAS_SVE2)
206
+SVE2_TESTS = test-826 sve-while-ptr
207
+$(SVE2_TESTS): CFLAGS += $(CROSS_CC_HAS_SVE2)
208
+AARCH64_TESTS += $(SVE2_TESTS)
209
endif
210
211
TESTS += $(AARCH64_TESTS)
tests/tcg/aarch64/sve-while-ptr.c
new
+28
@@ -0,0 +1,28 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
2
+/* WHILEWR / WHILERW regression test */
3
+
4
+#include <sys/prctl.h>
5
+#include <assert.h>
6
+
7
+int main(int argc, char **argv)
8
+{
9
+ unsigned short p;
10
+ int set_vl_ret;
11
+
12
+ set_vl_ret = prctl(PR_SVE_SET_VL, 16, 0, 0, 0, 0);
13
+ assert(set_vl_ret == 16);
14
+
15
+ p = 0xdead;
16
+ asm("whilewr p0.s, %0, %1\n\t"
17
+ "str p0, [%2]"
18
+ : : "r"(8), "r"(11), "r"(&p) : "memory", "p0");
19
+ assert(p == 0x1111);
20
+
21
+ p = 0xdead;
22
+ asm("whilerw p0.s, %0, %1\n\t"
23
+ "str p0, [%2]"
24
+ : : "r"(8), "r"(11), "r"(&p) : "memory", "p0");
25
+ assert(p == 0x1111);
26
+
27
+ return 0;
28
+}