RFR: 8282204: Use lea instructions for arithmetic operations on x86_64 [v2]
Quan Anh Mai
duke at openjdk.java.net
Wed Feb 23 12:25:49 UTC 2022
On Tue, 22 Feb 2022 17:15:33 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>>
>> decoder, format
>
> What benefits you have with these changes in real world?
> It could be fine to use `lea` for merging several instruction, as you did.
> But last time I was told that `lea` instruction has larger latency than shift instruction because it uses addressing module in CPU. I am not sure it is fine to replace it.
> Also why you removed match rule which moved result of `Add` to different register?
@vnkozlov Given `lea` is a really efficient instruction, merging multiple ones into it offers a lot of benefits and all other compilers do so.
The removed match rule seems to never match and it does not perform better than a `mov` + `add` since a `mov` is often elided and an `add` may be executed on more ports than a `lea`.
I have added predicate conditions to address your concerns regarding different execution unit.
@TobiHartmann Actually they are similar, if you force the `src` and `dst` to be different (by calling convention), other compilers would produce a `lea` on O3. But a base-less `lea` is large in size so I revert that change.
Thank you very much.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7560
More information about the hotspot-compiler-dev
mailing list