public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: chenglulu <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>,
	mengqinggang <mengqinggang@loongson.cn>,
	gcc-patches@gcc.gnu.org
Cc: xuchenghua@loongson.cn, cailulu@loongson.cn, i.swmail@xen0n.name,
	maskray@google.com, luweining@loongson.cn, wanglei@loongson.cn,
	hejinyang@loongson.cn
Subject: Re: [PATCH v5] LoongArch: Add support for TLS descriptors
Date: Tue, 2 Apr 2024 09:09:50 +0800	[thread overview]
Message-ID: <01df8521-9bd9-2650-52ff-9b398d4b57b9@loongson.cn> (raw)
In-Reply-To: <84becac336d760701ec31f0f27e64c82efacc9f4.camel@xry111.site>


在 2024/4/1 下午9:51, Xi Ruoyao 写道:
> Is this patch targeting GCC 14 or 15?  If 14 I guess we'd commit now...
>
> Generally we don't add features in stage 4, but if we keep trad as the
> default I think it'd be OK.  And RISC-V guys plan to push their TLS desc
> implementation this week too.

I've rebase the code to the latest commit, and if the test is okay I'll 
bring it up right away.

Thanks!:-)

>
> On Tue, 2024-03-19 at 09:54 +0800, mengqinggang wrote:
>> Add support for TLS descriptors on normal code model and extreme code model.
>>
>> Normal code model instruction sequence:
>>    -mno-explicit-relocs:
>>      la.tls.desc	$r4, s
>>      add.d	$r12, $r4, $r2
>>    -mexplicit-relocs:
>>      pcalau12i	$r4,%desc_pc_hi20(s)
>>      addi.d	$r4,$r4,%desc_pc_lo12(s)
>>      ld.d	$r1,$r4,%desc_ld(s)
>>      jirl	$r1,$r1,%desc_call(s)
>>      add.d	$r12, $r4, $r2
>>
>> Extreme code model instruction sequence:
>>    -mno-explicit-relocs:
>>      la.tls.desc	$r4, $r12, s
>>      add.d	$r12, $r4, $r2
>>    -mexplicit-relocs:
>>      pcalau12i	$r4,%desc_pc_hi20(s)
>>      addi.d	$r12,$r0,%desc_pc_lo12(s)
>>      lu32i.d	$r12,%desc64_pc_lo20(s)
>>      lu52i.d	$r12,$r12,%desc64_pc_hi12(s)
>>      add.d	$r4,$r4,$r12
>>      ld.d	$r1,$r4,%desc_ld(s)
>>      jirl	$r1,$r1,%desc_call(s)
>>      add.d	$r12, $r4, $r2
>>
>> The default is still traditional TLS model, but can be configured with
>> --with-tls={trad,desc}. The default can change to TLS descriptors once
>> libc and LLVM support this.
>>
>> gcc/ChangeLog:
>>
>> 	* config.gcc: Add --with-tls option to change TLS flavor.
>> 	* config/loongarch/genopts/loongarch.opt.in: Add -mtls-dialect to
>> 	configure TLS flavor.
>> 	* config/loongarch/loongarch-def.h (struct loongarch_target): Add
>> 	tls_dialect.
>> 	* config/loongarch/loongarch-driver.cc (la_driver_init): Add tls
>> 	flavor.
>> 	* config/loongarch/loongarch-opts.cc (loongarch_init_target): Add
>> 	tls_dialect.
>> 	(loongarch_config_target): Ditto.
>> 	(loongarch_update_gcc_opt_status): Ditto.
>> 	* config/loongarch/loongarch-opts.h (loongarch_init_target):Ditto.
>> 	(TARGET_TLS_DESC): New define.
>> 	* config/loongarch/loongarch.cc (loongarch_symbol_insns): Add TLS DESC
>> 	instructions sequence length.
>> 	(loongarch_legitimize_tls_address): New TLS DESC instruction sequence.
>> 	(loongarch_option_override_internal): Add la_opt_tls_dialect.
>> 	(loongarch_option_restore): Add la_target.tls_dialect.
>> 	* config/loongarch/loongarch.md (@got_load_tls_desc<mode>): Normal
>> 	code model for TLS DESC.
>> 	(got_load_tls_desc_off64): Extreme code model for TLS DESC.
>> 	* config/loongarch/loongarch.opt: Regenerated.
>>
>> gcc/testsuite/ChangeLog:
>>
>> 	* gcc.target/loongarch/cmodel-extreme-1.c: Add -mtls-dialect=trad.
>> 	* gcc.target/loongarch/cmodel-extreme-2.c: Ditto.
>> 	* gcc.target/loongarch/explicit-relocs-auto-tls-ld-gd.c: Ditto.
>> 	* gcc.target/loongarch/explicit-relocs-medium-call36-auto-tls-ld-gd.c:
>> 	Ditto.
>> 	* gcc.target/loongarch/func-call-medium-1.c: Ditto.
>> 	* gcc.target/loongarch/func-call-medium-2.c: Ditto.
>> 	* gcc.target/loongarch/func-call-medium-3.c: Ditto.
>> 	* gcc.target/loongarch/func-call-medium-4.c: Ditto.
>> 	* gcc.target/loongarch/tls-extreme-macro.c: Ditto.
>> 	* gcc.target/loongarch/tls-gd-noplt.c: Ditto.
>> 	* gcc.target/loongarch/explicit-relocs-auto-extreme-tls-desc.c: New test.
>> 	* gcc.target/loongarch/explicit-relocs-auto-tls-desc.c: New test.
>> 	* gcc.target/loongarch/explicit-relocs-extreme-tls-desc.c: New test.
>> 	* gcc.target/loongarch/explicit-relocs-tls-desc.c: New test.
>>
>> Co-authored-by: Lulu Cheng <chenglulu@loongson.cn>
>> Co-authored-by: Xi Ruoyao <xry111@xry111.site>


  reply	other threads:[~2024-04-02  1:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-19  1:54 mengqinggang
2024-04-01 13:51 ` Xi Ruoyao
2024-04-02  1:09   ` chenglulu [this message]
2024-04-02  6:14 ` [pushed][PATCH " chenglulu

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=01df8521-9bd9-2650-52ff-9b398d4b57b9@loongson.cn \
    --to=chenglulu@loongson.cn \
    --cc=cailulu@loongson.cn \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hejinyang@loongson.cn \
    --cc=i.swmail@xen0n.name \
    --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).