conditional move
Deneau, Tom
tom.deneau at amd.com
Wed Jun 19 06:07:07 PDT 2013
Wondering whether anyone knows the reason for the problem below?
For the HSAIL backend, we would like both to emit conditional moves.
Is there a backend property that enables this?
-- Tom
-----Original Message-----
From: Deneau, Tom
Sent: Friday, May 24, 2013 6:42 PM
To: 'Doug Simon'; Frost, Gary
Cc: Lukas Stadler; graal-dev at openjdk.java.net
Subject: RE: conditional move
I noticed that this code emits a Conditional Move node
public int test(int a, int b) {
return (a < b ? 1 : 2);
}
but this one does not
public float test(int a, int b) {
return (a < b ? 1.0f : 2.0f);
}
-- Tom
-----Original Message-----
From: Doug Simon [mailto:doug.simon at oracle.com]
Sent: Friday, May 24, 2013 10:28 AM
To: Frost, Gary
Cc: Lukas Stadler; Deneau, Tom; graal-dev at openjdk.java.net
Subject: Re: conditional move
Yes, because ternaries are compiled by javac as if-statements.
On May 24, 2013, at 5:17 PM, "Frost, Gary" <Gary.Frost at amd.com> wrote:
> 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