xref: /openbmc/qemu/tests/tcg/s390x/mdeb.c (revision 2df1eb27)
1 /*
2  * Test the MDEB and MDEBR instructions.
3  *
4  * SPDX-License-Identifier: GPL-2.0-or-later
5  */
6 #include <assert.h>
7 #include <stdlib.h>
8 
9 int main(void)
10 {
11     union {
12         float f[2];
13         double d;
14     } a;
15     float b;
16 
17     a.f[0] = 1.2345;
18     a.f[1] = 999;
19     b = 6.789;
20     asm("mdeb %[a],%[b]" : [a] "+f" (a.d) : [b] "R" (b));
21     assert(a.d > 8.38 && a.d < 8.39);
22 
23     a.f[0] = 1.2345;
24     a.f[1] = 999;
25     b = 6.789;
26     asm("mdebr %[a],%[b]" : [a] "+f" (a.d) : [b] "f" (b));
27     assert(a.d > 8.38 && a.d < 8.39);
28 
29     return EXIT_SUCCESS;
30 }
31