qemu/tests/tcg/s390x/larl.c
Ilya Leoshkevich ad85ac6a8f tests/tcg/s390x: Test LARL with a large offset
Add a small test to prevent regressions.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Message-Id: <20230704081506.276055-10-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-07-10 15:34:24 +02:00

22 lines
464 B
C

/*
* Test the LARL instruction.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <stdlib.h>
int main(void)
{
long algfi = (long)main;
long larl;
/*
* The compiler may emit larl for the C addition, so compute the expected
* value using algfi.
*/
asm("algfi %[r],0xd0000000" : [r] "+r" (algfi) : : "cc");
asm("larl %[r],main+0xd0000000" : [r] "=r" (larl));
return algfi == larl ? EXIT_SUCCESS : EXIT_FAILURE;
}