qemu/tests/tcg/s390x/mdeb.c
Ilya Leoshkevich 85411ac9b3 tests/tcg/s390x: Test MDEB and MDEBR
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-12-iii@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
2023-07-10 15:34:24 +02:00

31 lines
557 B
C

/*
* Test the MDEB and MDEBR instructions.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <assert.h>
#include <stdlib.h>
int main(void)
{
union {
float f[2];
double d;
} a;
float b;
a.f[0] = 1.2345;
a.f[1] = 999;
b = 6.789;
asm("mdeb %[a],%[b]" : [a] "+f" (a.d) : [b] "R" (b));
assert(a.d > 8.38 && a.d < 8.39);
a.f[0] = 1.2345;
a.f[1] = 999;
b = 6.789;
asm("mdebr %[a],%[b]" : [a] "+f" (a.d) : [b] "f" (b));
assert(a.d > 8.38 && a.d < 8.39);
return EXIT_SUCCESS;
}