public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 0/5] LoongArch: Better balance between relaxation and scheduling
@ 2023-10-19 14:02 Xi Ruoyao
  2023-10-19 14:02 ` [PATCH 1/5] LoongArch: Add enum-style -mexplicit-relocs= option Xi Ruoyao
                   ` (5 more replies)
  0 siblings, 6 replies; 10+ messages in thread
From: Xi Ruoyao @ 2023-10-19 14:02 UTC (permalink / raw)
  To: gcc-patches; +Cc: chenglulu, i, xuchenghua, mengqinggang, Xi Ruoyao

For relaxation we are now generating assembler macros for symbolic
addresses everywhere, but this is limiting scheduling and there are
known situations where the relaxation cannot improve the code.

1. When we are performing LTO during a final link and the linker plugin
is used, la.global won't be relaxed because they reference to an
external or preemptable symbol.
2. The linker currently do not relax la.tls.*.
3. For la.local + ld/st pairs, if the address is only used once,
emitting pcalau12i + ld/st is always not worse than relying on linker
relaxation.

Add -mexplicit-relocs=auto to allow the compiler to use explicit relocs
for these cases, but assembler macros for other cases.  Use it as the
default if the assembler supports both explicit relocs and relaxation.

LTO-bootstrapped and regtested on loongarch64-linux-gnu.  Ok for trunk?

Xi Ruoyao (5):
  LoongArch: Add enum-style -mexplicit-relocs= option
  LoongArch: Use explicit relocs for GOT access when
    -mexplicit-relocs=auto and LTO during a final link with linker
    plugin
  LoongArch: Use explicit relocs for TLS access with
    -mexplicit-relocs=auto
  LoongArch: Use explicit relocs for addresses only used for one load or
    store with -mexplicit-relocs=auto and -mcmodel={normal,medium}
  LoongArch: Document -mexplicit-relocs={auto,none,always}

 .../loongarch/genopts/loongarch-strings       |   6 +
 gcc/config/loongarch/genopts/loongarch.opt.in |  21 ++-
 gcc/config/loongarch/loongarch-def.h          |   6 +
 gcc/config/loongarch/loongarch-protos.h       |   1 +
 gcc/config/loongarch/loongarch-str.h          |   5 +
 gcc/config/loongarch/loongarch.cc             |  75 ++++++++--
 gcc/config/loongarch/loongarch.h              |   3 +
 gcc/config/loongarch/loongarch.md             | 128 +++++++++++++++++-
 gcc/config/loongarch/loongarch.opt            |  21 ++-
 gcc/config/loongarch/predicates.md            |  15 +-
 gcc/doc/invoke.texi                           |  37 +++--
 .../loongarch/explicit-relocs-auto-lto.c      |  26 ++++
 ...-relocs-auto-single-load-store-no-anchor.c |   6 +
 .../explicit-relocs-auto-single-load-store.c  |  14 ++
 .../explicit-relocs-auto-tls-ld-gd.c          |   9 ++
 .../explicit-relocs-auto-tls-le-ie.c          |   6 +
 16 files changed, 343 insertions(+), 36 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-auto-lto.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-auto-single-load-store-no-anchor.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-auto-single-load-store.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-auto-tls-ld-gd.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/explicit-relocs-auto-tls-le-ie.c

-- 
2.42.0


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2023-10-23  7:35 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-19 14:02 [PATCH 0/5] LoongArch: Better balance between relaxation and scheduling Xi Ruoyao
2023-10-19 14:02 ` [PATCH 1/5] LoongArch: Add enum-style -mexplicit-relocs= option Xi Ruoyao
2023-10-19 14:02 ` [PATCH 2/5] LoongArch: Use explicit relocs for GOT access when -mexplicit-relocs=auto and LTO during a final link with linker plugin Xi Ruoyao
2023-10-21  7:32   ` chenglulu
2023-10-21  8:42     ` Xi Ruoyao
2023-10-23  0:56       ` chenglulu
2023-10-19 14:02 ` [PATCH 3/5] LoongArch: Use explicit relocs for TLS access with -mexplicit-relocs=auto Xi Ruoyao
2023-10-19 14:02 ` [PATCH 4/5] LoongArch: Use explicit relocs for addresses only used for one load or store with -mexplicit-relocs=auto and -mcmodel={normal,medium} Xi Ruoyao
2023-10-19 14:03 ` [PATCH 5/5] LoongArch: Document -mexplicit-relocs={auto,none,always} Xi Ruoyao
2023-10-23  7:34 ` Pushed: [PATCH 0/5] LoongArch: Better balance between relaxation and scheduling Xi Ruoyao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).