RFR: 8283694: Improve bit manipulation and boolean to integer conversion operations on x86_64 [v7]

Dean Long dlong at openjdk.java.net
Fri Jun 3 15:40:38 UTC 2022


On Fri, 3 Jun 2022 10:21:49 GMT, Quan Anh Mai <duke at openjdk.java.net> wrote:

>> src/hotspot/cpu/x86/x86_64.ad line 10766:
>> 
>>> 10764:   format %{ "xorl    $dst, $dst\t# ci2b\n\t"
>>> 10765:             "testl   $src, $src\n\t"
>>> 10766:             "setnz   $dst" %}
>> 
>> What's the advantage of this change?  The disadvantage is a spare TEMP register is needed -- we can't reuse src as dst.
>
> Yes you are right, the change reduces 1 cycle of latency but may require another register so I reverted it. Thanks a lot.

Does this pattern give any improvement?

testl $src, $src
movl $dst, 0
setnz $dst

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

PR: https://git.openjdk.java.net/jdk/pull/7968


More information about the hotspot-compiler-dev mailing list