Float_conditional.java revision 12651:6ef01bd40ce2
1191882Sed/*
2191882Sed * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
3191882Sed * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4191882Sed *
5191882Sed * This code is free software; you can redistribute it and/or modify it
6191882Sed * under the terms of the GNU General Public License version 2 only, as
7191882Sed * published by the Free Software Foundation.
8191882Sed *
9191882Sed * This code is distributed in the hope that it will be useful, but WITHOUT
10191882Sed * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11191882Sed * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12191882Sed * version 2 for more details (a copy is included in the LICENSE file that
13191882Sed * accompanied this code).
14191882Sed *
15191882Sed * You should have received a copy of the GNU General Public License version
16191882Sed * 2 along with this work; if not, write to the Free Software Foundation,
17191882Sed * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18191882Sed *
19191882Sed * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20191882Sed * or visit www.oracle.com if you need additional information or have any
21191882Sed * questions.
22191882Sed */
23191882Sed/*
24191882Sed */
25191882Sedpackage org.graalvm.compiler.jtt.lang;
26191882Sed
27191882Sedimport org.junit.Test;
28191882Sed
29191882Sedimport org.graalvm.compiler.jtt.bytecode.BC_float_base;
30191882Sed
31191882Sedpublic final class Float_conditional extends BC_float_base {
32191882Sed
33191882Sed    public static float test(float x, float y) {
34191882Sed        if (x == y) {
35191882Sed            return y;
36191882Sed        }
37191882Sed        return x;
38191882Sed    }
39191882Sed
40191882Sed    public static float conditional(float x, float y) {
41191882Sed        return x == y ? x : y;
42191882Sed    }
43191882Sed
44191882Sed    @Test
45191882Sed    public void runEquals() throws Throwable {
46191882Sed        runTest("test", x, y);
47191882Sed    }
48191882Sed
49191882Sed    @Test
50191882Sed    public void runConditional() throws Throwable {
51191882Sed        runTest("conditional", x, y);
52191882Sed    }
53191882Sed}
54191882Sed