RFR: 8349851: RISCV: Call VM leaf can use movptr2 [v2]

Robbin Ehn rehn at openjdk.org
Wed Feb 12 07:39:08 UTC 2025


On Wed, 12 Feb 2025 06:54:01 GMT, Fei Yang <fyang at openjdk.org> wrote:

> Thanks for the update. Just wonder how many instructions will we save here. I know it will depend on the value of `entry_point`.

I get two versions(I modified these to use t2 so i can easily find them):
###################################################

  0x000074dbeb862742:   lui t2,0x1d3
  0x000074dbeb862746:   addiw t2,t2,1795 # 0x00000000001d3703
  0x000074dbeb86274a:   c.slli  t2,0xd
  0x000074dbeb86274c:   addi  t2,t2,-1155
  0x000074dbeb862750:   c.slli  t2,0xd



  0x000074dbeb862604:   lui t2,0x74dc
  0x000074dbeb862608:   addiw t2,t2,177 # 0x00000000074dc0b1
  0x000074dbeb86260c:   c.slli  t2,0x14

After:
###################################################

  0x00007a0ee4226e0a:   lui t0,0x1e83c
  0x00007a0ee4226e0e:   lui t2,0x111e0
  0x00007a0ee4226e12:   c.slli  t0,0x12
  0x00007a0ee4226e14:   c.add t2,t0


For an out-of-order machine the two lui can be done in parallel, so movptr2 can be constant of e.g. 3 cycles.

lui | lui
slli 
add


For in-order machine some cases may require one additional instruction.
I guess we could create a li48_2 which or something like that.
But to be honest I really hope we are not targeting in-order machines here :)

-------------

PR Comment: https://git.openjdk.org/jdk/pull/23565#issuecomment-2652878689


More information about the hotspot-dev mailing list