1 /* 2 * Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.jtt.bytecode; 24 25 import org.junit.Test; 26 27 import org.graalvm.compiler.jtt.JTTTest; 28 29 /* 30 */ 31 public class BC_fcmp10 extends JTTTest { 32 33 public static boolean test(int x) { 34 float a = 0; 35 float b = 0; 36 switch (x) { 37 case 0: 38 a = Float.POSITIVE_INFINITY; 39 b = 1; 40 break; 41 case 1: 42 a = 1; 43 b = Float.POSITIVE_INFINITY; 44 break; 45 case 2: 46 a = Float.NEGATIVE_INFINITY; 47 b = 1; 48 break; 49 case 3: 50 a = 1; 51 b = Float.NEGATIVE_INFINITY; 52 break; 53 case 4: 54 a = Float.NEGATIVE_INFINITY; 55 b = Float.NEGATIVE_INFINITY; 56 break; 57 case 5: 58 a = Float.NEGATIVE_INFINITY; 59 b = Float.POSITIVE_INFINITY; 60 break; 61 case 6: 62 a = Float.NaN; 63 b = Float.POSITIVE_INFINITY; 64 break; 65 case 7: 66 a = 1; 67 b = Float.NaN; 68 break; 69 case 8: 70 a = 1; 71 b = -0.0f / 0.0f; 72 break; 73 } 74 return a <= b; 75 } 76 77 @Test 78 public void run0() throws Throwable { 79 runTest("test", 0); 80 } 81 82 @Test 83 public void run1() throws Throwable { 84 runTest("test", 1); 85 } 86 87 @Test 88 public void run2() throws Throwable { 89 runTest("test", 2); 90 } 91 92 @Test 93 public void run3() throws Throwable { 94 runTest("test", 3); 95 } 96 97 @Test 98 public void run4() throws Throwable { 99 runTest("test", 4); 100 } 101 102 @Test 103 public void run5() throws Throwable { 104 runTest("test", 5); 105 } 106 107 @Test 108 public void run6() throws Throwable { 109 runTest("test", 6); 110 } 111 112 @Test 113 public void run7() throws Throwable { 114 runTest("test", 7); 115 } 116 117 @Test 118 public void run8() throws Throwable { 119 runTest("test", 8); 120 } 121 122 }