Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-31 Thread Jiajie Chen
On 2023/10/31 19:06, gaosong wrote: 在 2023/10/31 下午5:13, Jiajie Chen 写道: On 2023/10/31 17:11, gaosong wrote: 在 2023/10/30 下午7:54, Jiajie Chen 写道: On 2023/10/30 16:23, gaosong wrote: 在 2023/10/28 下午9:09, Jiajie Chen 写道: On 2023/10/26 14:54, gaosong wrote: 在 2023/10/26 上午9:38, Jiajie

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-31 Thread Jiajie Chen
On 2023/10/31 17:11, gaosong wrote: 在 2023/10/30 下午7:54, Jiajie Chen 写道: On 2023/10/30 16:23, gaosong wrote: 在 2023/10/28 下午9:09, Jiajie Chen 写道: On 2023/10/26 14:54, gaosong wrote: 在 2023/10/26 上午9:38, Jiajie Chen 写道: On 2023/10/26 03:04, Richard Henderson wrote: On 10/25/23 10:13

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-30 Thread Jiajie Chen
On 2023/10/30 16:23, gaosong wrote: 在 2023/10/28 下午9:09, Jiajie Chen 写道: On 2023/10/26 14:54, gaosong wrote: 在 2023/10/26 上午9:38, Jiajie Chen 写道: On 2023/10/26 03:04, Richard Henderson wrote: On 10/25/23 10:13, Jiajie Chen wrote: On 2023/10/24 07:26, Richard Henderson wrote: See target

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-28 Thread Jiajie Chen
On 2023/10/26 14:54, gaosong wrote: 在 2023/10/26 上午9:38, Jiajie Chen 写道: On 2023/10/26 03:04, Richard Henderson wrote: On 10/25/23 10:13, Jiajie Chen wrote: On 2023/10/24 07:26, Richard Henderson wrote: See target/arm/tcg/translate-a64.c, gen_store_exclusive, TCGv_i128 block. See target

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-25 Thread Jiajie Chen
On 2023/10/26 03:04, Richard Henderson wrote: On 10/25/23 10:13, Jiajie Chen wrote: On 2023/10/24 07:26, Richard Henderson wrote: See target/arm/tcg/translate-a64.c, gen_store_exclusive, TCGv_i128 block. See target/ppc/translate.c, gen_stqcx_. The situation here is slightly different

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-25 Thread Jiajie Chen
On 2023/10/24 14:10, Jiajie Chen wrote: On 2023/10/24 07:26, Richard Henderson wrote: On 10/23/23 08:29, Jiajie Chen wrote: This patch series implements the new instructions except sc.q, because I do not know how to match a pair of ll.d to sc.q. There are a couple of examples within the

