changeset 19934:c7caa3f463e3

FloatStamp.Abs.foldStamp support known-NaN input
author Gilles Duboscq <gilles.m.duboscq@oracle.com>
date Wed, 18 Mar 2015 15:58:55 +0100
parents f599ac162bb7
children ed3e144ced29
files graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java	Wed Mar 18 15:51:15 2015 +0100
+++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/FloatStamp.java	Wed Mar 18 15:58:55 2015 +0100
@@ -131,6 +131,10 @@
         return nonNaN;
     }
 
+    public boolean isNaN() {
+        return Double.isNaN(lowerBound);
+    }
+
     public boolean isUnrestricted() {
         return lowerBound == Double.NEGATIVE_INFINITY && upperBound == Double.POSITIVE_INFINITY && !nonNaN;
     }
@@ -630,6 +634,9 @@
         @Override
         public Stamp foldStamp(Stamp s) {
             FloatStamp stamp = (FloatStamp) s;
+            if (stamp.isNaN()) {
+                return stamp;
+            }
             return new FloatStamp(stamp.getBits(), 0, Math.max(-stamp.lowerBound(), stamp.upperBound()), stamp.isNonNaN());
         }
     },