在 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 via email to