qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Ilya Leoshkevich <iii@linux.ibm.com>,
	Richard Henderson <richard.henderson@linaro.org>,
	Thomas Huth <thuth@redhat.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org, qemu-stable@nongnu.org
Subject: Re: [PATCH 4/4] tests/tcg/s390x: Test LOCFHR
Date: Sun, 28 May 2023 20:56:30 +0200	[thread overview]
Message-ID: <3de62daa-1745-d409-beee-c60b4b5c6662@redhat.com> (raw)
In-Reply-To: <20230526181240.1425579-5-iii@linux.ibm.com>

On 26.05.23 20:12, Ilya Leoshkevich wrote:
> Add a small test to prevent regressions.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>   tests/tcg/s390x/Makefile.target |  1 +
>   tests/tcg/s390x/locfhr.c        | 29 +++++++++++++++++++++++++++++
>   2 files changed, 30 insertions(+)
>   create mode 100644 tests/tcg/s390x/locfhr.c
> 
> diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
> index c48de439625..3c239fdd082 100644
> --- a/tests/tcg/s390x/Makefile.target
> +++ b/tests/tcg/s390x/Makefile.target
> @@ -48,6 +48,7 @@ TESTS += $(PGM_SPECIFICATION_TESTS)
>   
>   Z13_TESTS=vistr
>   Z13_TESTS+=lcbb
> +Z13_TESTS+=locfhr
>   $(Z13_TESTS): CFLAGS+=-march=z13 -O2
>   TESTS+=$(Z13_TESTS)
>   
> diff --git a/tests/tcg/s390x/locfhr.c b/tests/tcg/s390x/locfhr.c
> new file mode 100644
> index 00000000000..ab9ff6e4490
> --- /dev/null
> +++ b/tests/tcg/s390x/locfhr.c
> @@ -0,0 +1,29 @@
> +/*
> + * Test the LOCFHR instruction.
> + *
> + * SPDX-License-Identifier: GPL-2.0-or-later
> + */
> +#include <assert.h>
> +#include <stdlib.h>
> +
> +static inline __attribute__((__always_inline__)) long
> +locfhr(long r1, long r2, int m3, int cc)
> +{
> +    cc <<= 28;
> +    asm("spm %[cc]\n"
> +        "locfhr %[r1],%[r2],%[m3]\n"
> +        : [r1] "+r" (r1)
> +        : [cc] "r" (cc), [r2] "r" (r2), [m3] "i" (m3)
> +        : "cc");
> +    return r1;
> +}
> +
> +int main(void)
> +{
> +    assert(locfhr(0x1111111122222222, 0x3333333344444444, 8, 0) ==
> +           0x3333333322222222);
> +    assert(locfhr(0x5555555566666666, 0x7777777788888888, 11, 1) ==
> +           0x5555555566666666);
> +
> +    return EXIT_SUCCESS;
> +}

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb



      parent reply	other threads:[~2023-05-28 18:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-26 18:12 [PATCH 0/4] Fix Fedora 38 Clang on s390x Ilya Leoshkevich
2023-05-26 18:12 ` [PATCH 1/4] target/s390x: Fix LCBB overwriting the top 32 bits Ilya Leoshkevich
2023-05-26 23:11   ` Richard Henderson
2023-05-28 18:55   ` David Hildenbrand
2023-05-26 18:12 ` [PATCH 2/4] tests/tcg/s390x: Test LCBB Ilya Leoshkevich
2023-05-26 23:13   ` Richard Henderson
2023-05-28 18:55   ` David Hildenbrand
2023-05-26 18:12 ` [PATCH 3/4] target/s390x: Fix LOCFHR taking the wrong half of R2 Ilya Leoshkevich
2023-05-26 23:03   ` Richard Henderson
2023-05-28 18:55   ` David Hildenbrand
2023-05-26 18:12 ` [PATCH 4/4] tests/tcg/s390x: Test LOCFHR Ilya Leoshkevich
2023-05-26 23:14   ` Richard Henderson
2023-05-28 18:56   ` David Hildenbrand [this message]

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=3de62daa-1745-d409-beee-c60b4b5c6662@redhat.com \
    --to=david@redhat.com \
    --cc=iii@linux.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=qemu-stable@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).