RFR: 8265491: Math Signum optimization for x86 [v2]

Marcus G K Williams github.com+168222+mgkwill at openjdk.java.net
Wed Apr 21 18:44:19 UTC 2021


On Wed, 21 Apr 2021 03:56:44 GMT, Jie Fu <jiefu at openjdk.org> wrote:

>> Marcus G K Williams has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add os.arch=="i386" to signum jtreg
>>   
>>   Signed-off-by: Marcus G K Williams <marcus.williams at intel.com>
>
> src/hotspot/cpu/x86/x86.ad line 5788:
> 
>> 5786: 
>> 5787:     __ ucomiss($dst$$XMMRegister, $zero$$XMMRegister);
>> 5788:     __ jcc(Assembler::parity, exit);
> 
> How about checking equal first and then parity?
> 
> I think the unordered case is rare in real programs.

+1

> src/hotspot/cpu/x86/x86.ad line 5792:
> 
>> 5790:     __ movflt($dst$$XMMRegister, $one$$XMMRegister);
>> 5791:     __ jcc(Assembler::above, exit);
>> 5792:     __ movflt($dst$$XMMRegister, $zero$$XMMRegister);
> 
> Is it possible to use just one instruction to assign -1 to $dst?
> 
> Maybe, you can try to follow negF_reg/negF_reg_reg.

Good idea. Changed to use `xorps($dst$$XMMRegister, ExternalAddress(float_signflip()));` and `xorpd($dst$$XMMRegister, ExternalAddress(double_signflip()));`

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

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


More information about the hotspot-compiler-dev mailing list