From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org,
Ilya Leoshkevich <iii@linux.ibm.com>
Subject: [PATCH 2/2] tests/tcg/s390x: Test VSTL
Date: Sat, 5 Aug 2023 01:55:34 +0200 [thread overview]
Message-ID: <20230804235624.263260-2-iii@linux.ibm.com> (raw)
In-Reply-To: <20230804235624.263260-1-iii@linux.ibm.com>
Add a small test to prevent regressions.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
tests/tcg/s390x/Makefile.target | 1 +
tests/tcg/s390x/vstl.c | 37 +++++++++++++++++++++++++++++++++
2 files changed, 38 insertions(+)
create mode 100644 tests/tcg/s390x/vstl.c
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 649c1e520e6..e3e22c6f7e3 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -60,6 +60,7 @@ Z13_TESTS=vistr
Z13_TESTS+=lcbb
Z13_TESTS+=locfhr
Z13_TESTS+=vcksm
+Z13_TESTS+=vstl
$(Z13_TESTS): CFLAGS+=-march=z13 -O2
TESTS+=$(Z13_TESTS)
diff --git a/tests/tcg/s390x/vstl.c b/tests/tcg/s390x/vstl.c
new file mode 100644
index 00000000000..bece952c7ee
--- /dev/null
+++ b/tests/tcg/s390x/vstl.c
@@ -0,0 +1,37 @@
+/*
+ * Test the VSTL instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+#include "vx.h"
+
+static inline void vstl(S390Vector *v1, void *db2, size_t r3)
+{
+ asm("vstl %[v1],%[r3],%[db2]"
+ : [db2] "=Q" (*(char *)db2)
+ : [v1] "v" (v1->v), [r3] "r" (r3)
+ : "memory");
+}
+
+int main(void)
+{
+ uint64_t buf[3] = {0x1122334455667788ULL, 0x99aabbccddeeffULL,
+ 0x5a5a5a5a5a5a5a5aULL};
+ S390Vector v = {.d[0] = 0x1234567887654321ULL,
+ .d[1] = 0x9abcdef00fedcba9ULL};
+
+ vstl(&v, buf, 0);
+ assert(buf[0] == 0x1222334455667788ULL);
+
+ vstl(&v, buf, 1);
+ assert(buf[0] == 0x1234334455667788ULL);
+
+ vstl(&v, buf, -1);
+ assert(buf[0] == 0x1234567887654321ULL);
+ assert(buf[1] == 0x9abcdef00fedcba9ULL);
+ assert(buf[2] == 0x5a5a5a5a5a5a5a5aULL);
+
+ return EXIT_SUCCESS;
+}
--
2.41.0
next prev parent reply other threads:[~2023-08-04 23:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 23:55 [PATCH 1/2] target/s390x: Fix VSTL with a large length Ilya Leoshkevich
2023-08-04 23:55 ` Ilya Leoshkevich [this message]
2023-08-05 7:58 ` David Hildenbrand
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=20230804235624.263260-2-iii@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=david@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).