Message ID | 20230703155801.179167-9-iii@linux.ibm.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | target/s390x: Miscellaneous TCG fixes | expand |
On 03.07.23 17:50, Ilya Leoshkevich wrote: > Add a small test to prevent regressions. > > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> > --- > tests/tcg/s390x/Makefile.target | 1 + > tests/tcg/s390x/epsw.c | 23 +++++++++++++++++++++++ > 2 files changed, 24 insertions(+) > create mode 100644 tests/tcg/s390x/epsw.c > > diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target > index 85abfbb98c0..2ef22c88d95 100644 > --- a/tests/tcg/s390x/Makefile.target > +++ b/tests/tcg/s390x/Makefile.target > @@ -36,6 +36,7 @@ TESTS+=rxsbg > TESTS+=ex-relative-long > TESTS+=ex-branch > TESTS+=mxdb > +TESTS+=epsw > > cdsg: CFLAGS+=-pthread > cdsg: LDFLAGS+=-pthread > diff --git a/tests/tcg/s390x/epsw.c b/tests/tcg/s390x/epsw.c > new file mode 100644 > index 00000000000..affb1a5e3a1 > --- /dev/null > +++ b/tests/tcg/s390x/epsw.c > @@ -0,0 +1,23 @@ > +/* > + * Test the EPSW instruction. > + * > + * SPDX-License-Identifier: GPL-2.0-or-later > + */ > +#include <assert.h> > +#include <stdlib.h> > + > +int main(void) > +{ > + unsigned long r1 = 0x1234567887654321UL, r2 = 0x8765432112345678UL; > + > + asm("cr %[r1],%[r2]\n" /* cc = 1 */ > + "epsw %[r1],%[r2]" > + : [r1] "+r" (r1), [r2] "+r" (r2) : : "cc"); > + > + /* Do not check the R and RI bits. */ > + r1 &= ~0x40000008UL; > + assert(r1 == 0x1234567807051001UL); > + assert(r2 == 0x8765432180000000UL); > + > + return EXIT_SUCCESS; > +} Reviewed-by: David Hildenbrand <david@redhat.com>
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target index 85abfbb98c0..2ef22c88d95 100644 --- a/tests/tcg/s390x/Makefile.target +++ b/tests/tcg/s390x/Makefile.target @@ -36,6 +36,7 @@ TESTS+=rxsbg TESTS+=ex-relative-long TESTS+=ex-branch TESTS+=mxdb +TESTS+=epsw cdsg: CFLAGS+=-pthread cdsg: LDFLAGS+=-pthread diff --git a/tests/tcg/s390x/epsw.c b/tests/tcg/s390x/epsw.c new file mode 100644 index 00000000000..affb1a5e3a1 --- /dev/null +++ b/tests/tcg/s390x/epsw.c @@ -0,0 +1,23 @@ +/* + * Test the EPSW instruction. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ +#include <assert.h> +#include <stdlib.h> + +int main(void) +{ + unsigned long r1 = 0x1234567887654321UL, r2 = 0x8765432112345678UL; + + asm("cr %[r1],%[r2]\n" /* cc = 1 */ + "epsw %[r1],%[r2]" + : [r1] "+r" (r1), [r2] "+r" (r2) : : "cc"); + + /* Do not check the R and RI bits. */ + r1 &= ~0x40000008UL; + assert(r1 == 0x1234567807051001UL); + assert(r2 == 0x8765432180000000UL); + + return EXIT_SUCCESS; +}
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/epsw.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 tests/tcg/s390x/epsw.c