qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: gaosong <gaosong@loongson.cn>, qemu-devel@nongnu.org
Subject: Re: [RFC PATCH 10/43] target/loongarch: Implement vaddw/vsubw
Date: Mon, 27 Feb 2023 08:40:50 -1000	[thread overview]
Message-ID: <5b3120cd-ddfb-770b-3216-0f02e89c9c24@linaro.org> (raw)
In-Reply-To: <5ce46e81-b2c3-8b45-1bd9-9705520f4557@loongson.cn>

On 2/27/23 02:55, gaosong wrote:
> 
> 在 2023/2/25 上午3:24, Richard Henderson 写道:
>>>          {
>>>              .fniv = gen_vaddwev_s,
>>>              .fno = gen_helper_vaddwev_q_d,
>>>              .opt_opc = vecop_list,
>>>              .vece = MO_128
>>>          },
>>
>> There are no 128-bit vector operations; you'll need to do this one differently.
>>
>> Presumably just load the two 64-bit elements, sign-extend into 128-bits, add with 
>> tcg_gen_add2_i64, and store the two 64-bit elements as output.  But that won't fit into 
>> the tcg_gen_gvec_3 interface.
>>
> 'sign-extend into 128-bits,'   Could you give a example?

Well, for vadd, as the example we have been using:

     tcg_gen_ld_i64(lo1, cpu_env, offsetof(vector_reg[A].lo));
     tcg_gen_ld_i64(lo2, cpu_env, offsetof(vector_reg[B].lo));
     tcg_gen_sari_i64(hi1, lo1, 63);
     tcg_gen_sari_i64(hi2, lo2, 63);
     tcg_gen_add2_i64(lo1, hi1, lo1, hi1, lo2, hi2);
     tcg_gen_st_i64(lo1, cpu_env, offsetof(vector_reg[R].lo));
     tcg_gen_st_i64(hi1, cpu_env, offsetof(vector_reg[R].hi));

The middle two sari operations replicate the sign bit across the entire high word, so the 
pair of variables constitute a sign-extended 128-bit value.

> I see a example at target/ppc/translate/vmx-impl.c.inc
>      static bool do_vx_vprtyb(DisasContext *ctx, arg_VX_tb *a, unsigned vece)
>      {
>              ...
>              {
>              .fno = gen_helper_VPRTYBQ,
>              .vece = MO_128
>              },
>              tcg_gen_gvec_2(avr_full_offset(a->vrt), avr_full_offset(a->vrb),
>                                 16, 16, &op[vece - MO_32]);
>          return true;
>      }
> TRANS(VPRTYBQ, do_vx_vprtyb, MO_128)
> ...
> 
> do_vx_vprtyb  fit the fno into the tcg_gen_gvec_2.
> I am not sure this  example is right.

Ah, well.  When .fno is the only callback, the implementation is entirely out-of-line, and 
the .vece member is not used.  I see that is confusing.


