From: Ilya Leoshkevich <iii@linux.ibm.com>
To: Claudio Fontana <cfontana@suse.de>,
Laurent Vivier <laurent@vivier.eu>,
Richard Henderson <richard.henderson@linaro.org>,
David Hildenbrand <david@redhat.com>,
Thomas Huth <thuth@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-s390x@nongnu.org
Subject: Re: [PATCH 3/3] tests/tcg/s390x: Test VSTRS
Date: Mon, 07 Aug 2023 10:08:33 +0200 [thread overview]
Message-ID: <9ef4a41fddc9c27bef7dab401c85eb79c42b7fe5.camel@linux.ibm.com> (raw)
In-Reply-To: <85745fff-825c-0084-00ff-9875fe1a6f5a@suse.de>
On Sun, 2023-08-06 at 13:05 +0200, Claudio Fontana wrote:
> On 8/5/23 01:03, 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/vxeh2_vstrs.c | 88
> > +++++++++++++++++++++++++++++++++
> > 2 files changed, 89 insertions(+)
> > create mode 100644 tests/tcg/s390x/vxeh2_vstrs.c
> >
> > diff --git a/tests/tcg/s390x/Makefile.target
> > b/tests/tcg/s390x/Makefile.target
> > index 1fc98099070..8ba36e5985b 100644
> > --- a/tests/tcg/s390x/Makefile.target
> > +++ b/tests/tcg/s390x/Makefile.target
> > @@ -73,6 +73,7 @@ ifneq ($(CROSS_CC_HAS_Z15),)
> > Z15_TESTS=vxeh2_vs
> > Z15_TESTS+=vxeh2_vcvt
> > Z15_TESTS+=vxeh2_vlstr
> > +Z15_TESTS+=vxeh2_vstrs
> > $(Z15_TESTS): CFLAGS+=-march=z15 -O2
> > TESTS+=$(Z15_TESTS)
> > endif
> > diff --git a/tests/tcg/s390x/vxeh2_vstrs.c
> > b/tests/tcg/s390x/vxeh2_vstrs.c
> > new file mode 100644
> > index 00000000000..313ec1d728f
> > --- /dev/null
> > +++ b/tests/tcg/s390x/vxeh2_vstrs.c
> > @@ -0,0 +1,88 @@
> > +/*
> > + * Test the VSTRS instruction.
> > + *
> > + * SPDX-License-Identifier: GPL-2.0-or-later
> > + */
> > +#include <assert.h>
> > +#include <stdint.h>
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include "vx.h"
> > +
> > +static inline __attribute__((__always_inline__)) int
> > +vstrs(S390Vector *v1, const S390Vector *v2, const S390Vector *v3,
> > + const S390Vector *v4, const uint8_t m5, const uint8_t m6)
> > +{
> > + int cc;
> > +
> > + asm("vstrs %[v1],%[v2],%[v3],%[v4],%[m5],%[m6]\n"
> > + "ipm %[cc]"
> > + : [v1] "=v" (v1->v)
> > + , [cc] "=r" (cc)
> > + : [v2] "v" (v2->v)
> > + , [v3] "v" (v3->v)
> > + , [v4] "v" (v4->v)
> > + , [m5] "i" (m5)
> > + , [m6] "i" (m6)
> > + : "cc");
> > +
> > + return (cc >> 28) & 3;
> Following the POp, I am puzzled by the use of an "int" to contain the
> register result of the IPM instruction, should it not be a 64bit
> variable?
> bits 0-31 are left unchanged / are uninteresting, is that enough to
> avoid having to use a properly sized variable?
The compiler understands that if the type is int, then the asm block
will not touch the upper 32 bits of the register that's assigned to it.
This observation is used not only in the QEMU tests, but also all over
arch/s390 in the Linux kernel.
>
> I see that this is done elsewhere in the tests (sometimes a 64bit
> variable is used, sometimes just 'int'), so I assume it's probably
> fine.
>
> Otherwise lgtm,
>
> Claudio
[...]
>
next prev parent reply other threads:[~2023-08-07 8:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-04 23:03 [PATCH 0/3] target/s390x: Fix the "ignored match" case in VSTRS Ilya Leoshkevich
2023-08-04 23:03 ` [PATCH 1/3] linux-user/elfload: Enable vxe2 on s390x Ilya Leoshkevich
2023-08-05 4:22 ` Richard Henderson
2023-08-05 8:01 ` David Hildenbrand
2023-08-17 9:17 ` Claudio Fontana
2023-08-04 23:03 ` [PATCH 2/3] target/s390x: Fix the "ignored match" case in VSTRS Ilya Leoshkevich
2023-08-05 8:02 ` David Hildenbrand
2023-08-07 8:10 ` Ilya Leoshkevich
2023-08-23 10:03 ` David Hildenbrand
2023-08-06 12:54 ` Claudio Fontana
2023-08-04 23:03 ` [PATCH 3/3] tests/tcg/s390x: Test VSTRS Ilya Leoshkevich
2023-08-06 11:05 ` Claudio Fontana
2023-08-07 8:08 ` Ilya Leoshkevich [this message]
2023-08-07 8:45 ` Claudio Fontana
2023-08-17 9:37 ` Claudio Fontana
2023-08-17 16:57 ` Ilya Leoshkevich
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ef4a41fddc9c27bef7dab401c85eb79c42b7fe5.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=cfontana@suse.de \
--cc=david@redhat.com \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=thuth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).