8154122: Intrinsify fused mac operations
authorvdeshpande
Fri, 26 Aug 2016 12:20:09 -0700
changeset 41362 e09e871860a7
parent 41109 a2d5b18586fa
child 41363 95fce77ec1b6
8154122: Intrinsify fused mac operations Summary: added FMA intrinsics on x86 Reviewed-by: kvn, aph, darcy
jdk/src/java.base/share/classes/java/lang/Math.java
jdk/test/java/lang/Math/FusedMultiplyAddTests.java
--- a/jdk/src/java.base/share/classes/java/lang/Math.java	Tue Aug 30 09:30:07 2016 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Math.java	Fri Aug 26 12:20:09 2016 -0700
@@ -1626,7 +1626,7 @@
      *
      * @since 9
      */
-    // @HotSpotIntrinsicCandidate
+    @HotSpotIntrinsicCandidate
     public static double fma(double a, double b, double c) {
         /*
          * Infinity and NaN arithmetic is not quite the same with two
@@ -1743,7 +1743,7 @@
      *
      * @since 9
      */
-    // @HotSpotIntrinsicCandidate
+    @HotSpotIntrinsicCandidate
     public static float fma(float a, float b, float c) {
         /*
          *  Since the double format has more than twice the precision
--- a/jdk/test/java/lang/Math/FusedMultiplyAddTests.java	Tue Aug 30 09:30:07 2016 +0200
+++ b/jdk/test/java/lang/Math/FusedMultiplyAddTests.java	Fri Aug 26 12:20:09 2016 -0700
@@ -221,6 +221,9 @@
 
             {Double.MIN_VALUE, -0.0, +0.0,
              +0.0},
+
+            {1.0+Math.ulp(1.0), 1.0+Math.ulp(1.0), -1.0-2.0*Math.ulp(1.0),
+             Math.ulp(1.0)*Math.ulp(1.0)},
         };
 
         for (double[] testCase: testCases)
@@ -344,6 +347,9 @@
 
             {Float.MAX_VALUE, 2.0f, 1.0f,
              InfinityF},
+
+            {1.0f+Math.ulp(1.0f), 1.0f+Math.ulp(1.0f), -1.0f-2.0f*Math.ulp(1.0f),
+             Math.ulp(1.0f)*Math.ulp(1.0f)},
         };
 
         for (float[] testCase: testCases)