[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 5/5] tests/tcg/s390x: Add C(G)HRL test
From: |
Thomas Huth |
Subject: |
[PULL 5/5] tests/tcg/s390x: Add C(G)HRL test |
Date: |
Mon, 13 Mar 2023 15:10:57 +0100 |
From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Test COMPARE HALFWORD RELATIVE LONG instructions.
Test that the bytes following the second operand do not affect the
instruction.
Test the sign extension performed on the second operand.
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230310114157.3024170-3-nsg@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
tests/tcg/s390x/chrl.c | 80 +++++++++++++++++++++++++++++++++
tests/tcg/s390x/Makefile.target | 1 +
2 files changed, 81 insertions(+)
create mode 100644 tests/tcg/s390x/chrl.c
diff --git a/tests/tcg/s390x/chrl.c b/tests/tcg/s390x/chrl.c
new file mode 100644
index 0000000000..b1c3a1c561
--- /dev/null
+++ b/tests/tcg/s390x/chrl.c
@@ -0,0 +1,80 @@
+#include <stdlib.h>
+#include <assert.h>
+#include <stdint.h>
+
+static void test_chrl(void)
+{
+ uint32_t program_mask, cc;
+
+ asm volatile (
+ ".pushsection .rodata\n"
+ "0:\n\t"
+ ".short 1, 0x8000\n\t"
+ ".popsection\n\t"
+
+ "chrl %[r], 0b\n\t"
+ "ipm %[program_mask]\n"
+ : [program_mask] "=r" (program_mask)
+ : [r] "r" (1)
+ );
+
+ cc = program_mask >> 28;
+ assert(!cc);
+
+ asm volatile (
+ ".pushsection .rodata\n"
+ "0:\n\t"
+ ".short -1, 0x8000\n\t"
+ ".popsection\n\t"
+
+ "chrl %[r], 0b\n\t"
+ "ipm %[program_mask]\n"
+ : [program_mask] "=r" (program_mask)
+ : [r] "r" (-1)
+ );
+
+ cc = program_mask >> 28;
+ assert(!cc);
+}
+
+static void test_cghrl(void)
+{
+ uint32_t program_mask, cc;
+
+ asm volatile (
+ ".pushsection .rodata\n"
+ "0:\n\t"
+ ".short 1, 0x8000, 0, 0\n\t"
+ ".popsection\n\t"
+
+ "cghrl %[r], 0b\n\t"
+ "ipm %[program_mask]\n"
+ : [program_mask] "=r" (program_mask)
+ : [r] "r" (1L)
+ );
+
+ cc = program_mask >> 28;
+ assert(!cc);
+
+ asm volatile (
+ ".pushsection .rodata\n"
+ "0:\n\t"
+ ".short -1, 0x8000, 0, 0\n\t"
+ ".popsection\n\t"
+
+ "cghrl %[r], 0b\n\t"
+ "ipm %[program_mask]\n"
+ : [program_mask] "=r" (program_mask)
+ : [r] "r" (-1L)
+ );
+
+ cc = program_mask >> 28;
+ assert(!cc);
+}
+
+int main(void)
+{
+ test_chrl();
+ test_cghrl();
+ return EXIT_SUCCESS;
+}
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index b7f576f983..cf93b96686 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -28,6 +28,7 @@ TESTS+=div
TESTS+=clst
TESTS+=long-double
TESTS+=cdsg
+TESTS+=chrl
cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
--
2.31.1
- [PULL 0/5] s390x and test fixes for 8.0-rc0, Thomas Huth, 2023/03/13
- [PULL 4/5] target/s390x: Fix emulation of C(G)HRL, Thomas Huth, 2023/03/13
- [PULL 1/5] tests/migration: Tweek auto converge limits check, Thomas Huth, 2023/03/13
- [PULL 2/5] gitlab-ci: Remove job building EDK2 firmware binaries, Thomas Huth, 2023/03/13
- [PULL 3/5] gitlab-ci.d/buildtest: Rework the target list of build-system-alpine, Thomas Huth, 2023/03/13
- [PULL 5/5] tests/tcg/s390x: Add C(G)HRL test,
Thomas Huth <=
- Re: [PULL 0/5] s390x and test fixes for 8.0-rc0, Peter Maydell, 2023/03/14