[v9,00/12] Add LoongArch support.

Message ID 20220319092425.3324697-1-chenglulu@loongson.cn
Headers
Series Add LoongArch support. |

Message

Lulu Cheng March 19, 2022, 9:24 a.m. UTC
  Hi, all:

This is the v9 version of LoongArch Port based on 9fc8f278ebebc57537dc0cb9d33e36d932be0bc3.
Please review.

We know it is stage4, I think it is ok for a new prot.
The kernel side upstream waiting for a approval by gcc side,
if it is blocked by stage4, a approval for GCC13 will be appreciation.

The LoongArch architecture (LoongArch) is an Instruction Set
Architecture (ISA) that has a Reduced Instruction Set Computer (RISC)
style.
The documents are on
https://loongson.github.io/LoongArch-Documentation/README-EN.html

The ELF ABI Documents are on:
https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html

The binutils has been merged into trunk:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=560b3fe208255ae909b4b1c88ba9c28b09043307

Note: We split -mabi= into -mabi=lp64d/f/s, the new options not support by upstream binutils yet,
this GCC port requires the following patch applied to binutils to build.
https://github.com/loongson/binutils-gdb/commit/aacb0bf860f02aa5a7dcb76dd0e392bf871c7586
(will be submitted to upstream after gcc side comfirmed)

We have compiled more than 300 CLFS packages with this compiler.
The CLFS are currently used on Cfarm machines gcc400 and gcc401.

changelog:

v1 -> v2
1. Split patch set.
2. Change some code style.
3. Add -mabi=lp64d/f/s options.
4. Change GLIBC_DYNAMIC_LINKER_LP64 name.

v2 -> v3
1. Change some code style.
2. Bug fix.

v3 -> v4
1. Change some code style.
2. Bug fix.
3. Delete some builtin macros.

v4 -> v5
1. delete wrong insn zero_extendsidi2_internal.
2. Adjust some build options.
3. Change some .c files to .cc.

v5 -> v6
1. Fix compilation issues. The generated files *.opt and *.h
   are generated to $(objdir).

v6 -> v7
1. Bug fix.
2. Change some code style.

v7 -> v8
1. Add new addressing type ADDRESS_REG_REG support.
2. Modify documentation.
3. Eliminate compile-time warnings.

v8 -> v9
1. Undefine the hook TARGET_TRULY_NOOP_TRUNCATION under the architecture.
2. Delete some unsed hooks.
3. Change some code style.
4. Modify documentation.

*** BLURB HERE ***

