qemu-s390x
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/2] tests/tcg/s390x: Add rxsbg.c


From: Ilya Leoshkevich
Subject: [PATCH 2/2] tests/tcg/s390x: Add rxsbg.c
Date: Wed, 15 Mar 2023 00:34:43 +0100

Add a small test for RXSBG with T=1 to prevent regressions.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tests/tcg/s390x/Makefile.target |  1 +
 tests/tcg/s390x/rxsbg.c         | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 tests/tcg/s390x/rxsbg.c

diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index cf93b966862..b4d0d704534 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -29,6 +29,7 @@ TESTS+=clst
 TESTS+=long-double
 TESTS+=cdsg
 TESTS+=chrl
+TESTS+=rxsbg
 
 cdsg: CFLAGS+=-pthread
 cdsg: LDFLAGS+=-pthread
diff --git a/tests/tcg/s390x/rxsbg.c b/tests/tcg/s390x/rxsbg.c
new file mode 100644
index 00000000000..b7f35411899
--- /dev/null
+++ b/tests/tcg/s390x/rxsbg.c
@@ -0,0 +1,25 @@
+/*
+ * Smoke test RXSBG instruction with T=1.
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+int main(void)
+{
+    unsigned long r1, r2, cc;
+
+    r1 = 0xc8dc86a225a77bb4;
+    r2 = 0xd6aff24fa3e7320;
+    cc = 0;
+    asm("rxsbg %[r1],%[r2],177,43,228\n"
+        "ipm %[cc]"
+        : [cc] "+r" (cc)
+        : [r1] "r" (r1)
+        , [r2] "r" (r2)
+        : "cc");
+    cc = (cc >> 28) & 1;
+    assert(cc == 1);
+
+    return EXIT_SUCCESS;
+}
-- 
2.39.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]