public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Lulu Cheng <chenglulu@loongson.cn>
To: Xi Ruoyao <xry111@xry111.site>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Cc: Chenghua Xu <xuchenghua@loongson.cn>,
	Youling Tang <tangyouling@loongson.cn>,
	Huacai Chen <chenhuacai@kernel.org>,
	Jinyang He <hejinyang@loongson.cn>, Wang Xuerui <i@xen0n.name>
Subject: Re: 回复:[PATCH v5] LoongArch: add movable attribute
Date: Fri, 5 Aug 2022 10:38:23 +0800	[thread overview]
Message-ID: <fd65af70-ee83-c15a-5be6-ca63cee509b7@loongson.cn> (raw)
In-Reply-To: <60bac545a09ee202d41421a596ac64a4cb83d89c.camel@xry111.site>


在 2022/8/5 上午9:28, Xi Ruoyao 写道:
> On Fri, 2022-08-05 at 09:05 +0800, Lulu Cheng wrote:
>> I'm working on the implementation of specifing attributes of variables for other architectures.
>> If the address is obtained through the GOT table and 4 instructions, there is not much difference in performance.
> In this case I still prefer a GOT table entry because for 4-instruction
> absolute addressing sequence we'll need to implement 4 new relocation
> types in the kernel module loader.

If it is accessed through the GOT table, dynamic relocation is required 
when the module is loaded. And accessing the got table may have a cache 
miss.

>> Is it more reasonable for us to refer to the implementation of the model attribute under the IA64 architecture?
> Maybe we can use "model(got)", "model(abs)", "model(pcrel)" etc.

We have a set of instruction implementations that can get a relative pc 
64-bit offset:

   "pcalau12i %1,%%pc_hi20(%3);"

   "addi.d %2,$r0,%%pc_lo12(%3);"
   "lu32i.d %2,%%pc64_lo20(%3);"
   "lu52i.d %2,%2,%%pc64_hi12(%3);"

   "add.d %1,%1,%2;",

This set of instructions can be selected according to the size of the 
offset:

   "pcalau12i %1,%%pc_hi20(%3);"

   "addi.d %2,$r0,%%pc_lo12(%3);"

   "lu32i.d %2,%%pc64_lo20(%3);"

   "add.d %1,%1,%2;",

for offset within signed 52 bits.

or

   "pcalau12i %1,%%pc_hi20(%3);"

   "addi.d %2,$r0,%%pc_lo12(%3);"
   "lu32i.d %2,%%pc64_lo20(%3);"
   "lu52i.d %2,%2,%%pc64_hi12(%3);"

   "add.d %1,%1,%2;"

for offset within signed 64 bits.

So my idea is "model(normal)","model (large)" etc.

>> I will compare the performance of the two soon. Do you know the approximate release date of GCC 12.2?
>> I also want to fix this before 12.2 is released.
> GCC 12.2 rc1 will be frozen on Aug 12th.
>


  reply	other threads:[~2022-08-05  2:38 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 14:22 [PATCH] LoongArch: add addr_global attribute Xi Ruoyao
2022-07-29 15:31 ` [PATCH v2] " Xi Ruoyao
2022-07-29 17:17   ` [PATCH v3] " Xi Ruoyao
2022-07-30  3:13     ` Lulu Cheng
2022-07-30  6:03       ` Huacai Chen
2022-07-31  9:05     ` Chenghua Xu
2022-08-01 10:04       ` [PATCH v4] LoongArch: add movable attribute Xi Ruoyao
2022-08-01 10:07         ` [PATCH v5] " Xi Ruoyao
2022-08-03  1:36           ` Xi Ruoyao
2022-08-03  2:59             ` WANG Xuerui
2022-08-03  3:15               ` Xi Ruoyao
     [not found]             ` <-2muj1c-68saz6jhkcyw3jo1xp-1mgcvnkbqi2wjp6tue-qsso54-emxgu3-k85590-kpgox7-w67u6h3cai1l-5bi887dsgzsu-g4d7i7-wl316qxrucx4kv4on7-mnna36-iremg8-nwc5ot-9041t2-hu8nsl.1659495047941@email.android.com>
2022-08-03  3:10               ` 回复:[PATCH " Xi Ruoyao
2022-08-04  7:47                 ` Xi Ruoyao
2022-08-05  1:05                   ` Lulu Cheng
2022-08-05  1:28                     ` Xi Ruoyao
2022-08-05  2:38                       ` Lulu Cheng [this message]
2022-08-05  2:51                         ` Xi Ruoyao
2022-08-05  3:34                           ` Xi Ruoyao
2022-08-05  3:45                             ` Xi Ruoyao
2022-08-05  4:01                               ` Lulu Cheng
2022-08-05  6:03                                 ` Xi Ruoyao
2022-08-05  7:19                                   ` Lulu Cheng
2022-08-05  7:41                                     ` WANG Xuerui
2022-08-05  7:58                                       ` Lulu Cheng
2022-08-05  9:53                                         ` Xi Ruoyao
2022-08-08  4:53                                           ` Lulu Cheng
2022-08-09 11:30                                             ` Xi Ruoyao
2022-08-09 13:03                                               ` Lulu Cheng
2022-08-09 14:04                                                 ` 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=fd65af70-ee83-c15a-5be6-ca63cee509b7@loongson.cn \
    --to=chenglulu@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hejinyang@loongson.cn \
    --cc=i@xen0n.name \
    --cc=tangyouling@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).