r~



  reply	other threads:[~2023-02-27 18:41 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-24  8:15 [RFC PATCH 00/43] Add LoongArch LSX instructions Song Gao
2022-12-24  8:15 ` [RFC PATCH 01/43] target/loongarch: Add vector data type vec_t Song Gao
2022-12-24 17:07   ` Richard Henderson
2022-12-24 17:24   ` Richard Henderson
2022-12-28  2:34     ` gaosong
2022-12-28 17:30       ` Richard Henderson
2022-12-29  1:51         ` gaosong
2022-12-29  3:13           ` Richard Henderson
2022-12-29  3:54             ` gaosong
2022-12-24 17:32   ` Richard Henderson
2023-02-13  8:24     ` gaosong
2023-02-13 19:18       ` Richard Henderson
2022-12-24  8:15 ` [RFC PATCH 02/43] target/loongarch: CPUCFG support LSX Song Gao
2022-12-24  8:15 ` [RFC PATCH 03/43] target/loongarch: meson.build support build LSX Song Gao
2022-12-24  8:15 ` [RFC PATCH 04/43] target/loongarch: Add CHECK_SXE maccro for check LSX enable Song Gao
2022-12-24  8:15 ` [RFC PATCH 05/43] target/loongarch: Implement vadd/vsub Song Gao
2022-12-24 17:16   ` Richard Henderson
2022-12-24  8:15 ` [RFC PATCH 06/43] target/loongarch: Implement vaddi/vsubi Song Gao
2022-12-24 17:27   ` Richard Henderson
2022-12-24  8:15 ` [RFC PATCH 07/43] target/loongarch: Implement vneg Song Gao
2022-12-24 17:29   ` Richard Henderson
2022-12-24  8:15 ` [RFC PATCH 08/43] target/loongarch: Implement vsadd/vssub Song Gao
2022-12-24 17:31   ` Richard Henderson
2022-12-24  8:15 ` [RFC PATCH 09/43] target/loongarch: Implement vhaddw/vhsubw Song Gao
2022-12-24 17:41   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 10/43] target/loongarch: Implement vaddw/vsubw Song Gao
2022-12-24 17:48   ` Richard Henderson
2023-02-20  7:47     ` gaosong
2023-02-20 17:21       ` Richard Henderson
2023-02-23  8:23         ` gaosong
2023-02-23 15:22           ` Richard Henderson
2023-02-24  7:24             ` gaosong
2023-02-24 19:24               ` Richard Henderson
2023-02-27  9:14                 ` gaosong
2023-02-27  9:20                   ` Richard Henderson
2023-02-27 12:54                     ` gaosong
2023-02-27 18:32                       ` Richard Henderson
2023-02-27 12:55                 ` gaosong
2023-02-27 18:40                   ` Richard Henderson [this message]
2023-02-28  3:30                     ` gaosong
2023-02-28 16:48                       ` Richard Henderson
2023-02-24 23:01               ` Richard Henderson
2023-02-28  7:44                 ` gaosong
2023-02-28 16:50                   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 11/43] target/loongarch: Implement vavg/vavgr Song Gao
2022-12-24 17:52   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 12/43] target/loongarch: Implement vabsd Song Gao
2022-12-24 17:55   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 13/43] target/loongarch: Implement vadda Song Gao
2022-12-24 17:56   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 14/43] target/loongarch: Implement vmax/vmin Song Gao
2022-12-24 18:01   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 15/43] target/loongarch: Implement vmul/vmuh/vmulw{ev/od} Song Gao
2022-12-24 18:07   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 16/43] target/loongarch: Implement vmadd/vmsub/vmaddw{ev/od} Song Gao
2022-12-24 18:09   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 17/43] target/loongarch: Implement vdiv/vmod Song Gao
2022-12-24  8:16 ` [RFC PATCH 18/43] target/loongarch: Implement vsat Song Gao
2022-12-24 18:13   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 19/43] target/loongarch: Implement vexth Song Gao
2022-12-24  8:16 ` [RFC PATCH 20/43] target/loongarch: Implement vsigncov Song Gao
2022-12-24 18:18   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 21/43] target/loongarch: Implement vmskltz/vmskgez/vmsknz Song Gao
2022-12-24 18:31   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 22/43] target/loongarch: Implement LSX logic instructions Song Gao
2022-12-24 18:34   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 23/43] target/loongarch: Implement vsll vsrl vsra vrotr Song Gao
2022-12-24 18:36   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 24/43] target/loongarch: Implement vsllwil vextl Song Gao
2022-12-24  8:16 ` [RFC PATCH 25/43] target/loongarch: Implement vsrlr vsrar Song Gao
2022-12-24  8:16 ` [RFC PATCH 26/43] target/loongarch: Implement vsrln vsran Song Gao
2022-12-24  8:16 ` [RFC PATCH 27/43] target/loongarch: Implement vsrlrn vsrarn Song Gao
2022-12-24  8:16 ` [RFC PATCH 28/43] target/loongarch: Implement vssrln vssran Song Gao
2022-12-24  8:16 ` [RFC PATCH 29/43] target/loongarch: Implement vssrlrn vssrarn Song Gao
2022-12-24  8:16 ` [RFC PATCH 30/43] target/loongarch: Implement vclo vclz Song Gao
2022-12-24  8:16 ` [RFC PATCH 31/43] target/loongarch: Implement vpcnt Song Gao
2022-12-24  8:16 ` [RFC PATCH 32/43] target/loongarch: Implement vbitclr vbitset vbitrev Song Gao
2022-12-24  8:16 ` [RFC PATCH 33/43] target/loongarch: Implement vfrstp Song Gao
2022-12-24  8:16 ` [RFC PATCH 34/43] target/loongarch: Implement LSX fpu arith instructions Song Gao
2022-12-24  8:16 ` [RFC PATCH 35/43] target/loongarch: Implement LSX fpu fcvt instructions Song Gao
2022-12-24  8:16 ` [RFC PATCH 36/43] target/loongarch: Implement vseq vsle vslt Song Gao
2022-12-24 18:50   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 37/43] target/loongarch: Implement vfcmp Song Gao
2022-12-24  8:16 ` [RFC PATCH 38/43] target/loongarch: Implement vbitsel vset Song Gao
2022-12-24 19:15   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 39/43] target/loongarch: Implement vinsgr2vr vpickve2gr vreplgr2vr Song Gao
2022-12-24 20:34   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 40/43] target/loongarch: Implement vreplve vpack vpick Song Gao
2022-12-24 21:12   ` Richard Henderson
2023-03-21 11:31     ` gaosong
2023-03-21 15:55       ` Richard Henderson
2023-03-22  8:32         ` gaosong
2023-03-22 12:35           ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 41/43] target/loongarch: Implement vilvl vilvh vextrins vshuf Song Gao
2022-12-24  8:16 ` [RFC PATCH 42/43] target/loongarch: Implement vld vst Song Gao
2022-12-24 21:15   ` Richard Henderson
2022-12-24  8:16 ` [RFC PATCH 43/43] target/loongarch: Implement vldi Song Gao
2022-12-24 21:18   ` Richard Henderson
2022-12-24 15:39 ` [RFC PATCH 00/43] Add LoongArch LSX instructions Richard Henderson
2022-12-28  0:55   ` gaosong

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=5b3120cd-ddfb-770b-3216-0f02e89c9c24@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=gaosong@loongson.cn \
    --cc=qemu-devel@nongnu.org \
    /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).