RFR: JDK-8213473: Prevent transformation of LoadB->AndI->CmpI pattern to facilitate testb instruction matching

Roman Kennke rkennke at redhat.com
Wed Nov 7 11:46:48 UTC 2018

In JDK-8203628, Aleksey added matchers to generate testb instruction (on
x86) for LoadB->AndI->CmpI sequence. However, in AndINode::Ideal() we
transform any LoadB->AndI to LoadUB->AndI which fails to match this
pattern. Which means we never actually match for testb. The original
matchers for LoadUB->AndI->CmpI needed to be removed because of

The proposed enhancement would prevent the transformation if we have a
straight LoadB->AndI->CmpI sequence. While the matcher is x86-only, I
don't think it actually hurts to prevent this particular sequence. It
should generate better code (e.g. single testb instructions) for things

byte field;

if ((field & 3) == 0) ..

or even:

if (field == x) .. because we always mask byte loads

or even (not sure) same for boolean fields.


Testing: passes hotspot/jtreg:tier1 here

Thoughts? Reviews?


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/hotspot-compiler-dev/attachments/20181107/97686e5c/signature-0001.asc>

More information about the hotspot-compiler-dev mailing list