Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests/tcg/s390x: Test MXDB and MXDBR
Add a small test to prevent regressions.

Cc: qemu-stable@nongnu.org
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-Id: <20230601223027.795501-3-iii@linux.ibm.com>
Acked-by: David Hildenbrand <david@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
  • Loading branch information
iii-i authored and huth committed Jun 5, 2023
1 parent a7f4add commit 2b95624
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/tcg/s390x/Makefile.target
Expand Up @@ -35,6 +35,7 @@ TESTS+=chrl
TESTS+=rxsbg
TESTS+=ex-relative-long
TESTS+=ex-branch
TESTS+=mxdb

cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
Expand Down
30 changes: 30 additions & 0 deletions tests/tcg/s390x/mxdb.c
@@ -0,0 +1,30 @@
/*
* Test the MXDB and MXDBR instructions.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <assert.h>
#include <stdlib.h>

int main(void)
{
union {
double d[2];
long double ld;
} a;
double b;

a.d[0] = 1.2345;
a.d[1] = 999;
b = 6.789;
asm("mxdb %[a],%[b]" : [a] "+f" (a.ld) : [b] "R" (b));
assert(a.ld > 8.38 && a.ld < 8.39);

a.d[0] = 1.2345;
a.d[1] = 999;
b = 6.789;
asm("mxdbr %[a],%[b]" : [a] "+f" (a.ld) : [b] "f" (b));
assert(a.ld > 8.38 && a.ld < 8.39);

return EXIT_SUCCESS;
}

0 comments on commit 2b95624

Please sign in to comment.