RFR: 8282204: Use lea instructions for arithmetic operations on x86_64 [v4]
Jie Fu
jiefu at openjdk.java.net
Fri Feb 25 07:27:04 UTC 2022
On Thu, 24 Feb 2022 12:16:58 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:
>> Hi,
>>
>> This patch adds several matching rules for x86_64 backend to use `lea` instructions for several fused arithmetic operations. Also, `lea`s don't kill flags and allow different `dst` and `src`, so it is preferred over `sll` if possible, too.
>>
>> Thank you very much.
>
> Quan Anh Mai has updated the pull request incrementally with one additional commit since the last revision:
>
> add benchmark
test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java line 32:
> 30: @BenchmarkMode(Mode.AverageTime)
> 31: @OutputTimeUnit(TimeUnit.NANOSECONDS)
> 32: @Fork(value = 2, jvmArgsAppend = {"-XX:LoopUnrollLimit=1"})
Why we need `-XX:LoopUnrollLimit=1`?
test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java line 43:
> 41: int x = this.x;
> 42: for (int i = 0; i < ITERATION; i++) {
> 43: x = x * 4 + 10;
Do we need `bh.consume(x)` here?
test/micro/org/openjdk/bench/vm/compiler/LeaInstruction.java line 53:
> 51: x = x + y + 10;
> 52: y = x + y + 20;
> 53: bh.consume(x);
I would suggest `bh.consume` to be out of the for loop.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7560
More information about the hotspot-compiler-dev
mailing list