mbox series

[v2,0/8] Add Loongson SX/ASX instruction support to LoongArch target.

Message ID 20230718110625.88834-1-panchenghui@loongson.cn
Headers show
Series Add Loongson SX/ASX instruction support to LoongArch target. | expand

Message

Chenghui Pan July 18, 2023, 11:06 a.m. UTC
This is an update of https://gcc.gnu.org/pipermail/gcc-patches/2023-June/623262.html
In addition, LSX/LASX instructions support is added in the master branch of binutils-gdb,
and these GCC patches can be used with future releases of binutils-gdb.

Changes since v1:

- Some usages of "unspec" in lsx.md and lasx.md are replaced with arithmetic
  RTL expressions.
- Support ADDR_REG_REG in LSX and LASX.
- Constraint docs are appended in gcc/doc/md.texi and head comment block of
  gcc/config/loongarch/constraints.md.
- Codes related to vecarg in loongarch.cc and loongarch.opt.in are removed in v2.
- Testsuite of LSX and LASX is added in v2, and can be called by using
  loongarch-vector.exp independently.
- Adjust the loongarch_expand_vector_init() function to reduce instruction
  amount when initializing the vector with element-by-element style.
- Some minor implementation changes of RTL templates in lsx.md and lasx.md.

Lulu Cheng (8):
  LoongArch: Added Loongson SX vector directive compilation framework.
  LoongArch: Added Loongson SX base instruction support.
  LoongArch: Added Loongson SX directive builtin function support.
  LoongArch: Added Loongson ASX vector directive compilation framework.
  LoongArch: Added Loongson ASX base instruction support.
  LoongArch: Added Loongson ASX directive builtin function support.
  LoongArch: Add Loongson SX directive test cases.
  LoongArch: Add Loongson ASX directive test cases.

 gcc/config.gcc                                |     2 +-
 gcc/config/loongarch/constraints.md           |   131 +-
 .../loongarch/genopts/loongarch-strings       |     4 +
 gcc/config/loongarch/genopts/loongarch.opt.in |    12 +-
 gcc/config/loongarch/lasx.md                  |  5120 +++
 gcc/config/loongarch/lasxintrin.h             |  5342 +++
 gcc/config/loongarch/loongarch-builtins.cc    |  2686 +-
 gcc/config/loongarch/loongarch-c.cc           |    18 +
 gcc/config/loongarch/loongarch-def.c          |     6 +
 gcc/config/loongarch/loongarch-def.h          |     9 +-
 gcc/config/loongarch/loongarch-driver.cc      |    10 +
 gcc/config/loongarch/loongarch-driver.h       |     2 +
 gcc/config/loongarch/loongarch-ftypes.def     |   666 +-
 gcc/config/loongarch/loongarch-modes.def      |    39 +
 gcc/config/loongarch/loongarch-opts.cc        |    89 +-
 gcc/config/loongarch/loongarch-opts.h         |     3 +
 gcc/config/loongarch/loongarch-protos.h       |    35 +
 gcc/config/loongarch/loongarch-str.h          |     3 +
 gcc/config/loongarch/loongarch.cc             |  4669 +-
 gcc/config/loongarch/loongarch.h              |   117 +-
 gcc/config/loongarch/loongarch.md             |    56 +-
 gcc/config/loongarch/loongarch.opt            |    12 +-
 gcc/config/loongarch/lsx.md                   |  4479 ++
 gcc/config/loongarch/lsxintrin.h              |  5181 +++
 gcc/config/loongarch/predicates.md            |   333 +-
 gcc/doc/md.texi                               |    11 +
 .../gcc.target/loongarch/strict-align.c       |    13 +
 .../vector/lasx/lasx-bit-manipulate.c         | 27813 +++++++++++
 .../loongarch/vector/lasx/lasx-builtin.c      |  1509 +
 .../loongarch/vector/lasx/lasx-cmp.c          |  5361 +++
 .../loongarch/vector/lasx/lasx-fp-arith.c     |  6259 +++
 .../loongarch/vector/lasx/lasx-fp-cvt.c       |  7315 +++
 .../loongarch/vector/lasx/lasx-int-arith.c    | 38361 ++++++++++++++++
 .../loongarch/vector/lasx/lasx-mem.c          |   147 +
 .../loongarch/vector/lasx/lasx-perm.c         |  7730 ++++
 .../vector/lasx/lasx-str-manipulate.c         |   712 +
 .../loongarch/vector/lasx/lasx-xvldrepl.c     |    13 +
 .../loongarch/vector/lasx/lasx-xvstelm.c      |    12 +
 .../loongarch/vector/loongarch-vector.exp     |    42 +
 .../loongarch/vector/lsx/lsx-bit-manipulate.c | 15586 +++++++
 .../loongarch/vector/lsx/lsx-builtin.c        |  1461 +
 .../gcc.target/loongarch/vector/lsx/lsx-cmp.c |  3354 ++
 .../loongarch/vector/lsx/lsx-fp-arith.c       |  3713 ++
 .../loongarch/vector/lsx/lsx-fp-cvt.c         |  4114 ++
 .../loongarch/vector/lsx/lsx-int-arith.c      | 22424 +++++++++
 .../gcc.target/loongarch/vector/lsx/lsx-mem.c |   537 +
 .../loongarch/vector/lsx/lsx-perm.c           |  5555 +++
 .../loongarch/vector/lsx/lsx-str-manipulate.c |   408 +
 .../loongarch/vector/simd_correctness_check.h |    39 +
 49 files changed, 181229 insertions(+), 284 deletions(-)
 create mode 100644 gcc/config/loongarch/lasx.md
 create mode 100644 gcc/config/loongarch/lasxintrin.h
 create mode 100644 gcc/config/loongarch/lsx.md
 create mode 100644 gcc/config/loongarch/lsxintrin.h
 create mode 100644 gcc/testsuite/gcc.target/loongarch/strict-align.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-bit-manipulate.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-builtin.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-cmp.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-fp-arith.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-fp-cvt.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-int-arith.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-mem.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-perm.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-str-manipulate.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvldrepl.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lasx/lasx-xvstelm.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/loongarch-vector.exp
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-bit-manipulate.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-builtin.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-cmp.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-fp-arith.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-fp-cvt.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-int-arith.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-mem.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-perm.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/lsx/lsx-str-manipulate.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/vector/simd_correctness_check.h