Re: [PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-23 Thread Jiajie Chen
On 2023/10/24 07:26, Richard Henderson wrote: On 10/23/23 08:29, Jiajie Chen wrote: This patch series implements the new instructions except sc.q, because I do not know how to match a pair of ll.d to sc.q. There are a couple of examples within the tree. See target/arm/tcg/translate-a64.c

Re: [PATCH 1/5] include/exec/memop.h: Add MO_TESB

2023-10-23 Thread Jiajie Chen
On 2023/10/23 23:49, David Hildenbrand wrote: Why? On 23.10.23 17:29, Jiajie Chen wrote: Signed-off-by: Jiajie Chen ---   include/exec/memop.h | 1 +   1 file changed, 1 insertion(+) diff --git a/include/exec/memop.h b/include/exec/memop.h index a86dc6743a..834327c62d 100644 --- a/include

Re: [PATCH 3/5] target/loongarch: Add amcas[_db].{b/h/w/d}

2023-10-23 Thread Jiajie Chen
On 2023/10/23 23:29, Jiajie Chen wrote: The new instructions are introduced in LoongArch v1.1: - amcas.b - amcas.h - amcas.w - amcas.d - amcas_db.b - amcas_db.h - amcas_db.w - amcas_db.d The new instructions are gated by CPUCFG2.LAMCAS. Signed-off-by: Jiajie Chen --- target/loongarch

[PATCH 4/5] target/loongarch: Add estimated reciprocal instructions

2023-10-23 Thread Jiajie Chen
improve performance by reducing precision, we use the existing softfloat implementation. Signed-off-by: Jiajie Chen --- target/loongarch/cpu.h | 1 + target/loongarch/disas.c | 12 target/loongarch/insn_trans/trans_farith.c.inc | 4

[PATCH 3/5] target/loongarch: Add amcas[_db].{b/h/w/d}

2023-10-23 Thread Jiajie Chen
The new instructions are introduced in LoongArch v1.1: - amcas.b - amcas.h - amcas.w - amcas.d - amcas_db.b - amcas_db.h - amcas_db.w - amcas_db.d The new instructions are gated by CPUCFG2.LAMCAS. Signed-off-by: Jiajie Chen --- target/loongarch/cpu.h| 1 + target

[PATCH 0/5] Add LoongArch v1.1 instructions

2023-10-23 Thread Jiajie Chen
cessor. This patch series implements the new instructions except sc.q, because I do not know how to match a pair of ll.d to sc.q. Jiajie Chen (5): include/exec/memop.h: Add MO_TESB target/loongarch: Add am{swap/add}[_db].{b/h} target/loongarch: Add amcas[_db].{b/h/w/d} target/loongarc

[PATCH 1/5] include/exec/memop.h: Add MO_TESB

2023-10-23 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- include/exec/memop.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/exec/memop.h b/include/exec/memop.h index a86dc6743a..834327c62d 100644 --- a/include/exec/memop.h +++ b/include/exec/memop.h @@ -140,6 +140,7 @@ typedef enum MemOp { MO_TEUL

[PATCH 2/5] target/loongarch: Add am{swap/add}[_db].{b/h}

2023-10-23 Thread Jiajie Chen
The new instructions are introduced in LoongArch v1.1: - amswap.b - amswap.h - amadd.b - amadd.h - amswap_db.b - amswap_db.h - amadd_db.b - amadd_db.h The instructions are gated by CPUCFG2.LAM_BH. Signed-off-by: Jiajie Chen --- target/loongarch/cpu.h | 1 + target

[PATCH 5/5] target/loongarch: Add llacq/screl instructions

2023-10-23 Thread Jiajie Chen
Add the following instructions in LoongArch v1.1: - llacq.w - screl.w - llacq.d - screl.d They are guarded by CPUCFG2.LLACQ_SCREL. Signed-off-by: Jiajie Chen --- target/loongarch/cpu.h| 1 + target/loongarch/disas.c | 4 .../loongarch

[PATCH] linux-user/elfload: Enable LSX/LASX in HWCAP for LoongArch

2023-10-01 Thread Jiajie Chen
Since support for LSX and LASX is landed in QEMU recently, we can update HWCAPS accordingly. Signed-off-by: Jiajie Chen --- linux-user/elfload.c | 8 1 file changed, 8 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index db75cd4b33..f11f25309e 100644 --- a

Re: [PATCH 4/7] tcg/loongarch64: Use cpuinfo.h

2023-09-30 Thread Jiajie Chen
(use_lsx_instructions) { +if (cpuinfo & CPUINFO_LSX) { tcg_target_available_regs[TCG_TYPE_V128] = ALL_VECTOR_REGS; tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V24); tcg_regset_reset_reg(tcg_target_call_clobber_regs, TCG_REG_V25); Reviewed-by: Jiajie Chen

Re: [PATCH 2/7] tcg/loongarch64: Use C_N2_I1 for INDEX_op_qemu_ld_a*_i128

2023-09-30 Thread Jiajie Chen
d_a64_i128: -return C_O2_I1(r, r, r); +return C_N2_I1(r, r, r); case INDEX_op_qemu_st_a32_i128: case INDEX_op_qemu_st_a64_i128: Reviewed-by: Jiajie Chen

Re: [PATCH 3/7] util: Add cpuinfo for loongarch64

2023-09-30 Thread Jiajie Chen
.add(files('cpuinfo-i386.c')) +elif cpu == 'loongarch64' + util_ss.add(files('cpuinfo-loongarch.c')) elif cpu in ['ppc', 'ppc64'] util_ss.add(files('cpuinfo-ppc.c')) endif Reviewed-by: Jiajie Chen

Re: [PATCH 1/7] tcg: Add C_N2_I1

2023-09-30 Thread Jiajie Chen
1, O2, I1, I2) C_PFX4(c_o2_i2_, O1, O2, I1, I2) Reviewed-by: Jiajie Chen

[PATCH] target/loongarch: fix ASXE flag conflict

2023-09-30 Thread Jiajie Chen
HW_FLAGS_EUEN_ASXE acccidentally conflicts with HW_FLAGS_CRMD_PG, enabling LASX instructions even when CSR_EUEN.ASXE=0. Closes: https://gitlab.com/qemu-project/qemu/-/issues/1907 Signed-off-by: Jiajie Chen --- target/loongarch/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH v4 02/16] tcg/loongarch64: Lower basic tcg vec ops to LSX

2023-09-07 Thread Jiajie Chen
LSX support on host cpu is detected via hwcap. Lower the following ops to LSX: - dup_vec - dupi_vec - dupm_vec - ld_vec - st_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 2 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg

[PATCH v4 10/16] tcg/loongarch64: Lower vector saturated ops

2023-09-07 Thread Jiajie Chen
Lower the following ops: - ssadd_vec - usadd_vec - sssub_vec - ussub_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1

[PATCH v4 12/16] tcg/loongarch64: Lower bitsel_vec to vbitsel

2023-09-07 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 11 ++- tcg/loongarch64/tcg-target.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tcg/loongarch64/tcg

[PATCH v4 03/16] tcg: pass vece to tcg_target_const_match()

2023-09-07 Thread Jiajie Chen
Pass vece to tcg_target_const_match() to allow correct interpretation of const args of vector ops. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/aarch64/tcg-target.c.inc | 2 +- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc| 2 +- tcg

[PATCH v4 15/16] tcg/loongarch64: Lower rotli_vec to vrotri

2023-09-07 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc

[PATCH v4 13/16] tcg/loongarch64: Lower vector shift integer ops

2023-09-07 Thread Jiajie Chen
Lower the following ops: - shli_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH v4 04/16] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-07 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 65 3 files changed, 67 insertions(+) diff --git a/tcg/loongarch64/tcg

[PATCH v4 08/16] tcg/loongarch64: Lower mul_vec to vmul

2023-09-07 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

[PATCH v4 06/16] tcg/loongarch64: Lower vector bitwise operations

2023-09-07 Thread Jiajie Chen
Lower the following ops: - and_vec - andc_vec - or_vec - orc_vec - xor_vec - nor_vec - not_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 2 ++ tcg/loongarch64/tcg-target.c.inc | 44 tcg/loongarch64

[PATCH v4 11/16] tcg/loongarch64: Lower vector shift vector ops

2023-09-07 Thread Jiajie Chen
Lower the following ops: - shlv_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 24 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH v4 00/16] Lower TCG vector ops to LSX

