Mercurial > hg > graal-compiler
changeset 23016:27ee22a166d4
Add foldStamp for AMD64MathIntrinsicNode for cos and sin
author | Gilles Duboscq <gilles.m.duboscq@oracle.com> |
---|---|
date | Wed, 18 Nov 2015 17:49:07 +0100 |
parents | dc609421fcdb |
children | 2b32ccbf4999 |
files | graal/com.oracle.graal.replacements.amd64/src/com/oracle/graal/replacements/amd64/AMD64MathIntrinsicNode.java |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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());