Comments

Xi Ruoyao July 18, 2023, 12:26 p.m. UTC | #1
On Tue, 2023-07-18 at 19:06 +0800, Chenghui Pan wrote:
> Lulu Cheng (8):
>   LoongArch: Added Loongson SX vector directive compilation framework.
>   LoongArch: Added Loongson SX base instruction support.
>   LoongArch: Added Loongson SX directive builtin function support.
>   LoongArch: Added Loongson ASX vector directive compilation framework.
>   LoongArch: Added Loongson ASX base instruction support.
>   LoongArch: Added Loongson ASX directive builtin function support.

Let's always use "Add".

>   LoongArch: Add Loongson SX directive test cases.
>   LoongArch: Add Loongson ASX directive test cases.

Have you tested this series by bootstrapping and regtesting GCC with
BOOT_CFLAGS="-O2 -ftree-vectorize -fno-vect-cost-model -mlasx" and
BOOT_CFLAGS="-O3 -mlasx"?  This may catch some mistakes early.

And I'll rebuild the entire system with these GCC patches and -mlasx in
Aug (after Glibc-2.38 release) as a field test too.
Chenghui Pan July 19, 2023, 1:14 a.m. UTC | #2
Got it, I will fix the commit info in next version.

I haven't test GCC with these flags before, so I will try to build and
run regression test with BOOT_CFLAGS later. 

On Tue, 2023-07-18 at 20:26 +0800, Xi Ruoyao wrote:
> On Tue, 2023-07-18 at 19:06 +0800, Chenghui Pan wrote:
> > Lulu Cheng (8):
> >   LoongArch: Added Loongson SX vector directive compilation
> > framework.
> >   LoongArch: Added Loongson SX base instruction support.
> >   LoongArch: Added Loongson SX directive builtin function support.
> >   LoongArch: Added Loongson ASX vector directive compilation
> > framework.
> >   LoongArch: Added Loongson ASX base instruction support.
> >   LoongArch: Added Loongson ASX directive builtin function support.
> 
> Let's always use "Add".
> 
> >   LoongArch: Add Loongson SX directive test cases.
> >   LoongArch: Add Loongson ASX directive test cases.
> 
> Have you tested this series by bootstrapping and regtesting GCC with
> BOOT_CFLAGS="-O2 -ftree-vectorize -fno-vect-cost-model -mlasx" and
> BOOT_CFLAGS="-O3 -mlasx"?  This may catch some mistakes early.
> 
> And I'll rebuild the entire system with these GCC patches and -mlasx
> in
> Aug (after Glibc-2.38 release) as a field test too.
>