From: Richard Henderson <richard.henderson@linaro.org>
To: Huang Tao <eric.huang@linux.alibaba.com>, qemu-devel@nongnu.org
Cc: qemu-riscv@nongnu.org, zhiwei_liu@linux.alibaba.com,
dbarboza@ventanamicro.com, liwei1518@gmail.com,
bin.meng@windriver.com, alistair.francis@wdc.com,
palmer@dabbelt.com
Subject: Re: [PATCH v2] target/riscv: Fix the element agnostic function problem
Date: Wed, 20 Mar 2024 22:18:04 -1000 [thread overview]
Message-ID: <ed5675bc-f82b-4d4e-95e4-1a3045dd1870@linaro.org> (raw)
In-Reply-To: <20240321035816.99983-1-eric.huang@linux.alibaba.com>
On 3/20/24 17:58, Huang Tao wrote:
> In RVV and vcrypto instructions, the masked and tail elements are set to 1s
> using vext_set_elems_1s function if the vma/vta bit is set. It is the element
> agnostic policy.
>
> However, this function can't deal the big endian situation. This patch fixes
> the problem by adding handling of such case.
>
> Signed-off-by: Huang Tao <eric.huang@linux.alibaba.com>
> Suggested-by: Richard Henderson <richard.henderson@linaro.org>
> ---
> Changes in v2:
> - Keep the api of vext_set_elems_1s
> - Reduce the number of patches.
> ---
> target/riscv/vector_internals.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/target/riscv/vector_internals.c b/target/riscv/vector_internals.c
> index 12f5964fbb..3e45b9b4a7 100644
> --- a/target/riscv/vector_internals.c
> +++ b/target/riscv/vector_internals.c
> @@ -30,6 +30,28 @@ void vext_set_elems_1s(void *base, uint32_t is_agnostic, uint32_t cnt,
> if (tot - cnt == 0) {
> return ;
> }
> +
> +#if HOST_BIG_ENDIAN
> + /*
> + * Deal the situation when the elements are insdie
> + * only one uint64 block including setting the
> + * masked-off element.
> + */
> + if ((tot - 1) ^ cnt < 8) {
> + memset(base + H1(tot - 1), -1, tot - cnt);
> + return;
> + }
(1) tot will always be a multiple of 8, afaik, so there's no need for this first block.
(2) Using if not #if means that the code is always compile-tested, even if it is eliminated.
r~
next prev parent reply other threads:[~2024-03-21 8:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 3:58 [PATCH v2] target/riscv: Fix the element agnostic function problem Huang Tao
2024-03-21 5:54 ` LIU Zhiwei
2024-03-21 8:18 ` Richard Henderson [this message]
2024-03-21 8:31 ` Huang Tao
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=ed5675bc-f82b-4d4e-95e4-1a3045dd1870@linaro.org \
--to=richard.henderson@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=bin.meng@windriver.com \
--cc=dbarboza@ventanamicro.com \
--cc=eric.huang@linux.alibaba.com \
--cc=liwei1518@gmail.com \
--cc=palmer@dabbelt.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-riscv@nongnu.org \
--cc=zhiwei_liu@linux.alibaba.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).