2023-09-07 Thread Jiajie Chen
_vec/st_vec/ld_vec/cmp_vec/add_vec/sub_vec generation - Lower not_vec/shi_vec/roti_vec/rotv_vec Jiajie Chen (16): tcg/loongarch64: Import LSX instructions tcg/loongarch64: Lower basic tcg vec ops to LSX tcg: pass vece to tcg_target_const_match() tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

[PATCH v4 14/16] tcg/loongarch64: Lower rotv_vec ops to LSX

2023-09-07 Thread Jiajie Chen
Lower the following ops: - rotrv_vec - rotlv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 14 ++ tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg

[PATCH v4 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-07 Thread Jiajie Chen
If LSX is available, use LSX instructions to implement 128-bit load & store when MO_128 is required, otherwise use two 64-bit loads & stores. Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 + tcg/loongarch64/tcg-target.c.inc | 59 +

[PATCH v4 09/16] tcg/loongarch64: Lower vector min max ops

2023-09-07 Thread Jiajie Chen
Lower the following ops: - smin_vec - smax_vec - umin_vec - umax_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion

[PATCH v4 05/16] tcg/loongarch64: Lower add/sub_vec to vadd/vsub

2023-09-07 Thread Jiajie Chen
Lower the following ops: - add_vec - sub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 61 3 files changed, 63 insertions(+) diff --git a/tcg

[PATCH v4 07/16] tcg/loongarch64: Lower neg_vec to vneg

2023-09-07 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

Re: [PATCH v3 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-02 Thread Jiajie Chen
On 2023/9/3 09:06, Richard Henderson wrote: On 9/1/23 22:02, Jiajie Chen wrote: If LSX is available, use LSX instructions to implement 128-bit load & store. Is this really guaranteed to be an atomic 128-bit operation? Song Gao, please check this. Or, as for many vector processors

[PATCH v3 08/16] tcg/loongarch64: Lower mul_vec to vmul

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

[PATCH v3 10/16] tcg/loongarch64: Lower vector saturated ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - ssadd_vec - usadd_vec - sssub_vec - ussub_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1

[PATCH v3 05/16] tcg/loongarch64: Lower add/sub_vec to vadd/vsub

2023-09-01 Thread Jiajie Chen
Lower the following ops: - add_vec - sub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 60 3 files changed, 62 insertions(+) diff --git a/tcg

[PATCH v3 07/16] tcg/loongarch64: Lower neg_vec to vneg

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

[PATCH v3 14/16] tcg/loongarch64: Lower rotv_vec ops to LSX

2023-09-01 Thread Jiajie Chen
Lower the following ops: - rotrv_vec - rotlv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 14 ++ tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg

[PATCH v3 02/16] tcg/loongarch64: Lower basic tcg vec ops to LSX

2023-09-01 Thread Jiajie Chen
LSX support on host cpu is detected via hwcap. Lower the following ops to LSX: - dup_vec - dupi_vec - dupm_vec - ld_vec - st_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 2 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg

[PATCH v3 06/16] tcg/loongarch64: Lower vector bitwise operations

2023-09-01 Thread Jiajie Chen
Lower the following ops: - and_vec - andc_vec - or_vec - orc_vec - xor_vec - nor_vec - not_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 2 ++ tcg/loongarch64/tcg-target.c.inc | 44 tcg/loongarch64

[PATCH v3 13/16] tcg/loongarch64: Lower vector shift integer ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - shli_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH v3 16/16] tcg/loongarch64: Implement 128-bit load & store

2023-09-01 Thread Jiajie Chen
If LSX is available, use LSX instructions to implement 128-bit load & store. Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 ++ tcg/loongarch64/tcg-target.c.inc | 42 tcg/loongarch64/tcg-target.h | 2 +- 3 files changed

[PATCH v3 12/16] tcg/loongarch64: Lower bitsel_vec to vbitsel

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 11 ++- tcg/loongarch64/tcg-target.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tcg/loongarch64/tcg

[PATCH v3 11/16] tcg/loongarch64: Lower vector shift vector ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - shlv_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 24 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH v3 04/16] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc | 65 3 files changed, 67 insertions(+) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64

