# HG changeset patch # User Doug Simon # Date 1426170029 -3600 # Node ID 0a3c6e786b40a0b22fc86933165a806a5d02a1dc # Parent 35f3381375de061c1a02b0ea58fa867ef86a9f08 added test for Math.pow() intrinsic diff -r 35f3381375de -r 0a3c6e786b40 graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java --- a/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Thu Mar 12 15:19:56 2015 +0100 +++ b/graal/com.oracle.graal.replacements.test/src/com/oracle/graal/replacements/test/StandardMethodSubstitutionsTest.java Thu Mar 12 15:20:29 2015 +0100 @@ -54,45 +54,57 @@ test("mathSin", value); test("mathSqrt", value); test("mathTan", value); + test("mathPow", value); test("mathAll", value); } - @SuppressWarnings("all") + @Test + public void testMathPow() { + double a = 34567.891D; + double b = 4.6D; + for (int i = 0; i < 10000; i++) { + a = mathPow(a, b); + a = StrictMath.pow(a, b); + } + test("mathPow", a, b); + } + + public static double mathPow(double a, double b) { + return mathPow0(a, b); + } + + public static double mathPow0(double a, double b) { + return Math.pow(a, b); + } + public static double mathAbs(double value) { return Math.abs(value); } - @SuppressWarnings("all") public static double mathSqrt(double value) { return Math.sqrt(value); } - @SuppressWarnings("all") public static double mathLog(double value) { return Math.log(value); } - @SuppressWarnings("all") public static double mathLog10(double value) { return Math.log10(value); } - @SuppressWarnings("all") public static double mathSin(double value) { return Math.sin(value); } - @SuppressWarnings("all") public static double mathCos(double value) { return Math.cos(value); } - @SuppressWarnings("all") public static double mathTan(double value) { return Math.tan(value); } - @SuppressWarnings("all") public static double mathAll(double value) { return Math.sqrt(value) + Math.log(value) + Math.log10(value) + Math.sin(value) + Math.cos(value) + Math.tan(value); } @@ -130,22 +142,18 @@ testSubstitution("integerBitCount", BitCountNode.class, Integer.class, "bitCount", true, args); } - @SuppressWarnings("all") public static int integerReverseBytes(int value) { return Integer.reverseBytes(value); } - @SuppressWarnings("all") public static int integerNumberOfLeadingZeros(int value) { return Integer.numberOfLeadingZeros(value); } - @SuppressWarnings("all") public static int integerNumberOfTrailingZeros(int value) { return Integer.numberOfTrailingZeros(value); } - @SuppressWarnings("all") public static int integerBitCount(int value) { return Integer.bitCount(value); } @@ -160,22 +168,18 @@ testSubstitution("longBitCount", BitCountNode.class, Long.class, "bitCount", true, args); } - @SuppressWarnings("all") public static long longReverseBytes(long value) { return Long.reverseBytes(value); } - @SuppressWarnings("all") public static int longNumberOfLeadingZeros(long value) { return Long.numberOfLeadingZeros(value); } - @SuppressWarnings("all") public static int longNumberOfTrailingZeros(long value) { return Long.numberOfTrailingZeros(value); } - @SuppressWarnings("all") public static int longBitCount(long value) { return Long.bitCount(value); } @@ -186,12 +190,10 @@ testGraph("intBitsToFloat"); } - @SuppressWarnings("all") public static int floatToIntBits(float value) { return Float.floatToIntBits(value); } - @SuppressWarnings("all") public static float intBitsToFloat(int value) { return Float.intBitsToFloat(value); } @@ -202,22 +204,18 @@ testGraph("longBitsToDouble"); } - @SuppressWarnings("all") public static long doubleToLongBits(double value) { return Double.doubleToLongBits(value); } - @SuppressWarnings("all") public static double longBitsToDouble(long value) { return Double.longBitsToDouble(value); } - @SuppressWarnings("all") public static boolean isInstance(Class clazz, Object object) { return clazz.isInstance(object); } - @SuppressWarnings("all") public static boolean isAssignableFrom(Class clazz, Class other) { return clazz.isAssignableFrom(other); }