From: Ilya Leoshkevich <iii@linux.ibm.com>
To: "Richard Henderson" <richard.henderson@linaro.org>,
"David Hildenbrand" <david@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Thomas Huth" <thuth@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
Christian Borntraeger <borntraeger@linux.ibm.com>
Subject: Re: [PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax
Date: Tue, 12 Jul 2022 14:32:53 +0200 [thread overview]
Message-ID: <c7a32437850ddc70438173ff7f0f0966e5f48384.camel@linux.ibm.com> (raw)
In-Reply-To: <c7897b91-dbfd-3a32-68c8-d7afa40495ba@linaro.org>
On Tue, 2022-07-12 at 10:19 +0530, Richard Henderson wrote:
> On 7/12/22 07:27, Ilya Leoshkevich wrote:
> > +/*
> > + * vfmin/vfmax code generation.
> > + */
> > +extern const char vfminmax_template[];
> > +extern const int vfminmax_template_size;
> > +extern const int vfminmax_offset;
> > +asm(".globl vfminmax_template\n"
> > + "vfminmax_template:\n"
> > + "vl %v25,0(%r3)\n"
> > + "vl %v26,0(%r4)\n"
> > + "0: vfmax %v24,%v25,%v26,2,0,0\n"
> > + "vst %v24,0(%r2)\n"
> > + "br %r14\n"
> > + "1: .align 4\n"
> > + ".globl vfminmax_template_size\n"
> > + "vfminmax_template_size: .long 1b - vfminmax_template\n"
> > + ".globl vfminmax_offset\n"
> > + "vfminmax_offset: .long 0b - vfminmax_template\n");
> ...
> > +
> > +#define VFMIN 0xEE
> > +#define VFMAX 0xEF
> > +
> > +static void vfminmax(unsigned char *buf, unsigned int op,
> > + unsigned int m4, unsigned int m5, unsigned
> > int m6,
> > + void *v1, const void *v2, const void *v3)
> > +{
> > + memcpy(buf, vfminmax_template, vfminmax_template_size);
> > + buf[vfminmax_offset + 3] = (m6 << 4) | m5;
> > + buf[vfminmax_offset + 4] &= 0x0F;
> > + buf[vfminmax_offset + 4] |= (m4 << 4);
> > + buf[vfminmax_offset + 5] = op;
> > + ((void (*)(void *, const void *, const void *))buf)(v1, v2,
> > v3);
> > +}
>
> This works, of course. It could be simpler using EXECUTE, to store
> just the one
> instruction and not worry about an executable mapped page, but I
> guess it doesn't matter.
>
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
>
> r~
Thanks!
I thought about this too, but EX/EXRL operate only on the second byte,
and I need to modify bytes 3-5 here.
next prev parent reply other threads:[~2022-07-12 12:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-12 1:57 [PATCH 0/3] target/s390x: vfmin/vfmax fixes Ilya Leoshkevich
2022-07-12 1:57 ` [PATCH 1/3] target/s390x: fix handling of zeroes in vfmin/vfmax Ilya Leoshkevich
2022-07-12 4:23 ` Richard Henderson
2022-07-12 7:16 ` David Hildenbrand
2022-07-12 1:57 ` [PATCH 2/3] target/s390x: fix NaN propagation rules Ilya Leoshkevich
2022-07-12 4:24 ` Richard Henderson
2022-07-12 7:17 ` David Hildenbrand
2022-07-12 1:57 ` [PATCH 3/3] tests/tcg/s390x: test signed vfmin/vfmax Ilya Leoshkevich
2022-07-12 4:49 ` Richard Henderson
2022-07-12 12:32 ` Ilya Leoshkevich [this message]
2022-07-13 15:44 ` Richard Henderson
2022-07-13 16:14 ` 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=c7a32437850ddc70438173ff7f0f0966e5f48384.camel@linux.ibm.com \
--to=iii@linux.ibm.com \
--cc=alex.bennee@linaro.org \
--cc=aurelien@aurel32.net \
--cc=borntraeger@linux.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=peter.maydell@linaro.org \
--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).