[PATCH v3 09/16] tcg/loongarch64: Lower vector min max ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - smin_vec - smax_vec - umin_vec - umax_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion

[PATCH v3 15/16] tcg/loongarch64: Lower rotli_vec to vrotri

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc

[PATCH v3 00/16] Lower TCG vector ops to LSX

2023-09-01 Thread Jiajie Chen
/add_vec/sub_vec for better const arg handling - Implement 128-bit load & store using vldx/vstx Changes since v1: - Optimize dupi_vec/st_vec/ld_vec/cmp_vec/add_vec/sub_vec generation - Lower not_vec/shi_vec/roti_vec/rotv_vec Jiajie Chen (16): tcg/loongarch64: Import LSX instructions

[PATCH v3 03/16] tcg: pass vece to tcg_target_const_match()

2023-09-01 Thread Jiajie Chen
Pass vece to tcg_target_const_match() to allow correct interpretation of const args of vector ops. Signed-off-by: Jiajie Chen --- tcg/aarch64/tcg-target.c.inc | 2 +- tcg/arm/tcg-target.c.inc | 2 +- tcg/i386/tcg-target.c.inc| 2 +- tcg/loongarch64/tcg-target.c.inc | 2

Re: [PATCH v2 03/14] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-01 Thread Jiajie Chen
On 2023/9/2 01:48, Richard Henderson wrote: On 9/1/23 10:28, Jiajie Chen wrote: On 2023/9/2 01:24, Richard Henderson wrote: On 9/1/23 02:30, Jiajie Chen wrote: Signed-off-by: Jiajie Chen ---   tcg/loongarch64/tcg-target-con-set.h |  1 +   tcg/loongarch64/tcg-target.c.inc | 60

