qemu-s390x
[Top][All Lists]
Advanced

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

Re: [PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset


From: David Hildenbrand
Subject: Re: [PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset
Date: Tue, 4 Jul 2023 09:56:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0

On 03.07.23 17:50, Ilya Leoshkevich wrote:
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/larl.c          | 17 +++++++++++++++++
  2 files changed, 18 insertions(+)
  create mode 100644 tests/tcg/s390x/larl.c

diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index 2ef22c88d95..dbf64c991e9 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -37,6 +37,7 @@ TESTS+=ex-relative-long
  TESTS+=ex-branch
  TESTS+=mxdb
  TESTS+=epsw
+TESTS+=larl
cdsg: CFLAGS+=-pthread
  cdsg: LDFLAGS+=-pthread
diff --git a/tests/tcg/s390x/larl.c b/tests/tcg/s390x/larl.c
new file mode 100644
index 00000000000..b9ced99a023
--- /dev/null
+++ b/tests/tcg/s390x/larl.c
@@ -0,0 +1,17 @@
+/*
+ * Test the LARL instruction.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#include <stdlib.h>
+
+int main(void)
+{
+    long algfi = (long)main;
+    long larl;
+
+    asm("algfi %[r],0xd0000000" : [r] "+r" (algfi) : : "cc");
+    asm("larl %[r],main+0xd0000000" : [r] "=r" (larl));

Not sure if worth combining both statements.

+
+    return algfi == larl ? EXIT_SUCCESS : EXIT_FAILURE;
+}

Acked-by: David Hildenbrand <david@redhat.com>

--
Cheers,

David / dhildenb




reply via email to

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