< prev index next >

test/compiler/c2/FloatingPointFoldingTest.java

Print this page
rev 11557 : 8132919: use package in compiler tests
Reviewed-by: duke


   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  */
  24 
  25 /**
  26  * @test
  27  * @bug 8073670
  28  * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
  29  * @run main/othervm -XX:-TieredCompilation -Xcomp -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_double_nan -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_inf -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_zero -XX:CompileCommand=compileonly,FloatingPointFoldingTest.test_float_nan FloatingPointFoldingTest








  30  */
  31 


  32 public class FloatingPointFoldingTest {
  33     // Double values.
  34     public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
  35     public static final double DOUBLE_MINUS_INF = Double.longBitsToDouble(MINUS_INF_LONGBITS);
  36 
  37     public static final long PLUS_INF_LONGBITS = 0x7ff0000000000000L;
  38     public static final double DOUBLE_PLUS_INF = Double.longBitsToDouble(PLUS_INF_LONGBITS);
  39 
  40     public static final long MINUS_ZERO_LONGBITS = 0x8000000000000000L;
  41     public static final double DOUBLE_MINUS_ZERO = Double.longBitsToDouble(MINUS_ZERO_LONGBITS);
  42 
  43     // We need two different NaN values. A floating point number is
  44     // considered to be NaN is the sign bit is 0, all exponent bits
  45     // are set to 1, and at least one bit of the exponent is not zero.
  46     //
  47     // As java.lang.Double.NaN is 0x7ff8000000000000L, we use
  48     // 0x7ffc000000000000L as a second NaN double value.
  49     public static final long NAN_LONGBITS = 0x7ffc000000000000L;
  50     public static final double DOUBLE_NAN = Double.longBitsToDouble(NAN_LONGBITS);
  51 




   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  */
  24 
  25 /**
  26  * @test
  27  * @bug 8073670
  28  * @summary Test that causes C2 to fold two NaNs with different values into a single NaN.
  29  *
  30  * @run main/othervm -XX:-TieredCompilation -Xcomp
  31  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_inf
  32  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_zero
  33  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_double_nan
  34  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_inf
  35  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_zero
  36  *      -XX:CompileCommand=compileonly,compiler.c2.FloatingPointFoldingTest::test_float_nan
  37  *      compiler.c2.FloatingPointFoldingTest
  38  */
  39 
  40 package compiler.c2;
  41 
  42 public class FloatingPointFoldingTest {
  43     // Double values.
  44     public static final long MINUS_INF_LONGBITS = 0xfff0000000000000L;
  45     public static final double DOUBLE_MINUS_INF = Double.longBitsToDouble(MINUS_INF_LONGBITS);
  46 
  47     public static final long PLUS_INF_LONGBITS = 0x7ff0000000000000L;
  48     public static final double DOUBLE_PLUS_INF = Double.longBitsToDouble(PLUS_INF_LONGBITS);
  49 
  50     public static final long MINUS_ZERO_LONGBITS = 0x8000000000000000L;
  51     public static final double DOUBLE_MINUS_ZERO = Double.longBitsToDouble(MINUS_ZERO_LONGBITS);
  52 
  53     // We need two different NaN values. A floating point number is
  54     // considered to be NaN is the sign bit is 0, all exponent bits
  55     // are set to 1, and at least one bit of the exponent is not zero.
  56     //
  57     // As java.lang.Double.NaN is 0x7ff8000000000000L, we use
  58     // 0x7ffc000000000000L as a second NaN double value.
  59     public static final long NAN_LONGBITS = 0x7ffc000000000000L;
  60     public static final double DOUBLE_NAN = Double.longBitsToDouble(NAN_LONGBITS);
  61 


< prev index next >