Re: [PATCH v2 03/14] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-01 Thread Jiajie Chen
On 2023/9/2 01:24, Richard Henderson wrote: On 9/1/23 02:30, Jiajie Chen wrote: Signed-off-by: Jiajie Chen ---   tcg/loongarch64/tcg-target-con-set.h |  1 +   tcg/loongarch64/tcg-target.c.inc | 60   2 files changed, 61 insertions(+) Reviewed-by: Richard

[PATCH v2 05/14] tcg/loongarch64: Lower vector bitwise operations

2023-09-01 Thread Jiajie Chen
Lower the following ops: - and_vec - andc_vec - or_vec - orc_vec - xor_vec - nor_vec - not_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 ++ tcg/loongarch64/tcg-target.c.inc | 44 tcg/loongarch64/tcg-target.h | 8 ++--- 3

[PATCH v2 02/14] tcg/loongarch64: Lower basic tcg vec ops to LSX

2023-09-01 Thread Jiajie Chen
LSX support on host cpu is detected via hwcap. Lower the following ops to LSX: - dup_vec - dupi_vec - dupm_vec - ld_vec - st_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc

[PATCH v2 08/14] tcg/loongarch64: Lower vector min max ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - smin_vec - smax_vec - umin_vec - umax_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion

[PATCH v2 04/14] tcg/loongarch64: Lower add/sub_vec to vadd/vsub

2023-09-01 Thread Jiajie Chen
Lower the following ops: - add_vec - sub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 58 2 files changed, 59 insertions(+) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg

[PATCH v2 07/14] tcg/loongarch64: Lower mul_vec to vmul

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

[PATCH v2 10/14] tcg/loongarch64: Lower vector shift vector ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - shlv_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 24 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH v2 00/14] Lower TCG vector ops to LSX

2023-09-01 Thread Jiajie Chen
Jiajie Chen (14): tcg/loongarch64: Import LSX instructions tcg/loongarch64: Lower basic tcg vec ops to LSX tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt tcg/loongarch64: Lower add/sub_vec to vadd/vsub tcg/loongarch64: Lower vector bitwise operations tcg/loongarch64: Lower neg_vec to

[PATCH v2 06/14] tcg/loongarch64: Lower neg_vec to vneg

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index

[PATCH v2 09/14] tcg/loongarch64: Lower vector saturated ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - ssadd_vec - usadd_vec - sssub_vec - ussub_vec Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1

[PATCH v2 13/14] tcg/loongarch64: Lower rotv_vec ops to LSX

2023-09-01 Thread Jiajie Chen
Lower the following ops: - rotrv_vec - rotlv_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 14 ++ tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg

[PATCH v2 14/14] tcg/loongarch64: Lower rotli_vec to vrotri

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 6fe319a77e..c4e9e0309e

[PATCH v2 11/14] tcg/loongarch64: Lower bitsel_vec to vbitsel

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 11 ++- tcg/loongarch64/tcg-target.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tcg/loongarch64/tcg