chenglulu (12):
  LoongArch Port: Regenerate configure
  LoongArch Port: gcc build
  LoongArch Port: Regenerate gcc/configure.
  LoongArch Port: Machine description files.
  LoongArch Port: Machine description C files and .h files.
  LoongArch Port: Builtin functions.
  LoongArch Port: Builtin macros.
  LoongArch Port: libgcc
  LoongArch Port: Regenerate libgcc/configure.
  LoongArch Port: libgomp
  LoongArch Port: gcc/testsuite
  LoongArch Port: Add doc.

 config/picflag.m4                             |    3 +
 configure                                     |   10 +-
 configure.ac                                  |   10 +-
 contrib/config-list.mk                        |    4 +-
 contrib/gcc_update                            |    2 +
 .../config/loongarch/loongarch-common.cc      |   43 +
 gcc/config.gcc                                |  435 +-
 gcc/config/host-linux.cc                      |    2 +
 gcc/config/loongarch/constraints.md           |  203 +
 gcc/config/loongarch/generic.md               |  118 +
 gcc/config/loongarch/genopts/genstr.sh        |  104 +
 .../loongarch/genopts/loongarch-strings       |   58 +
 gcc/config/loongarch/genopts/loongarch.opt.in |  179 +
 gcc/config/loongarch/gnu-user.h               |   80 +
 gcc/config/loongarch/la464.md                 |  132 +
 gcc/config/loongarch/larchintrin.h            |  409 ++
 gcc/config/loongarch/linux.h                  |   50 +
 gcc/config/loongarch/loongarch-builtins.cc    |  511 ++
 gcc/config/loongarch/loongarch-c.cc           |  109 +
 gcc/config/loongarch/loongarch-cpu.cc         |  206 +
 gcc/config/loongarch/loongarch-cpu.h          |   30 +
 gcc/config/loongarch/loongarch-def.c          |  179 +
 gcc/config/loongarch/loongarch-def.h          |  151 +
 gcc/config/loongarch/loongarch-driver.cc      |  187 +
 gcc/config/loongarch/loongarch-driver.h       |   69 +
 gcc/config/loongarch/loongarch-ftypes.def     |  106 +
 gcc/config/loongarch/loongarch-modes.def      |   25 +
 gcc/config/loongarch/loongarch-opts.cc        |  578 ++
 gcc/config/loongarch/loongarch-opts.h         |   90 +
 gcc/config/loongarch/loongarch-protos.h       |  174 +
 gcc/config/loongarch/loongarch-str.h          |   59 +
 gcc/config/loongarch/loongarch-tune.h         |   50 +
 gcc/config/loongarch/loongarch.cc             | 5912 +++++++++++++++++
 gcc/config/loongarch/loongarch.h              | 1147 ++++
 gcc/config/loongarch/loongarch.md             | 3412 ++++++++++
 gcc/config/loongarch/loongarch.opt            |  186 +
 gcc/config/loongarch/predicates.md            |  253 +
 gcc/config/loongarch/sync.md                  |  574 ++
 gcc/config/loongarch/t-linux                  |   53 +
 gcc/config/loongarch/t-loongarch              |   72 +
 gcc/configure                                 |   66 +-
 gcc/configure.ac                              |   33 +-
 gcc/doc/install.texi                          |   47 +-
 gcc/doc/invoke.texi                           |  200 +
 gcc/doc/md.texi                               |   26 +
 .../c-c++-common/zero-scratch-regs-10.c       |    2 +-
 .../c-c++-common/zero-scratch-regs-11.c       |    2 +-
 .../c-c++-common/zero-scratch-regs-8.c        |    2 +-
 .../c-c++-common/zero-scratch-regs-9.c        |    2 +-
 gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C    |    2 +-
 gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C   |    2 +-
 gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C   |    2 +-
 gcc/testsuite/gcc.dg/20020312-2.c             |    2 +
 gcc/testsuite/gcc.dg/loop-8.c                 |    2 +-
 .../torture/stackalign/builtin-apply-2.c      |    2 +-
 gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c     |    2 +-
 .../gcc.target/loongarch/larch-builtin.c      |  307 +
 .../gcc.target/loongarch/loongarch.exp        |   40 +
 .../gcc.target/loongarch/tst-asm-const.c      |   16 +
 gcc/testsuite/go.test/go-test.exp             |    3 +
 gcc/testsuite/lib/target-supports.exp         |   14 +
 libgcc/config.host                            |   28 +-
 libgcc/config/loongarch/crtfastmath.c         |   52 +
 libgcc/config/loongarch/linux-unwind.h        |   80 +
 libgcc/config/loongarch/sfp-machine.h         |  152 +
 libgcc/config/loongarch/t-crtstuff            |    5 +
 libgcc/config/loongarch/t-loongarch           |    7 +
 libgcc/config/loongarch/t-loongarch64         |    1 +
 libgcc/config/loongarch/t-softfp-tf           |    3 +
 libgcc/configure                              |    5 +-
 libgcc/configure.ac                           |    2 +-
 libgomp/configure.tgt                         |    4 +
 72 files changed, 17056 insertions(+), 32 deletions(-)
 create mode 100644 gcc/common/config/loongarch/loongarch-common.cc
 create mode 100644 gcc/config/loongarch/constraints.md
 create mode 100644 gcc/config/loongarch/generic.md
 create mode 100755 gcc/config/loongarch/genopts/genstr.sh
 create mode 100644 gcc/config/loongarch/genopts/loongarch-strings
 create mode 100644 gcc/config/loongarch/genopts/loongarch.opt.in
 create mode 100644 gcc/config/loongarch/gnu-user.h
 create mode 100644 gcc/config/loongarch/la464.md
 create mode 100644 gcc/config/loongarch/larchintrin.h
 create mode 100644 gcc/config/loongarch/linux.h
 create mode 100644 gcc/config/loongarch/loongarch-builtins.cc
 create mode 100644 gcc/config/loongarch/loongarch-c.cc
 create mode 100644 gcc/config/loongarch/loongarch-cpu.cc
 create mode 100644 gcc/config/loongarch/loongarch-cpu.h
 create mode 100644 gcc/config/loongarch/loongarch-def.c
 create mode 100644 gcc/config/loongarch/loongarch-def.h
 create mode 100644 gcc/config/loongarch/loongarch-driver.cc
 create mode 100644 gcc/config/loongarch/loongarch-driver.h
 create mode 100644 gcc/config/loongarch/loongarch-ftypes.def
 create mode 100644 gcc/config/loongarch/loongarch-modes.def
 create mode 100644 gcc/config/loongarch/loongarch-opts.cc
 create mode 100644 gcc/config/loongarch/loongarch-opts.h
 create mode 100644 gcc/config/loongarch/loongarch-protos.h
 create mode 100644 gcc/config/loongarch/loongarch-str.h
 create mode 100644 gcc/config/loongarch/loongarch-tune.h
 create mode 100644 gcc/config/loongarch/loongarch.cc
 create mode 100644 gcc/config/loongarch/loongarch.h
 create mode 100644 gcc/config/loongarch/loongarch.md
 create mode 100644 gcc/config/loongarch/loongarch.opt
 create mode 100644 gcc/config/loongarch/predicates.md
 create mode 100644 gcc/config/loongarch/sync.md
 create mode 100644 gcc/config/loongarch/t-linux
 create mode 100644 gcc/config/loongarch/t-loongarch
 create mode 100644 gcc/testsuite/gcc.target/loongarch/larch-builtin.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/loongarch.exp
 create mode 100644 gcc/testsuite/gcc.target/loongarch/tst-asm-const.c
 create mode 100644 libgcc/config/loongarch/crtfastmath.c
 create mode 100644 libgcc/config/loongarch/linux-unwind.h
 create mode 100644 libgcc/config/loongarch/sfp-machine.h
 create mode 100644 libgcc/config/loongarch/t-crtstuff
 create mode 100644 libgcc/config/loongarch/t-loongarch
 create mode 100644 libgcc/config/loongarch/t-loongarch64
 create mode 100644 libgcc/config/loongarch/t-softfp-tf
  

