condition flags USE in AD instruct

Tom Rodriguez Thomas.Rodriguez at Sun.COM
Tue Apr 14 12:42:45 PDT 2009


Matching Bools and Cmps is kind of special.  All Ifs start out looking  
like (If (Bool (Cmp)) but before matching they are converted to (If  
(Bool (Cmp)) (Cmp)) so that they Bool and Cmp can be matched  
together.  The reason for this is that C2 separates the comparison  
operation from the interpretation of those results.  I don't know the  
full history of this but I assume it's to encourage GVN on the  
compares which collects together code that compares the same values  
but asks different questions about them.  So if you want to use the  
result of a compare in an AddcI I think you need to use that same  
logic.  In particular you need to modify Matcher::find_shared to do  
some variation of the Alt_Post_Visit logic on your AddcI to add an  
input for the Cmp and shove it into a BinaryNode so you can match  
using (Set dst (AddcI (Binary cop cr) (Binary dst src))).

tom

On Apr 14, 2009, at 11:24 AM, Christian Thalinger wrote:

> On Tue, 2009-04-14 at 11:18 -0700, Tom Rodriguez wrote:
>> On Apr 14, 2009, at 11:07 AM, Tom Rodriguez wrote:
>>
>>> What's it look like?  You can USE something that isn't mentioned in
>>> the match rule.  A USE has to an
>>
>>                            ^can't
>> tom
>>
>>> input to the underlying MachNode and if it's not mentioned in the
>>> match rule then it's not an input.
>
> That seems to be the problem, it's not in the match rule:
>
> instruct addcI_rReg_imm(rRegI dst, immI src, rFlagsReg cr, cmpOp cop)
> %{
>  match(Set dst (AddcI cop (Binary dst src)));
>  effect(USE_KILL cr);
>
> Can I add a dummy input for cr in the match rule?
>
> -- Christian
>




More information about the hotspot-compiler-dev mailing list