qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: LIU Zhiwei <zhiwei_liu@c-sky.com>
Cc: palmer@dabbelt.com, Alistair.Francis@wdc.com,
	qemu-devel@nongnu.org, Chih-Min Chao <chihmin.chao@sifive.com>
Subject: Re: [Qemu-devel] [PATCH] RISCV: support riscv vector extension 0.7.1
Date: Sat, 28 Dec 2019 12:14:01 +1100	[thread overview]
Message-ID: <9e1c5407-3704-9c34-92d7-fd59e48eb13a@linaro.org> (raw)
In-Reply-To: <ea5d5926-48ba-e204-cad8-7e5260b2e2ee@c-sky.com>

On 12/25/19 8:36 PM, LIU Zhiwei wrote:
> struct {
> 
>         uint64_t vreg[32 * RV_VLEN_MAX / 64] QEMU_ALIGNED(16);
>         target_ulong vxrm;
>         target_ulong vxsat;
>         target_ulong vl;
>         target_ulong vstart;
>         target_ulong vtype;
>     } vext;
> 
> Is it OK?
I don't think there's a good reason for the vext structure -- I would drop
that.  Otherwise it looks good.

> However, there are still some differences from SVE.
> 
> 1)cpu_env must be used as a parameter for helper function.
> 
>     The helpers need  use env->vext.vl and env->vext.vstart.  Thus it will be
> difficult to use out of line tcg_gen_gvec_ool.

Sure.  That's also true of any of the fp operations, which will want to
accumulate ieee exceptions.

See tcg_gen_gvec_*_ptr(), which allows you to pass in cpu_env.

> 2)simd_desc is not proper.
> 
>     I also need to transfer some members of DisasContext to helpers. 
> 
>     (Data, Vlmax, Mlen) is my current choice. Vlmax is the num of elements of
> this operation, so it will defined as ctx->lmul * ctx->vlen / ctx->sew;

The oprsz & maxsz parameters to tcg_gen_gvec_* should be given (ctx->lmul *
ctx->vlen).  The sew parameter should be implied by the helper function called,
each helper function using a different type.  Therefore vlmax can be trivially
computed within the helper from oprsz / sizeof(type).

> Data is reserved to expand.  Mlen is mask length for one elment, so it will
> defined as ctx->sew/ctx->lmul. As with Mlen, a active element will
> 
> be selected by
> 
>     static inline int vext_elem_mask(void *v0, int mlen, int index)
>     {
>         int idx = (index * mlen) / 8;
>         int pos = (index * mlen) % 8;
> 
>         return (v0[idx] >> pos) & 0x1;
>     }
> 
>     So I may have to implement vext_desc instead of use the simd_desc, which
> will be another redundant. Maybe a better way to mask elements?

I think you will want to define your own vext_desc, building upon simd_desc,
such that lg2(mlen) is passed in the first N bits of simd_data.


r~


  reply	other threads:[~2019-12-28  1:15 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1566959818-38369-1-git-send-email-zhiwei_liu@c-sky.com>
2019-08-28  9:08 ` [Qemu-devel] [PATCH] RISCV: support riscv vector extension 0.7.1 Alex Bennée
2019-08-28 16:39   ` Richard Henderson
2019-08-29 13:35   ` liuzhiwei
2019-08-28 18:54 ` Richard Henderson
2019-08-28 20:43   ` Richard Henderson
2019-08-29 12:45     ` liuzhiwei
2019-08-29 15:09       ` Richard Henderson
2019-09-02  7:45         ` liuzhiwei
2019-09-03 14:38           ` Richard Henderson
2019-09-02  9:43   ` liuzhiwei
2019-09-03 14:21     ` Richard Henderson
2019-12-19  9:11   ` LIU Zhiwei
2019-12-19 20:38     ` Richard Henderson
2019-12-25  9:36       ` LIU Zhiwei
2019-12-28  1:14         ` Richard Henderson [this message]
2019-12-30  8:11           ` LIU Zhiwei
2020-01-05 20:19             ` Richard Henderson
2019-08-28 21:34 ` Alistair Francis
2019-08-29 12:00   ` liuzhiwei
2019-08-29 15:14     ` Richard Henderson
2019-09-02  6:54       ` liuzhiwei
2019-08-29 21:50     ` Alistair Francis
2019-08-30  9:06       ` Alex Bennée
2019-08-30 18:39         ` Alistair Francis
2019-09-02  6:36       ` liuzhiwei
     [not found] ` <CAL1e-=iHangj7w+HgJ+FM=iqRLmaY-_CYeUv0gx+c8bpScb9RQ@mail.gmail.com>
     [not found]   ` <46ade3da-d642-bd19-7975-7dc228d401e4@c-sky.com>
2019-08-29 18:32     ` Aleksandar Markovic
     [not found] ` <CAEiOBXXofjrY2=sjuMDb9dTV2fk9yUVKnr+qmf+7mg9vki6OCw@mail.gmail.com>
2019-09-02  8:17   ` [Qemu-devel] [Qemu-riscv] " liuzhiwei

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=9e1c5407-3704-9c34-92d7-fd59e48eb13a@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=Alistair.Francis@wdc.com \
    --cc=chihmin.chao@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=zhiwei_liu@c-sky.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).