--- /dev/null 2019-01-15 13:37:59.148062718 +0100 +++ new/test/hotspot/jtreg/compiler/floatingpoint/Test8215902.java 2019-01-15 17:16:02.114944577 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.lang.Float; +import java.lang.RuntimeException; + +/* + * @test Test8215902.java + * @bug 8215902 + * @summary Check a known imprecision in Linux ARM softfp implementation. + * @run main Test8215902 + * @author jakvanek + */ +public strictfp class Test8215902 { + private static volatile Float a, b, c; + private static volatile int bC; + + private static final int bA = 0x003fffff; + private static final int bB = 0x00000001; + private static final int bC_OK = 0x00400000; + + public static void main(String... args) { + a = Float.intBitsToFloat(bA); + b = Float.intBitsToFloat(bB); + c = a + b; + bC = Float.floatToRawIntBits(c); + + if (bC == bC_OK) { + System.out.println("Passed."); + } else { + String msg = String.format("Failed.\nResult = 0x%08x|%1.60f\nExpected = 0x%08x|%1.60f", + bC, c, bC_OK, Float.intBitsToFloat(bC_OK)); + throw new RuntimeException(msg); + } + } +} +