Comments

Richard Sandiford March 22, 2022, 11:39 a.m. UTC | #1
chenglulu <chenglulu@loongson.cn> writes:
> Hi, all:
>
> This is the v9 version of LoongArch Port based on 9fc8f278ebebc57537dc0cb9d33e36d932be0bc3.
> Please review.

Thanks for the update.  I've sent follows-up for parts 4, 6, 11 and 12,
but otherwise v9 addresses all the comments I had.  The series LGTM
with those issues fixed.

Richard

> We know it is stage4, I think it is ok for a new prot.
> The kernel side upstream waiting for a approval by gcc side,
> if it is blocked by stage4, a approval for GCC13 will be appreciation.
>
> The LoongArch architecture (LoongArch) is an Instruction Set
> Architecture (ISA) that has a Reduced Instruction Set Computer (RISC)
> style.
> The documents are on
> https://loongson.github.io/LoongArch-Documentation/README-EN.html
>
> The ELF ABI Documents are on:
> https://loongson.github.io/LoongArch-Documentation/LoongArch-ELF-ABI-EN.html
>
> The binutils has been merged into trunk:
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=560b3fe208255ae909b4b1c88ba9c28b09043307
>
> Note: We split -mabi= into -mabi=lp64d/f/s, the new options not support by upstream binutils yet,
> this GCC port requires the following patch applied to binutils to build.
> https://github.com/loongson/binutils-gdb/commit/aacb0bf860f02aa5a7dcb76dd0e392bf871c7586
> (will be submitted to upstream after gcc side comfirmed)
>
> We have compiled more than 300 CLFS packages with this compiler.
> The CLFS are currently used on Cfarm machines gcc400 and gcc401.
>
> changelog:
>
> v1 -> v2
> 1. Split patch set.
> 2. Change some code style.
> 3. Add -mabi=lp64d/f/s options.
> 4. Change GLIBC_DYNAMIC_LINKER_LP64 name.
>
> v2 -> v3
> 1. Change some code style.
> 2. Bug fix.
>
> v3 -> v4
> 1. Change some code style.
> 2. Bug fix.
> 3. Delete some builtin macros.
>
> v4 -> v5
> 1. delete wrong insn zero_extendsidi2_internal.
> 2. Adjust some build options.
> 3. Change some .c files to .cc.
>
> v5 -> v6
> 1. Fix compilation issues. The generated files *.opt and *.h
>    are generated to $(objdir).
>
> v6 -> v7
> 1. Bug fix.
> 2. Change some code style.
>
> v7 -> v8
> 1. Add new addressing type ADDRESS_REG_REG support.
> 2. Modify documentation.
> 3. Eliminate compile-time warnings.
>
> v8 -> v9
> 1. Undefine the hook TARGET_TRULY_NOOP_TRUNCATION under the architecture.
> 2. Delete some unsed hooks.
> 3. Change some code style.
> 4. Modify documentation.
>
> *** BLURB HERE ***
>
> chenglulu (12):
>   LoongArch Port: Regenerate configure
>   LoongArch Port: gcc build
>   LoongArch Port: Regenerate gcc/configure.
>   LoongArch Port: Machine description files.
>   LoongArch Port: Machine description C files and .h files.
>   LoongArch Port: Builtin functions.
>   LoongArch Port: Builtin macros.
>   LoongArch Port: libgcc
>   LoongArch Port: Regenerate libgcc/configure.
>   LoongArch Port: libgomp
>   LoongArch Port: gcc/testsuite
>   LoongArch Port: Add doc.
>
>  config/picflag.m4                             |    3 +
>  configure                                     |   10 +-
>  configure.ac                                  |   10 +-
>  contrib/config-list.mk                        |    4 +-
>  contrib/gcc_update                            |    2 +
>  .../config/loongarch/loongarch-common.cc      |   43 +
>  gcc/config.gcc                                |  435 +-
>  gcc/config/host-linux.cc                      |    2 +
>  gcc/config/loongarch/constraints.md           |  203 +
>  gcc/config/loongarch/generic.md               |  118 +
>  gcc/config/loongarch/genopts/genstr.sh        |  104 +
>  .../loongarch/genopts/loongarch-strings       |   58 +
>  gcc/config/loongarch/genopts/loongarch.opt.in |  179 +
>  gcc/config/loongarch/gnu-user.h               |   80 +
>  gcc/config/loongarch/la464.md                 |  132 +
>  gcc/config/loongarch/larchintrin.h            |  409 ++
>  gcc/config/loongarch/linux.h                  |   50 +
>  gcc/config/loongarch/loongarch-builtins.cc    |  511 ++
>  gcc/config/loongarch/loongarch-c.cc           |  109 +
>  gcc/config/loongarch/loongarch-cpu.cc         |  206 +
>  gcc/config/loongarch/loongarch-cpu.h          |   30 +
>  gcc/config/loongarch/loongarch-def.c          |  179 +
>  gcc/config/loongarch/loongarch-def.h          |  151 +
>  gcc/config/loongarch/loongarch-driver.cc      |  187 +
>  gcc/config/loongarch/loongarch-driver.h       |   69 +
>  gcc/config/loongarch/loongarch-ftypes.def     |  106 +
>  gcc/config/loongarch/loongarch-modes.def      |   25 +
>  gcc/config/loongarch/loongarch-opts.cc        |  578 ++
>  gcc/config/loongarch/loongarch-opts.h         |   90 +
>  gcc/config/loongarch/loongarch-protos.h       |  174 +
>  gcc/config/loongarch/loongarch-str.h          |   59 +
>  gcc/config/loongarch/loongarch-tune.h         |   50 +
>  gcc/config/loongarch/loongarch.cc             | 5912 +++++++++++++++++
>  gcc/config/loongarch/loongarch.h              | 1147 ++++
>  gcc/config/loongarch/loongarch.md             | 3412 ++++++++++
>  gcc/config/loongarch/loongarch.opt            |  186 +
>  gcc/config/loongarch/predicates.md            |  253 +
>  gcc/config/loongarch/sync.md                  |  574 ++
>  gcc/config/loongarch/t-linux                  |   53 +
>  gcc/config/loongarch/t-loongarch              |   72 +
>  gcc/configure                                 |   66 +-
>  gcc/configure.ac                              |   33 +-
>  gcc/doc/install.texi                          |   47 +-
>  gcc/doc/invoke.texi                           |  200 +
>  gcc/doc/md.texi                               |   26 +
>  .../c-c++-common/zero-scratch-regs-10.c       |    2 +-
>  .../c-c++-common/zero-scratch-regs-11.c       |    2 +-
>  .../c-c++-common/zero-scratch-regs-8.c        |    2 +-
>  .../c-c++-common/zero-scratch-regs-9.c        |    2 +-
>  gcc/testsuite/g++.dg/cpp0x/constexpr-rom.C    |    2 +-
>  gcc/testsuite/g++.old-deja/g++.abi/ptrmem.C   |    2 +-
>  gcc/testsuite/g++.old-deja/g++.pt/ptrmem6.C   |    2 +-
>  gcc/testsuite/gcc.dg/20020312-2.c             |    2 +
>  gcc/testsuite/gcc.dg/loop-8.c                 |    2 +-
>  .../torture/stackalign/builtin-apply-2.c      |    2 +-
>  gcc/testsuite/gcc.dg/tree-ssa/ssa-fre-3.c     |    2 +-
>  .../gcc.target/loongarch/larch-builtin.c      |  307 +
>  .../gcc.target/loongarch/loongarch.exp        |   40 +
>  .../gcc.target/loongarch/tst-asm-const.c      |   16 +
>  gcc/testsuite/go.test/go-test.exp             |    3 +
>  gcc/testsuite/lib/target-supports.exp         |   14 +
>  libgcc/config.host                            |   28 +-
>  libgcc/config/loongarch/crtfastmath.c         |   52 +
>  libgcc/config/loongarch/linux-unwind.h        |   80 +
>  libgcc/config/loongarch/sfp-machine.h         |  152 +
>  libgcc/config/loongarch/t-crtstuff            |    5 +
>  libgcc/config/loongarch/t-loongarch           |    7 +
>  libgcc/config/loongarch/t-loongarch64         |    1 +
>  libgcc/config/loongarch/t-softfp-tf           |    3 +
>  libgcc/configure                              |    5 +-
>  libgcc/configure.ac                           |    2 +-
>  libgomp/configure.tgt                         |    4 +
>  72 files changed, 17056 insertions(+), 32 deletions(-)
>  create mode 100644 gcc/common/config/loongarch/loongarch-common.cc
>  create mode 100644 gcc/config/loongarch/constraints.md
>  create mode 100644 gcc/config/loongarch/generic.md
>  create mode 100755 gcc/config/loongarch/genopts/genstr.sh
>  create mode 100644 gcc/config/loongarch/genopts/loongarch-strings
>  create mode 100644 gcc/config/loongarch/genopts/loongarch.opt.in
>  create mode 100644 gcc/config/loongarch/gnu-user.h
>  create mode 100644 gcc/config/loongarch/la464.md
>  create mode 100644 gcc/config/loongarch/larchintrin.h
>  create mode 100644 gcc/config/loongarch/linux.h
>  create mode 100644 gcc/config/loongarch/loongarch-builtins.cc
>  create mode 100644 gcc/config/loongarch/loongarch-c.cc
>  create mode 100644 gcc/config/loongarch/loongarch-cpu.cc
>  create mode 100644 gcc/config/loongarch/loongarch-cpu.h
>  create mode 100644 gcc/config/loongarch/loongarch-def.c
>  create mode 100644 gcc/config/loongarch/loongarch-def.h
>  create mode 100644 gcc/config/loongarch/loongarch-driver.cc
>  create mode 100644 gcc/config/loongarch/loongarch-driver.h
>  create mode 100644 gcc/config/loongarch/loongarch-ftypes.def
>  create mode 100644 gcc/config/loongarch/loongarch-modes.def
>  create mode 100644 gcc/config/loongarch/loongarch-opts.cc
>  create mode 100644 gcc/config/loongarch/loongarch-opts.h
>  create mode 100644 gcc/config/loongarch/loongarch-protos.h
>  create mode 100644 gcc/config/loongarch/loongarch-str.h
>  create mode 100644 gcc/config/loongarch/loongarch-tune.h
>  create mode 100644 gcc/config/loongarch/loongarch.cc
>  create mode 100644 gcc/config/loongarch/loongarch.h
>  create mode 100644 gcc/config/loongarch/loongarch.md
>  create mode 100644 gcc/config/loongarch/loongarch.opt
>  create mode 100644 gcc/config/loongarch/predicates.md
>  create mode 100644 gcc/config/loongarch/sync.md
>  create mode 100644 gcc/config/loongarch/t-linux
>  create mode 100644 gcc/config/loongarch/t-loongarch
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/larch-builtin.c
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/loongarch.exp
>  create mode 100644 gcc/testsuite/gcc.target/loongarch/tst-asm-const.c
>  create mode 100644 libgcc/config/loongarch/crtfastmath.c
>  create mode 100644 libgcc/config/loongarch/linux-unwind.h
>  create mode 100644 libgcc/config/loongarch/sfp-machine.h
>  create mode 100644 libgcc/config/loongarch/t-crtstuff
>  create mode 100644 libgcc/config/loongarch/t-loongarch
>  create mode 100644 libgcc/config/loongarch/t-loongarch64
>  create mode 100644 libgcc/config/loongarch/t-softfp-tf