Comments about JDK-8213473: Replace testB_mem_imm matcher with testUB_mem_imm
vladimir.kozlov at oracle.com
Fri Nov 16 16:33:36 UTC 2018
Thank you, Bernard
For signed bytes we should restore signed testB_mem_imm. We can't use unsigned load in such case I think.
On 11/16/18 6:33 AM, Roman Kennke wrote:
> Hi Bernard,
> So either we reinstate the testB pattern, or we make the conversion
> check for sign-extended mask too? Not sure if the latter would be 100%
> correct though.
>> The current fix  for JDK-8213473  replaces 'testB_mem_imm' with
>> 'testUB_mem_imm' in 'x86_64.ad' which is fine for unsigned bytes, for
>> if ((flags & 0x80) != 0) ...
>> But per JLS §5.6.2 & §5.1.2, if we have something like :
>> if ((flags & (byte)0x80) != 0) ...
>> the mask is 32-bit sign-extended and 'LoadB' isn't converted to
>> 'LoadUB' in 'AndINode::Ideal'  which is fine.
>> Unfortunately 'testUB_mem_imm' won't be matched in this case, so I
>> guess we'd need both 'testB_mem_imm' & 'testUB_mem_imm' patterns.
>> If we all agree, I can create a JBS issue and send out a RFR for this?
>>  http://hg.openjdk.java.net/jdk/jdk/rev/656d2f222b42
>>  https://bugs.openjdk.java.net/browse/JDK-8213473
>>  http://hg.openjdk.java.net/jdk/jdk/file/74109912c738/src/jdk.charsets/share/classes/sun/nio/cs/ext/ISO2022_CN.java#l165
>>  http://hg.openjdk.java.net/jdk/jdk/file/74109912c738/src/hotspot/share/opto/mulnode.cpp#l493
More information about the hotspot-dev