[PATCH v2 12/14] tcg/loongarch64: Lower vector shift integer ops

2023-09-01 Thread Jiajie Chen
Lower the following ops: - shli_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 21 + tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg

[PATCH v2 03/14] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-09-01 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 60 2 files changed, 61 insertions(+) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64/tcg-target-con-set.h index 37b3f80bf9

Re: [PATCH 02/11] tcg/loongarch64: Lower basic tcg vec ops to LSX

2023-08-28 Thread Jiajie Chen
There seems to some problem with the email server, try my another email address to send this email. On 2023/8/29 00:57, Richard Henderson wrote: On 8/28/23 08:19, Jiajie Chen wrote: +static void tcg_out_dupi_vec(TCGContext *s, TCGType type, unsigned vece

[PATCH 05/11] tcg/loongarch64: Lower vector bitwise operations

2023-08-28 Thread Jiajie Chen
Lower the following ops: - and_vec - andc_vec - or_vec - orc_vec - xor_vec - nor_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 35 tcg/loongarch64/tcg-target.h | 6 +++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff

[PATCH 09/11] tcg/loongarch64: Lower vector saturated ops

2023-08-28 Thread Jiajie Chen
Lower the following ops: - ssadd_vec - usadd_vec - sssub_vec - ussub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/tcg

[PATCH 06/11] tcg/loongarch64: Lower neg_vec to vneg

2023-08-28 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 10 ++ tcg/loongarch64/tcg-target.h | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64

[PATCH 10/11] tcg/loongarch64: Lower vector shift vector ops

2023-08-28 Thread Jiajie Chen
Lower the following ops: - shlv_vec - shrv_vec - sarv_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 24 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b

[PATCH 02/11] tcg/loongarch64: Lower basic tcg vec ops to LSX

2023-08-28 Thread Jiajie Chen
LSX support on host cpu is detected via hwcap. Lower the following ops to LSX: - dup_vec - dupi_vec - dupm_vec - ld_vec - st_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 2 + tcg/loongarch64/tcg-target-con-str.h | 1 + tcg/loongarch64/tcg-target.c.inc

[PATCH 11/11] tcg/loongarch64: Lower bitsel_vec to vbitsel

2023-08-28 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 11 ++- tcg/loongarch64/tcg-target.h | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64

[PATCH 08/11] tcg/loongarch64: Lower vector min max ops

2023-08-28 Thread Jiajie Chen
Lower the following ops: - smin_vec - smax_vec - umin_vec - umax_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 32 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64

[PATCH 03/11] tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt

2023-08-28 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target-con-set.h | 1 + tcg/loongarch64/tcg-target.c.inc | 25 + 2 files changed, 26 insertions(+) diff --git a/tcg/loongarch64/tcg-target-con-set.h b/tcg/loongarch64/tcg-target-con-set.h index 37b3f80bf9

[PATCH 07/11] tcg/loongarch64: Lower mul_vec to vmul

2023-08-28 Thread Jiajie Chen
Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 8 tcg/loongarch64/tcg-target.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index 819dcdba77..bca24b6a20 100644 --- a/tcg

[PATCH 00/11] Lower TCG vector ops to LSX

2023-08-28 Thread Jiajie Chen
This patch series allows qemu to utilize LSX instructions on LoongArch machines to execute TCG vector ops. Jiajie Chen (11): tcg/loongarch64: Import LSX instructions tcg/loongarch64: Lower basic tcg vec ops to LSX tcg/loongarch64: Lower cmp_vec to vseq/vsle/vslt tcg/loongarch64: Lower add

[PATCH 04/11] tcg/loongarch64: Lower add/sub_vec to vadd/vsub

2023-08-28 Thread Jiajie Chen
Lower the following ops: - add_vec - sub_vec Signed-off-by: Jiajie Chen --- tcg/loongarch64/tcg-target.c.inc | 16 1 file changed, 16 insertions(+) diff --git a/tcg/loongarch64/tcg-target.c.inc b/tcg/loongarch64/tcg-target.c.inc index cc80e5fa20..eb340a6493 100644 --- a/tcg

Re: [PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread Jiajie Chen
adhere to the same logical id mapping. Can pptt table parse error be fixed if cpu dsdt table is added? Regards Bibo Mao 在 2023/8/20 18:56, Jiajie Chen 写道: In hw/acpi/aml-build.c:build_pptt() function, the code assumes that the ACPI processor id equals to the cpu index, for example if we have

[PATCH] hw/loongarch: Fix ACPI processor id off-by-one error

2023-08-20 Thread Jiajie Chen
;-smp 8,sockets=1,cores=4,threads=2" is passed: Thread(s) per core: 2 Core(s) per socket: 2 Socket(s): 2 The detection of number of sockets is still wrong, but that is out of scope of the commit. Signed-off-by: Jiajie Chen --- hw/loongarch/acpi-build.c | 2 +- 1 file changed, 1

Re: [PATCH] roms: Support compile the efi bios for loongarch

2023-08-10 Thread Jiajie Chen
On 2023/8/10 15:42, xianglai li wrote: 1.Add edk2-platform submodule 2.Added loongarch UEFI BIOS support to compiled scripts. 3.The cross-compilation toolchain on x86 can be obtained from the link below: https://github.com/loongson/build-tools/tree/2022.09.06 Cc: Paolo Bonzini Cc: "Marc-André L

[PATCH v5 09/11] target/loongarch: Truncate high 32 bits of address in VA32 mode

2023-08-09 Thread Jiajie Chen
When running in VA32 mode(!LA64 or VA32L[1-3] matching PLV), virtual address is truncated to 32 bits before address mapping. Signed-off-by: Jiajie Chen Co-authored-by: Richard Henderson --- target/loongarch/cpu.c| 16 target/loongarch/cpu.h

[PATCH v5 10/11] target/loongarch: Sign extend results in VA32 mode

2023-08-09 Thread Jiajie Chen
In VA32 mode, BL, JIRL and PC* instructions should sign-extend the low 32 bit result to 64 bits. Signed-off-by: Jiajie Chen --- target/loongarch/insn_trans/trans_arith.c.inc | 2 +- target/loongarch/insn_trans/trans_branch.c.inc | 4 ++-- target/loongarch/translate.c | 8

[PATCH v5 04/11] target/loongarch: Support LoongArch32 TLB entry

2023-08-09 Thread Jiajie Chen
The TLB entry of LA32 lacks NR, NX and RPLV and they are hardwired to zero in LoongArch32. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- target/loongarch/cpu-csr.h| 9 + target/loongarch/tlb_helper.c | 17 - 2 files changed, 17 insertions(+), 9

[PATCH v5 07/11] target/loongarch: Add LA64 & VA32 to DisasContext

2023-08-09 Thread Jiajie Chen
Add LA64 and VA32(32-bit Virtual Address) to DisasContext to allow the translator to reject doubleword instructions in LA32 mode for example. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- target/loongarch/cpu.h | 13 + target/loongarch/translate.c | 3

[PATCH v5 11/11] target/loongarch: Add loongarch32 cpu la132

2023-08-09 Thread Jiajie Chen
Add la132 as a loongarch32 cpu type and allow virt machine to be used with la132 instead of la464. Due to lack of public documentation of la132, it is currently a synthetic loongarch32 cpu model. Details need to be added in the future. Signed-off-by: Jiajie Chen --- hw/loongarch/virt.c| 5

[PATCH v5 06/11] target/loongarch: Support LoongArch32 VPPN

2023-08-09 Thread Jiajie Chen
VPPN of TLBEHI/TLBREHI is limited to 19 bits in LA32. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- target/loongarch/cpu-csr.h| 6 -- target/loongarch/tlb_helper.c | 23 ++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/target

[PATCH v5 05/11] target/loongarch: Support LoongArch32 DMW

2023-08-09 Thread Jiajie Chen
LA32 uses a different encoding for CSR.DMW and a new direct mapping mechanism. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- target/loongarch/cpu-csr.h| 7 +++ target/loongarch/tlb_helper.c | 26 +++--- 2 files changed, 26 insertions(+), 7 deletions

[PATCH v5 03/11] target/loongarch: Add GDB support for loongarch32 mode

2023-08-09 Thread Jiajie Chen
GPRs and PC are 32-bit wide in loongarch32 mode. Signed-off-by: Jiajie Chen Reviewed-by: Richard Henderson --- configs/targets/loongarch64-softmmu.mak | 2 +- gdb-xml/loongarch-base32.xml| 45 + target/loongarch/cpu.c | 10 +- target

[PATCH v5 02/11] target/loongarch: Add new object class for loongarch32 cpus

2023-08-09 Thread Jiajie Chen
Add object class for future loongarch32 cpus. It is derived from the loongarch64 object class. Signed-off-by: Jiajie Chen --- target/loongarch/cpu.c | 19 +++ target/loongarch/cpu.h | 1 + 2 files changed, 20 insertions(+) diff --git a/target/loongarch/cpu.c b/target/loongarch

[PATCH v5 08/11] target/loongarch: Reject la64-only instructions in la32 mode

2023-08-09 Thread Jiajie Chen
LoongArch64-only instructions are marked with regard to the instruction manual Table 2. LSX instructions are not marked for now for lack of public manual. Signed-off-by: Jiajie Chen --- target/loongarch/insn_trans/trans_arith.c.inc | 30 .../loongarch/insn_trans/trans_atomic.c.inc

[PATCH v5 00/11] Add la32 & va32 support for loongarch64-softmmu

2023-08-09 Thread Jiajie Chen
create a separate qemu-system-loongarch32 executable, but allow user to run loongarch32 emulation using qemu-system-loongarch64 - Add loongarch32 cpu support for virt machine Full changes: Jiajie Chen (11): target/loongarch: Add function to check current arch target/loongarch: Add new object

[PATCH v5 01/11] target/loongarch: Add function to check current arch

2023-08-09 Thread Jiajie Chen
Add is_la64 function to check if the current cpucfg[1].arch equals to 2(LA64). Signed-off-by: Jiajie Chen Co-authored-by: Richard Henderson Reviewed-by: Richard Henderson --- target/loongarch/cpu.h | 10 ++ 1 file changed, 10 insertions(+) diff --git a/target/loongarch/cpu.h b/target

Re: [PATCH v4 11/11] target/loongarch: Add loongarch32 cpu la132

2023-08-09 Thread Jiajie Chen
On 2023/8/9 03:26, Richard Henderson wrote: On 8/7/23 18:54, Jiajie Chen wrote: +static void loongarch_la464_initfn(Object *obj) +{ +    LoongArchCPU *cpu = LOONGARCH_CPU(obj); +    CPULoongArchState *env = &cpu->env; + +    loongarch_cpu_initfn_common(env); + +    cpu->dtb_

Re: [PATCH v4 01/11] target/loongarch: Add macro to check current arch

2023-08-08 Thread Jiajie Chen
On 2023/8/9 01:01, Richard Henderson wrote: On 8/7/23 18:54, Jiajie Chen wrote: Add macro to check if the current cpucfg[1].arch equals to 1(LA32) or 2(LA64). Signed-off-by: Jiajie Chen ---   target/loongarch/cpu.h | 7 +++   1 file changed, 7 insertions(+) diff --git a/target/loongarch

Re: [PATCH] target/loongarch: Split fcc register to fcc0-7 in gdbstub

2023-08-08 Thread Jiajie Chen
On 2023/8/8 17:55, Jiajie Chen wrote: On 2023/8/8 14:10, bibo mao wrote: I am not familiar with gdb, is there  abi breakage? I do not know how gdb client works with gdb server with different versions. There seemed no versioning in the process, but rather in-code xml validation. In gdb, the

  1   2   >