[v2,00/14] LoongArch: Add loongarch32 and ilp32 abi

Message ID 20230809115325.3716347-1-c@jia.je
Headers
Series LoongArch: Add loongarch32 and ilp32 abi |

Message

Jiajie Chen Aug. 9, 2023, 11:46 a.m. UTC
  The patch series add loongarch32 and ilp32 abi support to gcc. One can
build libgcc, libatomic and glibc etc and generate a complete
loongarch32-unknown-linux-gnu-toolchain with minimal patches at:

- binutils: https://github.com/jiegec/binutils-gdb/tree/loongarch32
- glibc: https://github.com/jiegec/glibc/tree/loongarch32
- crosstool-ng: https://github.com/jiegec/crosstool-ng/tree/loongarch32

We will wait for folks at Loongson to complete abi documentation of
ilp32d abi.

Changes since v1:

- Can build a complete toolchain with glibc
- Fix sizeof(long double) in ilp32 abi
- Fix ftintrz generation for loongarch32

Full changes:

Jiajie Chen (14):
  LoongArch: Introduce loongarch32 target
  LoongArch: Fix default ISA setting
  LoongArch: Fix SI division for loongarch32 target
  LoongArch: Fix movgr2frh.w operand order
  LoongArch: Fix 64-bit move for loongarch32 target
  LoongArch: Fix 64-bit immediate move for loongarch32 target
  LoongArch: Fix signed 32-bit overflow for loongarch32 target
  LoongArch: Disable SF/DF -> unsigned DI expand in loongarch32
  LoongArch: Add -march=loongarch64 to tests with -mabi=lp64d
  LoongArch: Forbid ADDRESS_REG_REG in loongarch32
  LoongArch: Mark am* instructions as LA64-only
  LoongArch: Set long double width to 128 in la32
  LoongArch: Fix ilp32 detection
  LoongArch: Allow ftintrz for DF->DI in loongarch32

 contrib/config-list.mk                        |  1 +
 gcc/config.gcc                                | 61 ++++++++++++++++---
 .../loongarch/genopts/loongarch-strings       |  5 ++
 gcc/config/loongarch/genopts/loongarch.opt.in | 12 ++++
 gcc/config/loongarch/gnu-user.h               |  3 +
 gcc/config/loongarch/linux.h                  |  8 ++-
 gcc/config/loongarch/loongarch-c.cc           | 12 ++++
 gcc/config/loongarch/loongarch-def.c          | 33 ++++++++++
 gcc/config/loongarch/loongarch-def.h          | 25 +++++---
 gcc/config/loongarch/loongarch-driver.h       |  4 ++
 gcc/config/loongarch/loongarch-opts.cc        | 27 ++++++--
 gcc/config/loongarch/loongarch-opts.h         | 20 ++++--
 gcc/config/loongarch/loongarch-str.h          |  5 ++
 gcc/config/loongarch/loongarch.cc             |  7 ++-
 gcc/config/loongarch/loongarch.h              |  2 +-
 gcc/config/loongarch/loongarch.md             | 39 ++++++------
 gcc/config/loongarch/loongarch.opt            | 12 ++++
 gcc/config/loongarch/sync.md                  | 10 +--
 gcc/config/loongarch/t-linux                  | 16 ++++-
 gcc/testsuite/g++.target/loongarch/bytepick.C |  2 +-
 gcc/testsuite/g++.target/loongarch/pr106828.C |  2 +-
 .../gcc.target/loongarch/add-const.c          |  2 +-
 gcc/testsuite/gcc.target/loongarch/arch-1.c   |  5 ++
 gcc/testsuite/gcc.target/loongarch/arch-2.c   |  5 ++
 .../gcc.target/loongarch/array-ldx.c          |  6 ++
 .../gcc.target/loongarch/attr-model-1.c       |  2 +-
 .../gcc.target/loongarch/attr-model-2.c       |  2 +-
 .../gcc.target/loongarch/flt-abi-isa-1.c      |  2 +-
 gcc/testsuite/gcc.target/loongarch/fscaleb.c  |  2 +-
 .../gcc.target/loongarch/ftint-no-inexact.c   |  2 +-
 gcc/testsuite/gcc.target/loongarch/ftint.c    |  2 +-
 .../gcc.target/loongarch/func-call-1.c        |  2 +-
 .../gcc.target/loongarch/func-call-2.c        |  2 +-
 .../gcc.target/loongarch/func-call-3.c        |  2 +-
 .../gcc.target/loongarch/func-call-4.c        |  2 +-
 .../gcc.target/loongarch/func-call-5.c        |  2 +-
 .../gcc.target/loongarch/func-call-6.c        |  2 +-
 .../gcc.target/loongarch/func-call-7.c        |  2 +-
 .../gcc.target/loongarch/func-call-8.c        |  2 +-
 .../loongarch/func-call-extreme-1.c           |  2 +-
 .../loongarch/func-call-extreme-2.c           |  2 +-
 .../gcc.target/loongarch/func-call-medium-1.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-2.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-3.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-4.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-5.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-6.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-7.c |  2 +-
 .../gcc.target/loongarch/func-call-medium-8.c |  2 +-
 gcc/testsuite/gcc.target/loongarch/imm-load.c |  2 +-
 .../gcc.target/loongarch/imm-load1.c          |  2 +-
 gcc/testsuite/gcc.target/loongarch/mulw_d_w.c |  2 +-
 .../gcc.target/loongarch/pr109465-1.c         |  2 +-
 .../gcc.target/loongarch/pr109465-2.c         |  2 +-
 .../gcc.target/loongarch/pr109465-3.c         |  2 +-
 .../gcc.target/loongarch/prolog-opt.c         |  2 +-
 .../loongarch/relocs-symbol-noaddend.c        |  2 +-
 .../loongarch/zero-size-field-pass.c          |  2 +-
 .../loongarch/zero-size-field-ret.c           |  2 +-
 libitm/config/loongarch/asm.h                 |  2 +-
 60 files changed, 298 insertions(+), 96 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/arch-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/arch-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/array-ldx.c