All of lore.kernel.org
 help / color / mirror / Atom feed
From: gaosong <gaosong@loongson.cn>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Xiaojuan Yang <yangxiaojuan@loongson.cn>,
	qemu-devel@nongnu.org, laurent@vivier.eu
Subject: Re: [PATCH v10 04/26] target/loongarch: Add fixed point arithmetic instruction translation
Date: Wed, 17 Nov 2021 17:29:51 +0800	[thread overview]
Message-ID: <a46e8df8-ccb9-52d0-2e73-33a49e92bfd8@loongson.cn> (raw)
In-Reply-To: <e26b8243-2797-cde9-3833-a7c4cd3b6a65@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 3392 bytes --]

Hi Richard,

On 2021/11/17 下午4:28, Richard Henderson wrote:
> On 11/17/21 8:57 AM, gaosong wrote:
>> I see that  insns.decode format is not very consistent with other 
>> architectures, such ARM/RISCV
>
> No.  I don't like how riscv has done it, though they have quite a few 
> split fields, so perhaps they thought it looked weird.
>
>
>> #
>> # Argument sets
>> #
>> &r_i          rd imm
>> &rrr          rd rj rk
>> &rr_i         rd rj imm
>> &rrr_sa     rd rj rk sa
>>
>> #
>> # Formats
>> #
>> @fmt_rrr             .... ........ ..... rk:5 rj:5 rd:5 &rrr
>> @fmt_r_i20                        .... ... imm:s20 rd:5 &r_i
>> @fmt_rr_i12               .... ...... imm:s12 rj:5 rd:5 &rr_i
>> @fmt_rr_ui12               .... ...... imm:12 rj:5 rd:5 &rr_i
>> @fmt_rr_i16                   .... .. imm:s16 rj:5 rd:5 &rr_i
>> @fmt_rrr_sa2p1      .... ........ ... .. rk:5 rj:5 rd:5 &rrr_sa  
>> sa=%sa2p1
>>
>> #
>> # Fixed point arithmetic operation instruction
>> #
>> add_w            0000 00000001 00000 ..... ..... ..... @fmt_rrr
>> add_d            0000 00000001 00001 ..... ..... ..... @fmt_rrr
>> sub_w            0000 00000001 00010 ..... ..... ..... @fmt_rrr
>> sub_d            0000 00000001 00011 ..... ..... ..... @fmt_rrr
>> slt              0000 00000001 00100 ..... ..... ..... @fmt_rrr
>> sltu             0000 00000001 00101 ..... ..... ..... @fmt_rrr
>> slti             0000 001000 ............ ..... .....               
>> @fmt_rr_i12
>>
>>
>> and trans_xxx.c.inc
>>
>> static bool gen_rrr(DisasContext *ctx, arg_rrr *a, ...) {}
>> static bool gen_rr_i12(DisasContext *ctx, arg_rr_i *a, ) {}
>
> gen_rr_i ?

The code is not written completely,  like this:

gen_rr_i12:

@fmt_rr_i12               .... ...... imm:s12 rj:5 rd:5 &rr_i
slti         0000 001000 ............ ..... .....     @fmt_rr_i12
sltui        0000 001001 ............ ..... .....     @fmt_rr_i12
...

gen_rr_ui12:

@fmt_rr_ui12               .... ...... imm:12 rj:5 rd:5 &rr_i
andi         0000 001101 ............ ..... .....     @fmt_rr_ui12
ori          0000 001110 ............ ..... .....     @fmt_rr_ui12
xori         0000 001111 ............ ..... .....     @fmt_rr_ui12
...

@fmt_rr_i12 and @fmt_rr_ui12 are two 'Formats',  but they use the same 'Argument sets'(rr_i).

>
>> static bool gen_rrr_sa2p1(DisasContext *ctx, arg_rrr_sa *a, ...) {}
>
> gen_rrr_sa ?
>
Likewise.

gen_rrr_sa2p1:

@fmt_rrr_sa2p1        .... ........ ... .. rk:5 rj:5 rd:5   &fmt_rr_sa  sa=%sa2p1
lsl_w           0000 00000000 010 .. ..... ..... .....    @fmt_rrr_sa2p1
alsl_wu          0000 00000000 011 .. ..... ..... .....   @fmt_rrr_sa2p1
alsl_d           0000 00000010 110 .. ..... ..... .....   @fmt_rrr_sa2p1
...

gen_rrr_sa2:
@fmt_rrr_sa2        .... ........ ... sa:2 rk:5 rj:5 rd:5   &fmt_rr_sa
bytepick_w       0000 00000000 100 .. ..... ..... .....   @fmt_rrr_sa3
...

