RFR: JDK-8213473: Prevent transformation of LoadB->AndI->CmpI pattern to facilitate testb instruction matching
vladimir.kozlov at oracle.com
Thu Nov 8 02:55:16 UTC 2018
Roman, your change seems fine.
I thought for SPARC it may regress but the only complex rule with AndI+LoadUB I found is for ConvI2L:
match(Set dst (ConvI2L (AndI (LoadUB mem) mask)));
I did not find anything on other platforms.
Anyway it would be nice to run some performance testing.
On 11/7/18 3:46 AM, Roman Kennke wrote:
> 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?
More information about the hotspot-compiler-dev