# HG changeset patch # User Gilles Duboscq # Date 1447865347 -3600 # Node ID 27ee22a166d4b466adfd2a1627e3c08b55fcfa80 # Parent dc609421fcdb65fd971286193912dfdd01450a32 Add foldStamp for AMD64MathIntrinsicNode for cos and sin diff -r dc609421fcdb -r 27ee22a166d4 graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java --- a/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java Wed Nov 18 17:45:18 2015 +0100 +++ b/graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java Wed Nov 18 17:49:07 2015 +0100 @@ -28,6 +28,7 @@ import com.oracle.graal.compiler.common.type.FloatStamp; import com.oracle.graal.compiler.common.type.PrimitiveStamp; +import com.oracle.graal.compiler.common.type.Stamp; import com.oracle.graal.compiler.common.type.StampFactory; import com.oracle.graal.graph.NodeClass; import com.oracle.graal.graph.spi.CanonicalizerTool; @@ -81,6 +82,20 @@ } @Override + public Stamp foldStamp(Stamp newStamp) { + if (newStamp instanceof FloatStamp) { + FloatStamp floatStamp = (FloatStamp) newStamp; + switch (operation()) { + case COS: + case SIN: + boolean nonNaN = floatStamp.lowerBound() != Double.NEGATIVE_INFINITY && floatStamp.upperBound() != Double.POSITIVE_INFINITY; + return StampFactory.forFloat(JavaKind.Double, -1.0, 1.0, nonNaN); + } + } + return super.foldStamp(newStamp); + } + + @Override public void generate(NodeLIRBuilderTool nodeValueMap, ArithmeticLIRGeneratorTool lirGen) { AMD64ArithmeticLIRGeneratorTool gen = (AMD64ArithmeticLIRGeneratorTool) lirGen; Value input = nodeValueMap.operand(getValue());