# HG changeset patch # User rkennke # Date 1541590785 -3600 # Wed Nov 07 12:39:45 2018 +0100 # Node ID 454fb9961f0f3d9ea2835da2a4f8c2f820f8315f # Parent b64514ff68fd794e4464c764407a0dd206561855 8213473: Prevent transformation of LoadB->AndI->CmpI pattern to facilitate testb instruction matching diff --git a/src/hotspot/share/opto/mulnode.cpp b/src/hotspot/share/opto/mulnode.cpp --- a/src/hotspot/share/opto/mulnode.cpp +++ b/src/hotspot/share/opto/mulnode.cpp @@ -490,7 +490,10 @@ // Masking sign bits off of a Byte? Do an unsigned byte load plus // an and. - if (lop == Op_LoadB && (mask & 0xFFFFFF00) == 0) { + // Prevent transform if it feeds to CmpI. We have special matcher + // for LoadB+AndI+CmpI that generates a single instruction. + bool feeds_to_cmpi = outcnt() == 1 && unique_out()->Opcode() == Op_CmpI; + if (lop == Op_LoadB && (mask & 0xFFFFFF00) == 0 && !feeds_to_cmpi) { Node* ldub = load->as_Load()->convert_to_unsigned_load(*phase); ldub = phase->transform(ldub); return new AndINode(ldub, phase->intcon(mask));