gen_rrr_sa3:
@fmt_rrr_sa3         .... ........ .. sa:3 rk:5 rj:5 rd:5   &fmt_rr_sa
bytepick_d       0000 00000000 11 ... ..... ..... .....   @fmt_rrr_sa3
...

>> Richard, is that OK?
>
> Other than those two nits, this looks very clean.  Thanks,
>
OK, I'll correct it on v11.

Thanks.
Song Gao


[-- Attachment #2: Type: text/html, Size: 5096 bytes --]

  reply	other threads:[~2021-11-17  9:30 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-12  6:53 [PATCH v10 00/26] Add LoongArch linux-user emulation support Song Gao
2021-11-12  6:53 ` [PATCH v10 01/26] target/loongarch: Add README Song Gao
2021-11-12  6:53 ` [PATCH v10 02/26] target/loongarch: Add core definition Song Gao
2021-11-12  6:53 ` [PATCH v10 03/26] target/loongarch: Add main translation routines Song Gao
2021-11-12  6:53 ` [PATCH v10 04/26] target/loongarch: Add fixed point arithmetic instruction translation Song Gao
2021-11-12 14:05   ` Richard Henderson
2021-11-13  3:18     ` WANG Xuerui
2021-11-15  3:59     ` gaosong
2021-11-15  8:42       ` Richard Henderson
2021-11-17  7:57         ` gaosong
2021-11-17  8:28           ` Richard Henderson
2021-11-17  9:29             ` gaosong [this message]
2021-11-17  9:55               ` Richard Henderson
2021-11-18  1:24                 ` gaosong
2021-11-12  6:53 ` [PATCH v10 05/26] target/loongarch: Add fixed point shift " Song Gao
2021-11-12  6:53 ` [PATCH v10 06/26] target/loongarch: Add fixed point bit " Song Gao
2021-11-12  6:53 ` [PATCH v10 07/26] target/loongarch: Add fixed point load/store " Song Gao
2021-11-12  6:53 ` [PATCH v10 08/26] target/loongarch: Add fixed point atomic " Song Gao
2021-11-12  6:53 ` [PATCH v10 09/26] target/loongarch: Add fixed point extra " Song Gao
2021-11-12  6:53 ` [PATCH v10 10/26] target/loongarch: Add floating point arithmetic " Song Gao
2021-11-12  6:53 ` [PATCH v10 11/26] target/loongarch: Add floating point comparison " Song Gao
2021-11-12  6:53 ` [PATCH v10 12/26] target/loongarch: Add floating point conversion " Song Gao
2021-11-12  6:53 ` [PATCH v10 13/26] target/loongarch: Add floating point move " Song Gao
2021-11-12  6:53 ` [PATCH v10 14/26] target/loongarch: Add floating point load/store " Song Gao
2021-11-12  6:53 ` [PATCH v10 15/26] target/loongarch: Add branch " Song Gao
2021-11-12  6:53 ` [PATCH v10 16/26] target/loongarch: Add disassembler Song Gao
2021-11-12  7:39   ` Richard Henderson
2021-11-12  9:59     ` gaosong
2021-11-12  6:54 ` [PATCH v10 17/26] linux-user: Add LoongArch generic header files Song Gao
2021-11-16  8:33   ` Philippe Mathieu-Daudé
2021-11-16 11:50     ` gaosong
2021-11-12  6:54 ` [PATCH v10 18/26] linux-user: Add LoongArch specific structures Song Gao
2021-11-12  6:54 ` [PATCH v10 19/26] linux-user: Add LoongArch signal support Song Gao
2021-11-12  6:54 ` [PATCH v10 20/26] linux-user: Add LoongArch elf support Song Gao
2021-11-12  6:54 ` [PATCH v10 21/26] linux-user: Add LoongArch syscall support Song Gao
2021-11-12  6:54 ` [PATCH v10 22/26] linux-user: Add LoongArch cpu_loop support Song Gao
2021-11-12  6:54 ` [PATCH v10 23/26] default-configs: Add loongarch linux-user support Song Gao
2021-11-12  6:54 ` [PATCH v10 24/26] target/loongarch: Add target build suport Song Gao
2021-11-12  6:54 ` [PATCH v10 25/26] target/loongarch: 'make check-tcg' support Song Gao
2021-11-12  6:54 ` [PATCH v10 26/26] scripts: add loongarch64 binfmt config Song Gao

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=a46e8df8-ccb9-52d0-2e73-33a49e92bfd8@loongson.cn \
    --to=gaosong@loongson.cn \
    --cc=laurent@vivier.eu \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=yangxiaojuan@loongson.cn \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.