RFR: 8276673: Optimize abs operations in C2 compiler [v4]
Jie Fu
jiefu at openjdk.java.net
Thu Dec 16 08:52:55 UTC 2021
On Wed, 15 Dec 2021 15:02:56 GMT, Fei Gao <fgao at openjdk.org> wrote:
>>> The PR optimizes abs operations in the C2 middle end. Can I have your review please?
>>
>> So what's the performance data before and after this patch?
>> Does it also benefit on x86?
>>
>> It would be better to provide a jmh micro benchmark.
>> Thanks.
>
>> > The PR optimizes abs operations in the C2 middle end. Can I have your review please?
>>
>> So what's the performance data before and after this patch? Does it also benefit on x86?
>>
>> It would be better to provide a jmh micro benchmark. Thanks.
>
> Thanks, @DamonFool . Yes, it's supposed to benefit all archs.
> For example, here is the performance data on x86.
>
> Before the patch:
> Benchmark (seed) Mode Cnt Score Error Units
> MathBench.absConstantInt 0 thrpt 5 291960.380 ± 10724.572 ops/ms
>
> After the patch:
> Benchmark (seed) Mode Cnt Score Error Units
> MathBench.absConstantInt 0 thrpt 5 336271.533 ± 3778.210 ops/ms
>
> The jmh micro benchmark testcase has been added in the latest commit.
Hi @fg1417 ,
Thanks for your update.
Now I see that you are trying to optimize the following three abs() patterns:
1) Math.abs(-38)
2) (char) Math.abs((char) c)
3) Math.abs(0 - x)
But did you see these code patterns in real programs?
I'm a bit worried that we just improve the complexity of C2 with (almost) no performance gain in the real world.
Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/6755
More information about the hotspot-compiler-dev
mailing list