[0/2] When cmodel=extreme, add macro support and only

Message ID 20231227084654.20614-1-chenglulu@loongson.cn
Headers
Series When cmodel=extreme, add macro support and only |

Message

Lulu Cheng Dec. 27, 2023, 8:46 a.m. UTC
  When cmodel=extreme, since the symbol address is obtained through four instructions,
errors may occur in some cases during linking. Therefore, in order to ensure that
the instructions for obtaining the symbol address are together, macro instructions
are used to obtain the symbol address when cmodel=extreme.

https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#extreme-code-model


Lulu Cheng (2):
  LoongArch: Add the macro implementation of mcmodel=extreme.
  LoongArch: When the code model is extreme, the symbol address is
    obtained through macro instructions regardless of the value of
    -mexplicit-relocs.

 gcc/config/loongarch/loongarch.cc             | 25 +++++-----
 gcc/config/loongarch/loongarch.md             | 47 ++++++++++++++++++-
 gcc/config/loongarch/predicates.md            | 14 ++++++
 .../gcc.target/loongarch/attr-model-1.c       |  2 +-
 .../gcc.target/loongarch/attr-model-2.c       |  2 +-
 .../gcc.target/loongarch/attr-model-3.c       |  2 +-
 .../gcc.target/loongarch/attr-model-4.c       |  2 +-
 .../loongarch/func-call-extreme-1.c           |  6 +--
 .../loongarch/func-call-extreme-2.c           |  6 +--
 .../loongarch/func-call-extreme-3.c           |  6 +--
 .../loongarch/func-call-extreme-4.c           |  6 +--
 .../loongarch/func-call-extreme-5.c           |  7 +++
 .../loongarch/func-call-extreme-6.c           |  7 +++
 13 files changed, 102 insertions(+), 30 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-5.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-6.c
  

Comments

Lulu Cheng Dec. 27, 2023, 9:18 a.m. UTC | #1
在 2023/12/27 下午4:46, Lulu Cheng 写道:
> When cmodel=extreme, since the symbol address is obtained through four instructions,
> errors may occur in some cases during linking. Therefore, in order to ensure that
> the instructions for obtaining the symbol address are together, macro instructions
> are used to obtain the symbol address when cmodel=extreme.
>
> https://github.com/loongson/la-abi-specs/blob/release/laelf.adoc#extreme-code-model
>
There are some problems with the test case changes, I will fix them in 
the v2 version.

> Lulu Cheng (2):
>    LoongArch: Add the macro implementation of mcmodel=extreme.
>    LoongArch: When the code model is extreme, the symbol address is
>      obtained through macro instructions regardless of the value of
>      -mexplicit-relocs.
>
>   gcc/config/loongarch/loongarch.cc             | 25 +++++-----
>   gcc/config/loongarch/loongarch.md             | 47 ++++++++++++++++++-
>   gcc/config/loongarch/predicates.md            | 14 ++++++
>   .../gcc.target/loongarch/attr-model-1.c       |  2 +-
>   .../gcc.target/loongarch/attr-model-2.c       |  2 +-
>   .../gcc.target/loongarch/attr-model-3.c       |  2 +-
>   .../gcc.target/loongarch/attr-model-4.c       |  2 +-
>   .../loongarch/func-call-extreme-1.c           |  6 +--
>   .../loongarch/func-call-extreme-2.c           |  6 +--
>   .../loongarch/func-call-extreme-3.c           |  6 +--
>   .../loongarch/func-call-extreme-4.c           |  6 +--
>   .../loongarch/func-call-extreme-5.c           |  7 +++
>   .../loongarch/func-call-extreme-6.c           |  7 +++
>   13 files changed, 102 insertions(+), 30 deletions(-)
>   create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-5.c
>   create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-extreme-6.c
>