RFR: 8320448: Accelerate IndexOf using AVX2 [v33]

Scott Gibbons sgibbons at openjdk.org
Fri May 24 15:36:12 UTC 2024


On Fri, 24 May 2024 14:49:05 GMT, Daniel Jeliński <djelinski at openjdk.org> wrote:

>> Just did the experiment and it turns out that `mov64(r15, (int64_t)small_jump_table)` and `lea(r15, ExternalAddress(small_jump_table))` produce exactly the same code:
>> 
>> `0x00007fffe463d68b:  49 bf a0 d5 63 e4 ff 7f 00 00   movabs r15,0x7fffe463d5a0`
>> 
>> The code in `MacroAssembler` for `lea` calls `mov_literal64` with no check for whether it can be ip-relative.
>> 
>> I tried doing it myself via `leaq(r15, Address(rip, (int64_t)small_jump_table - (int64_t)(__ pc())))` but there is no definition in `register_x86.hpp` for register `rip`.  So I'm not sure exactly how to produce RIP-relative addressing.
>
> Thanks for checking. Well I know that the `MacroAssembler::movdqu(XMMRegister dst, AddressLiteral src, Register rscratch)` method actually generates rip-relative addresses. Maybe we could copy some of that code.

Changed to `lea` with `InternalAddress()`.  Generates the exact same code, but makes more sense.  I looked at `movdqu` and see no code that generates RIP-relative loads.  It merely checks `reachable()` and adds an intermediate `lea` if not reachable.  @djelinski can you clarify please?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16753#discussion_r1613665756


More information about the core-libs-dev mailing list