mbox series

[00/11] Lower TCG vector ops to LSX

Message ID 20230828152009.352048-1-c@jia.je (mailing list archive)
Headers show
Series Lower TCG vector ops to LSX | expand

Message

Jiajie Chen Aug. 28, 2023, 3:19 p.m. UTC
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

Comments

Richard Henderson Aug. 28, 2023, 5:29 p.m. UTC | #1
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~
Richard Henderson Aug. 28, 2023, 7:39 p.m. UTC | #2
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~