RFR: 8216392: Enable cmovP_mem and cmovP_memU instructions

Andrew Dinn adinn at redhat.com
Mon Jan 14 09:55:59 UTC 2019

On 09/01/2019 12:13, Roman Kennke wrote:
> While poking around x86_64.ad's cmovP instructions (because I needed it
> for an experiment in Shenandoah), I noticed that 2 of them are
> disabled/commented-out:  cmovP_mem and  cmovP_memU. This means that a
> cmovp with a 2nd argument that is a LoadP will generate two instructions:
> mov %r1, $mem
> cmov %r2, %1
> instead of just one:
> cmov %r2, $mem
> The comment there says that adlc doesn't compute the bottom-type
> correctly, and that implicit null-checking is broken, but I couldn't
> confirm either of those. I checked hg annotate, but the commented-out
> block stems from revision #1 and cannot be traced to a bug or so.

I'm not an expert on aldc but I suspect that the first comment cannot
simply be ignored -- even if it appears to work in the cases you have tried.

adlc needs to know bottom types both for memory nodes and for machine
nodes which coalesce memory ops via rule reductions. This is necessary
in order to ensure that ops which affect the same memory slices are
scheduled in the correct order.

Code in files output_h.cpp ad output_c.cpp generates implementations of
a virtual method that retrieves the bottom type for such nodes. CMoveP
instructions are handled as a special case (in output_h.cpp) by
computing the meet of the bottom types of the first and second ins for
the associated node.

That's ok when the ins correspond to standard form inputs. However, I'm
not sure it will correctly handle a rule containing a rule with a memory
form input. Memory inputs are a fiction which corresponds to more than
one in node. I think this may end up computing the bottom type using the
bottom type of the base address without taking into account any offset.
That might well cause nasty errors in the computation of some types.

Perhaps someone from the compiler team can comment on this?


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander

More information about the hotspot-compiler-dev mailing list