[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 06/24] tests/tcg/s390x: Add rxsbg.c
From: |
Thomas Huth |
Subject: |
[PULL 06/24] tests/tcg/s390x: Add rxsbg.c |
Date: |
Mon, 20 Mar 2023 14:03:12 +0100 |
From: Ilya Leoshkevich <iii@linux.ibm.com>
Add a small test for RXSBG with T=1 to prevent regressions.
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230316172205.281369-3-iii@linux.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/tcg/s390x/rxsbg.c | 46 +++++++++++++++++++++++++++++++++
tests/tcg/s390x/Makefile.target | 3 +++
2 files changed, 49 insertions(+)
create mode 100644 tests/tcg/s390x/rxsbg.c
diff --git a/tests/tcg/s390x/rxsbg.c b/tests/tcg/s390x/rxsbg.c
new file mode 100644
index 0000000000..4b155db304
--- /dev/null
+++ b/tests/tcg/s390x/rxsbg.c
@@ -0,0 +1,46 @@
+/*
+ * Test the RXSBG instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <assert.h>
+#include <stdlib.h>
+
+static inline __attribute__((__always_inline__)) void
+rxsbg(unsigned long *r1, unsigned long r2, int i3, int i4, int i5, int *cc)
+{
+ asm("rxsbg %[r1],%[r2],%[i3],%[i4],%[i5]\n"
+ "ipm %[cc]"
+ : [r1] "+r" (*r1), [cc] "=r" (*cc)
+ : [r2] "r" (r2) , [i3] "i" (i3) , [i4] "i" (i4) , [i5] "i" (i5)
+ : "cc");
+ *cc = (*cc >> 28) & 3;
+}
+
+void test_cc0(void)
+{
+ unsigned long r1 = 6;
+ int cc;
+
+ rxsbg(&r1, 3, 61 | 0x80, 62, 1, &cc);
+ assert(r1 == 6);
+ assert(cc == 0);
+}
+
+void test_cc1(void)
+{
+ unsigned long r1 = 2;
+ int cc;
+
+ rxsbg(&r1, 3, 61 | 0x80, 62, 1, &cc);
+ assert(r1 == 2);
+ assert(cc == 1);
+}
+
+int main(void)
+{
+ test_cc0();
+ test_cc1();
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index cf93b96686..3c940ac952 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -29,10 +29,13 @@ TESTS+=clst
TESTS+=long-double
TESTS+=cdsg
TESTS+=chrl
+TESTS+=rxsbg
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
+rxsbg: CFLAGS+=-O2
+
Z13_TESTS=vistr
$(Z13_TESTS): CFLAGS+=-march=z13 -O2
TESTS+=$(Z13_TESTS)
--
2.31.1
- [PULL 00/24] s390x and misc patches for 8.0-rc1, Thomas Huth, 2023/03/20
- [PULL 05/24] target/s390x: Fix R[NOX]SBG with T=1, Thomas Huth, 2023/03/20
- [PULL 04/24] tests/tcg/s390x: Add PSW modification tests, Thomas Huth, 2023/03/20
- [PULL 01/24] MAINTAINERS: Mark the Nios II CPU as orphan, Thomas Huth, 2023/03/20
- [PULL 07/24] target/s390x: Fix EXECUTE of relative long instructions, Thomas Huth, 2023/03/20
- [PULL 06/24] tests/tcg/s390x: Add rxsbg.c,
Thomas Huth <=
- [PULL 09/24] target/s390x: Handle branching to odd addresses, Thomas Huth, 2023/03/20
- [PULL 08/24] tests/tcg/s390x: Add ex-relative-long.c, Thomas Huth, 2023/03/20
- [PULL 10/24] target/s390x: Handle EXECUTE of odd addresses, Thomas Huth, 2023/03/20
- [PULL 13/24] target/s390x: Handle LLGFRL from non-aligned addresses, Thomas Huth, 2023/03/20
- [PULL 11/24] target/s390x: Handle LGRL from non-aligned addresses, Thomas Huth, 2023/03/20
- [PULL 12/24] target/s390x: Handle LRL and LGFRL from non-aligned addresses, Thomas Huth, 2023/03/20
- [PULL 15/24] target/s390x: Handle CGRL and CLGRL with non-aligned addresses, Thomas Huth, 2023/03/20
- [PULL 02/24] target/s390x: Fix LPSW, Thomas Huth, 2023/03/20
- [PULL 14/24] target/s390x: Handle CRL and CGFRL with non-aligned addresses, Thomas Huth, 2023/03/20
- [PULL 21/24] target/s390x/tcg/mem_helper: Remove bad assert() statement, Thomas Huth, 2023/03/20