From: Ilya Leoshkevich <iii@linux.ibm.com>
To: richard.henderson@linaro.org, qemu-devel@nongnu.org
Cc: qemu-s390x@nongnu.org, philmd@oss.qualcomm.com,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH v2] tests/tcg/s390x: Test LOAD and STORE REVERSED
Date: Mon, 3 Aug 2026 14:38:34 +0200 [thread overview]
Message-ID: <20260803123928.1875606-1-iii@linux.ibm.com> (raw)
In-Reply-To: <20260731185628.23161-1-richard.henderson@linaro.org>
Add a small test to prevent regressions.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
v1 -> v2: CC: qemu-devel@nongnu.org.
Check that upper bytes are not modified.
tests/tcg/s390x/Makefile.target | 1 +
tests/tcg/s390x/load-store-reversed.c | 46 +++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
create mode 100644 tests/tcg/s390x/load-store-reversed.c
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 0ca030ded01..fe1fba3de2f 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -50,6 +50,7 @@ TESTS+=cvb
TESTS+=ts
TESTS+=ex-smc
TESTS+=divide-to-integer
+TESTS+=load-store-reversed
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
diff --git a/tests/tcg/s390x/load-store-reversed.c b/tests/tcg/s390x/load-store-reversed.c
new file mode 100644
index 00000000000..bcc6b98dd3b
--- /dev/null
+++ b/tests/tcg/s390x/load-store-reversed.c
@@ -0,0 +1,46 @@
+/*
+ * Test the LOAD REVERSED and STORE REVERSED instructions.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+int main(void)
+{
+ long i = 0x123456789abcdefULL, o;
+
+ o = i;
+ asm("lrvr %0,%1" : "+r" (o) : "r" (i));
+ assert(o == 0x1234567efcdab89ULL);
+
+ o = i;
+ asm("lrvgr %0,%1" : "+r" (o) : "r" (i));
+ assert(o == 0xefcdab8967452301ULL);
+
+ o = i;
+ asm("lrvh %0,%1" : "=r" (o) : "T" (i));
+ assert(o == 0x123456789ab2301ULL);
+
+ o = i;
+ asm("lrv %0,%1" : "=r" (o) : "T" (i));
+ assert(o == 0x123456767452301ULL);
+
+ o = i;
+ asm("lrvg %0,%1" : "=r" (o) : "T" (i));
+ assert(o == 0xefcdab8967452301ULL);
+
+ o = i;
+ asm("strvh %1,%0" : "=T" (o) : "r" (i));
+ assert(o == 0xefcd456789abcdefULL);
+
+ o = i;
+ asm("strv %1,%0" : "=T" (o) : "r" (i));
+ assert(o == 0xefcdab8989abcdefULL);
+
+ o = i;
+ asm("strvg %1,%0" : "=T" (o) : "r" (i));
+ assert(o == 0xefcdab8967452301ULL);
+
+ return EXIT_SUCCESS;
+}
--
2.55.0
next prev parent reply other threads:[~2026-08-03 12:40 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 18:56 [PATCH 00/14] target/s390x: Clean up mem ops and byte swapping Richard Henderson
2026-07-31 18:56 ` [PATCH 01/14] target/s390x: Convert op_ld8s to op_ld Richard Henderson
2026-08-02 14:14 ` Philippe Mathieu-Daudé
2026-08-03 11:39 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 02/14] target/s390x: Convert op_ld8u " Richard Henderson
2026-08-02 14:15 ` Philippe Mathieu-Daudé
2026-08-03 11:39 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 03/14] target/s390x: Convert op_ld16s " Richard Henderson
2026-08-02 14:16 ` Philippe Mathieu-Daudé
2026-08-03 11:40 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 04/14] target/s390x: Convert op_ld16u " Richard Henderson
2026-08-02 14:17 ` Philippe Mathieu-Daudé
2026-08-03 11:41 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 05/14] target/s390x: Convert op_ld32s " Richard Henderson
2026-08-02 14:17 ` Philippe Mathieu-Daudé
2026-08-03 11:43 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 06/14] target/s390x: Convert op_ld32u " Richard Henderson
2026-08-02 14:18 ` Philippe Mathieu-Daudé
2026-08-03 11:44 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 07/14] target/s390x: Convert op_ld64 " Richard Henderson
2026-08-02 14:18 ` Philippe Mathieu-Daudé
2026-08-03 11:45 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 08/14] target/s390x: Convert op_st8 to op_st Richard Henderson
2026-08-02 14:18 ` Philippe Mathieu-Daudé
2026-08-03 11:45 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 09/14] target/s390x: Convert op_st16 " Richard Henderson
2026-08-02 14:19 ` Philippe Mathieu-Daudé
2026-08-03 11:46 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 10/14] target/s390x: Convert op_st32 " Richard Henderson
2026-08-02 14:19 ` Philippe Mathieu-Daudé
2026-08-03 11:47 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 11/14] target/s390x: Convert op_st64 " Richard Henderson
2026-08-02 14:20 ` Philippe Mathieu-Daudé
2026-08-03 11:48 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 12/14] target/s390x: Use op_ld for LOAD REVERSED Richard Henderson
2026-08-02 14:22 ` Philippe Mathieu-Daudé
2026-08-03 12:15 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 13/14] target/s390x: Use op_st for STORE REVERSED Richard Henderson
2026-08-02 14:21 ` Philippe Mathieu-Daudé
2026-08-03 12:15 ` Ilya Leoshkevich
2026-07-31 18:56 ` [PATCH 14/14] target/s390x: Simplify LRVR Richard Henderson
2026-08-02 17:24 ` Philippe Mathieu-Daudé
2026-08-03 12:17 ` Ilya Leoshkevich
2026-08-03 12:38 ` Ilya Leoshkevich [this message]
2026-08-06 17:42 ` [PATCH v2] tests/tcg/s390x: Test LOAD and STORE REVERSED Richard Henderson
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=20260803123928.1875606-1-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=philmd@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
/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.