conditional move

Frost, Gary Gary.Frost at amd.com
Fri May 24 08:17:47 PDT 2013


Presumably, ternaries are good candidates for this. 

boolean isOdd(int i){
    boolean odd=((i%2)!=0)?0:1;
    return odd;
}

-----Original Message-----
From: graal-dev-bounces at openjdk.java.net [mailto:graal-dev-bounces at openjdk.java.net] On Behalf Of Lukas Stadler
Sent: Friday, May 24, 2013 3:51 AM
To: Deneau, Tom
Cc: graal-dev at openjdk.java.net
Subject: Re: conditional move

The ConditionalNode is most of the time not created by the GraphBuilder directly, but it will appear later when a simple if/then/else is canonicalized.
So a simple snippet that boils down to a conditional move could look like this:

public static int testSnippet(int i) {
  if (i == 0) {
    return 1;
  } else {
    return 2;
  }
}

- Lukas


On May 24, 2013, at 1:04 AM, "Deneau, Tom" <tom.deneau at amd.com> wrote:

> While compiling a larger chunk of code we were handed a 
> ConditionalMove node (which we have not implemented yet).  I would 
> like to make a smaller test case for this but java patterns that I 
> thought would be mapping to conditional move aren't doing so.  What 
> would be a typical small test case for generating the ConditionalMove node?
> 
> -- Tom Deneau
> 





More information about the graal-dev mailing list