-
Enhancement
-
Resolution: Fixed
-
P4
-
12
-
b21
-
x86_64
-
generic
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 example:
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 ((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.
- relates to
-
JDK-8253191 C2: Masked byte comparisons with large masks produce wrong result on x86
-
- Closed
-
-
JDK-8213473 Replace testB_mem_imm matcher with testUB_mem_imm
-
- Resolved
-