Skip to content

Commit

Permalink
tests/tcg/s390x: Test MDEB and MDEBR
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
iii-i authored and huth committed Jul 10, 2023
1 parent 028dc70 commit 85411ac
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ TESTS+=ex-branch
TESTS+=mxdb
TESTS+=epsw
TESTS+=larl
TESTS+=mdeb

cdsg: CFLAGS+=-pthread
cdsg: LDFLAGS+=-pthread
Expand Down
30 changes: 30 additions & 0 deletions tests/tcg/s390x/mdeb.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* 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;
}

0 comments on commit 85411ac

Please sign in to comment.