From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Ilya Leoshkevich <iii@linux.ibm.com>,
Richard Henderson <richard.henderson@linaro.org>
Subject: [PULL 9/9] tests/tcg/s390x: Test TEST AND SET
Date: Mon, 25 Mar 2024 15:12:10 +0100 [thread overview]
Message-ID: <20240325141210.788356-10-thuth@redhat.com> (raw)
In-Reply-To: <20240325141210.788356-1-thuth@redhat.com>
From: Ilya Leoshkevich <iii@linux.ibm.com>
Add a small test to prevent regressions.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20240318202722.20675-2-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/tcg/s390x/ts.c | 35 +++++++++++++++++++++++++++++++++
tests/tcg/s390x/Makefile.target | 1 +
2 files changed, 36 insertions(+)
create mode 100644 tests/tcg/s390x/ts.c
diff --git a/tests/tcg/s390x/ts.c b/tests/tcg/s390x/ts.c
new file mode 100644
index 0000000000..441faf30d9
--- /dev/null
+++ b/tests/tcg/s390x/ts.c
@@ -0,0 +1,35 @@
+/*
+ * Test the TEST AND SET instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+static int ts(char *p)
+{
+ int cc;
+
+ asm("ts %[p]\n"
+ "ipm %[cc]"
+ : [cc] "=r" (cc)
+ , [p] "+Q" (*p)
+ : : "cc");
+
+ return (cc >> 28) & 3;
+}
+
+int main(void)
+{
+ char c;
+
+ c = 0x80;
+ assert(ts(&c) == 1);
+ assert(c == 0xff);
+
+ c = 0x7f;
+ assert(ts(&c) == 0);
+ assert(c == 0xff);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index e2aba2ec27..a8f86c9449 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -47,6 +47,7 @@ TESTS+=add-logical-with-carry
TESTS+=lae
TESTS+=cvd
TESTS+=cvb
+TESTS+=ts
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
--
2.44.0
next prev parent reply other threads:[~2024-03-25 14:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-25 14:12 [PULL 0/9] Patches for QEMU 9.0-rc1 Thomas Huth
2024-03-25 14:12 ` [PULL 1/9] .travis.yml: Shorten the runtime of the problematic jobs Thomas Huth
2024-03-25 14:12 ` [PULL 2/9] .travis.yml: Remove the unused xfslib-dev package Thomas Huth
2024-03-25 14:12 ` [PULL 3/9] hw/microblaze: Do not allow xlnx-zynqmp-pmu-soc to be created by the user Thomas Huth
2024-03-25 14:12 ` [PULL 4/9] aspeed: Make the ast2600-a3 SoC not user creatable Thomas Huth
2024-03-25 14:12 ` [PULL 5/9] aspeed: Make the ast1030-a1 " Thomas Huth
2024-03-25 14:12 ` [PULL 6/9] misc/pca955*: Move models under hw/gpio Thomas Huth
2024-03-25 14:12 ` [PULL 7/9] libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick Thomas Huth
2024-03-25 14:12 ` [PULL 8/9] target/s390x: Use mutable temporary value for op_ts Thomas Huth
2024-03-25 14:12 ` Thomas Huth [this message]
2024-03-25 16:46 ` [PULL 0/9] Patches for QEMU 9.0-rc1 Peter Maydell
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=20240325141210.788356-10-thuth@redhat.com \
--to=thuth@redhat.com \
--cc=iii@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@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 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).