001/* 002 * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.nodes.calc; 024 025import jdk.internal.jvmci.common.*; 026import jdk.internal.jvmci.meta.*; 027 028import com.oracle.graal.compiler.common.calc.*; 029import com.oracle.graal.compiler.common.type.*; 030import com.oracle.graal.graph.*; 031import com.oracle.graal.graph.spi.*; 032import com.oracle.graal.nodeinfo.*; 033import com.oracle.graal.nodes.*; 034import com.oracle.graal.nodes.util.*; 035 036@NodeInfo(shortName = "<") 037public final class FloatLessThanNode extends CompareNode { 038 public static final NodeClass<FloatLessThanNode> TYPE = NodeClass.create(FloatLessThanNode.class); 039 040 public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { 041 super(TYPE, Condition.LT, unorderedIsTrue, x, y); 042 assert x.stamp() instanceof FloatStamp && y.stamp() instanceof FloatStamp; 043 assert x.stamp().isCompatible(y.stamp()); 044 } 045 046 public static LogicNode create(ValueNode x, ValueNode y, boolean unorderedIsTrue, ConstantReflectionProvider constantReflection) { 047 LogicNode result = CompareNode.tryConstantFold(Condition.LT, x, y, constantReflection, unorderedIsTrue); 048 if (result != null) { 049 return result; 050 } else { 051 return new FloatLessThanNode(x, y, unorderedIsTrue); 052 } 053 } 054 055 @Override 056 public ValueNode canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { 057 ValueNode result = super.canonical(tool, forX, forY); 058 if (result != this) { 059 return result; 060 } 061 if (GraphUtil.unproxify(forX) == GraphUtil.unproxify(forY) && !unorderedIsTrue()) { 062 return LogicConstantNode.contradiction(); 063 } 064 return this; 065 } 066 067 @Override 068 protected CompareNode duplicateModified(ValueNode newX, ValueNode newY) { 069 if (newX.stamp() instanceof FloatStamp && newY.stamp() instanceof FloatStamp) { 070 return new FloatLessThanNode(newX, newY, unorderedIsTrue); 071 } else if (newX.stamp() instanceof IntegerStamp && newY.stamp() instanceof IntegerStamp) { 072 return new IntegerLessThanNode(newX, newY); 073 } 074 throw JVMCIError.shouldNotReachHere(); 075 } 076 077 @Override 078 public Stamp getSucceedingStampForX(boolean negated) { 079 return null; 080 } 081 082 @Override 083 public Stamp getSucceedingStampForY(boolean negated) { 084 return null; 085 } 086 087 @Override 088 public TriState tryFold(Stamp xStampGeneric, Stamp yStampGeneric) { 089 return TriState.UNKNOWN; 090 } 091}