public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Jinyang He <hejinyang@loongson.cn>
To: changjiachen <changjiachen@stu.xupt.edu.cn>, binutils@sourceware.org
Cc: xuchenghua@loongson.cn, chenglulu@loongson.cn,
	liuzhensong@loongson.cn, xry111@xry111.site, i.swmail@xen0n.name,
	maskray@google.com, cailulu@loongson.cn, luweining@loongson.cn,
	wanglei@loongson.cn, Lazy_Linux@126.com,
	mengqinggang@loongson.cn
Subject: Re: [PATCH v2 0/5] LoongArch tls le model linker relaxation support.
Date: Mon, 4 Dec 2023 10:25:13 +0800	[thread overview]
Message-ID: <5a46833f-00db-fb85-2723-461caf330263@loongson.cn> (raw)
In-Reply-To: <20231202065334.25904-1-changjiachen@stu.xupt.edu.cn>


On 2023-12-02 14:53, changjiachen wrote:
> This is the v2 version of patches to support loongarch linker tls le model relax.
>
> Changes from v1:
>
> * Modified v1-0000-cover-letter.patch part of the explanatory content.
>
> Before Modify:
>
> example: __thread int a = 1;
>
> old insn sequence:
>
> lu12i.w $r12,%le_hi20_r(a)
> ori     $r12,$r12,%le_lo12_r(a)
> add.d   $r12,$r12,$r2,%le_add_r(a)
> li.w  	$r13,$r0,1
> stptr.w $r13,$r12,0
>
> new insn sequence:
>
> lu12i.w $r12,%le_hi20_r(a)
> add.d   $r12,$r12,$r2,%le_add_r(a)
> li.w  	$r13,$r0,1
> st.w    $r13,$r12,%le_lo12_r(a)
>
> After Modify:
>
> example: __thread int a = 1;
>
> old insn sequence(at the O0 optimization level):

If the sequence appear only at -O0, is it worth optimizing by relaxation?


>
> lu12i.w $r12,%le_hi20(a)
> ori     $r12,$r12,%le_lo12(a)
> add.d   $r12,$r12,$r2
> addi.w  $r13,$r0,1
> stptr.w $r13,$r12,0
>
> new insn sequence(at the O0 optimization level):
>
> lu12i.w $r12,%le_hi20_r(a)
> add.d   $r12,$r12,$r2,%le_add_r(a)
And here, if the sequence appear in other optimization level, will
register value ($r12) being different between the old sequence and
the new sequence cause other problems, e.g. worse sequence? Have you

tried this relaxation at other optimization levels?


Thanks.

> addi.w  $r13,$r0,1
> st.w    $r13,$r12,%le_lo12_r(a)
>
> changjiachen (5):
>    LoongArch: bfd: Add support for tls le relax.
>    LoongArch: include: Add support for tls le relax.
>    LoongArch: opcodes: Add support for tls le relax.
>    LoongArch: gas: Add support for tls le relax.
>    LoongArch: ld: Add support for tls le relax.
>
>   bfd/bfd-in2.h                                 |   4 +
>   bfd/elfnn-loongarch.c                         |  74 +++++++++
>   bfd/elfxx-loongarch.c                         |  50 ++++++
>   bfd/libbfd.h                                  |   3 +
>   bfd/reloc.c                                   |   6 +
>   gas/config/tc-loongarch.c                     |  12 +-
>   gas/testsuite/gas/loongarch/reloc.d           |  18 +++
>   gas/testsuite/gas/loongarch/reloc.s           |  11 ++
>   include/elf/loongarch.h                       |  13 ++
>   ld/testsuite/ld-loongarch-elf/old-tls-le.s    |  19 +++
>   .../relax-bound-check-tls-le.s                |  48 ++++++
>   .../ld-loongarch-elf/relax-check-tls-le.s     |  43 ++++++
>   ld/testsuite/ld-loongarch-elf/relax-tls-le.s  |  17 ++
>   ld/testsuite/ld-loongarch-elf/relax.exp       | 146 +++++++++++++++++-
>   .../tls-relax-compatible-check-old.s          |  39 +++++
>   opcodes/loongarch-opc.c                       |   1 +
>   16 files changed, 501 insertions(+), 3 deletions(-)
>   create mode 100644 ld/testsuite/ld-loongarch-elf/old-tls-le.s
>   create mode 100644 ld/testsuite/ld-loongarch-elf/relax-bound-check-tls-le.s
>   create mode 100644 ld/testsuite/ld-loongarch-elf/relax-check-tls-le.s
>   create mode 100644 ld/testsuite/ld-loongarch-elf/relax-tls-le.s
>   create mode 100644 ld/testsuite/ld-loongarch-elf/tls-relax-compatible-check-old.s
>


  parent reply	other threads:[~2023-12-04  2:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-02  6:53 changjiachen
2023-12-02  6:53 ` [PATCH v2 1/5] LoongArch: bfd: Add support for tls le relax changjiachen
2023-12-02  7:20   ` Xi Ruoyao
2023-12-02  9:36     ` 常佳琛
2023-12-02  6:53 ` [PATCH v2 2/5] LoongArch: include: " changjiachen
2023-12-02  6:53 ` [PATCH v2 3/5] LoongArch: opcodes: " changjiachen
2023-12-02  7:14   ` Xi Ruoyao
2023-12-02  9:40     ` 常佳琛
2023-12-05  1:36     ` mengqinggang
2023-12-05  3:59       ` Xi Ruoyao
2023-12-05  9:13         ` mengqinggang
2023-12-02  6:53 ` [PATCH v2 4/5] LoongArch: gas: " changjiachen
2023-12-02  6:53 ` [PATCH v2 5/5] LoongArch: ld: " changjiachen
2023-12-02  7:17   ` Xi Ruoyao
2023-12-02  9:30     ` 常佳琛
2023-12-04  2:25 ` Jinyang He [this message]
2023-12-04  3:39   ` Re:Re: [PATCH v2 0/5] LoongArch tls le model linker relaxation support 常佳琛
2023-12-04  8:57     ` Jinyang He
2023-12-04  9:25       ` 常佳琛
2023-12-04  9:37         ` Xi Ruoyao
2023-12-04  9:42           ` Xi Ruoyao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5a46833f-00db-fb85-2723-461caf330263@loongson.cn \
    --to=hejinyang@loongson.cn \
    --cc=Lazy_Linux@126.com \
    --cc=binutils@sourceware.org \
    --cc=cailulu@loongson.cn \
    --cc=changjiachen@stu.xupt.edu.cn \
    --cc=chenglulu@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --cc=liuzhensong@loongson.cn \
    --cc=luweining@loongson.cn \
    --cc=maskray@google.com \
    --cc=mengqinggang@loongson.cn \
    --cc=wanglei@loongson.cn \
    --cc=xry111@xry111.site \
    --cc=xuchenghua@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).