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

Jiajie Chen posted 11 patches 1 year, 3 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230828152009.352048-1-c@jia.je
Maintainers: WANG Xuerui <git@xen0n.name>, Richard Henderson <richard.henderson@linaro.org>
There is a newer version of this series
tcg/loongarch64/tcg-insn-defs.c.inc  | 6251 +++++++++++++++++++++++++-
tcg/loongarch64/tcg-target-con-set.h |    5 +
tcg/loongarch64/tcg-target-con-str.h |    1 +
tcg/loongarch64/tcg-target.c.inc     |  414 +-
tcg/loongarch64/tcg-target.h         |   37 +-
tcg/loongarch64/tcg-target.opc.h     |   12 +
6 files changed, 6601 insertions(+), 119 deletions(-)
create mode 100644 tcg/loongarch64/tcg-target.opc.h
[PATCH 00/11] Lower TCG vector ops to LSX
Posted by Jiajie Chen 1 year, 3 months ago
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/sub_vec to vadd/vsub
  tcg/loongarch64: Lower vector bitwise operations
  tcg/loongarch64: Lower neg_vec to vneg
  tcg/loongarch64: Lower mul_vec to vmul
  tcg/loongarch64: Lower vector min max ops
  tcg/loongarch64: Lower vector saturated ops
  tcg/loongarch64: Lower vector shift vector ops
  tcg/loongarch64: Lower bitsel_vec to vbitsel

 tcg/loongarch64/tcg-insn-defs.c.inc  | 6251 +++++++++++++++++++++++++-
 tcg/loongarch64/tcg-target-con-set.h |    5 +
 tcg/loongarch64/tcg-target-con-str.h |    1 +
 tcg/loongarch64/tcg-target.c.inc     |  414 +-
 tcg/loongarch64/tcg-target.h         |   37 +-
 tcg/loongarch64/tcg-target.opc.h     |   12 +
 6 files changed, 6601 insertions(+), 119 deletions(-)
 create mode 100644 tcg/loongarch64/tcg-target.opc.h

-- 
2.42.0
Re: [PATCH 00/11] Lower TCG vector ops to LSX
Posted by Richard Henderson 1 year, 3 months ago
On 8/28/23 08:19, Jiajie Chen wrote:
> 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/sub_vec to vadd/vsub
>    tcg/loongarch64: Lower vector bitwise operations
>    tcg/loongarch64: Lower neg_vec to vneg
>    tcg/loongarch64: Lower mul_vec to vmul
>    tcg/loongarch64: Lower vector min max ops
>    tcg/loongarch64: Lower vector saturated ops
>    tcg/loongarch64: Lower vector shift vector ops
>    tcg/loongarch64: Lower bitsel_vec to vbitsel
> 
>   tcg/loongarch64/tcg-insn-defs.c.inc  | 6251 +++++++++++++++++++++++++-
>   tcg/loongarch64/tcg-target-con-set.h |    5 +
>   tcg/loongarch64/tcg-target-con-str.h |    1 +
>   tcg/loongarch64/tcg-target.c.inc     |  414 +-
>   tcg/loongarch64/tcg-target.h         |   37 +-
>   tcg/loongarch64/tcg-target.opc.h     |   12 +
>   6 files changed, 6601 insertions(+), 119 deletions(-)
>   create mode 100644 tcg/loongarch64/tcg-target.opc.h

Looks very good at a first pass.

We should probably improve tcg_gen_not_vec to try NOR.  This would support loongarch64, 
and allow the special expansion in PPC and S390X to be removed.

It would be good to support TCG_TARGET_HAS_shi_vec using VSLLI/VSRLI/VSRAI.

It would be good to support TCG_TARGET_HAS_roti_vec and TCG_TARGET_HAS_rotv_vec.



r~
Re: [PATCH 00/11] Lower TCG vector ops to LSX
Posted by Richard Henderson 1 year, 3 months ago
On 8/28/23 10:29, Richard Henderson wrote:
> We should probably improve tcg_gen_not_vec to try NOR.  This would support loongarch64, 
> and allow the special expansion in PPC and S390X to be removed.

Hmm, no.  The tcg optimizer does better when NOT is supported directly.
There is a whole series of fold_*_to_not patterns.

It's what I get for looking at this for a long time.

Anyway, it would be good for LSX to expand NOT(x) via NOR(x,x).


r~