39 import org.graalvm.compiler.nodes.NodeView; |
38 import org.graalvm.compiler.nodes.NodeView; |
40 import org.graalvm.compiler.nodes.ValueNode; |
39 import org.graalvm.compiler.nodes.ValueNode; |
41 import org.graalvm.compiler.nodes.util.GraphUtil; |
40 import org.graalvm.compiler.nodes.util.GraphUtil; |
42 import org.graalvm.compiler.options.OptionValues; |
41 import org.graalvm.compiler.options.OptionValues; |
43 |
42 |
44 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_2; |
43 import jdk.vm.ci.meta.ConstantReflectionProvider; |
|
44 import jdk.vm.ci.meta.MetaAccessProvider; |
|
45 import jdk.vm.ci.meta.TriState; |
45 |
46 |
46 @NodeInfo(shortName = "<", cycles = CYCLES_2) |
47 @NodeInfo(shortName = "<", cycles = CYCLES_2) |
47 public final class FloatLessThanNode extends CompareNode { |
48 public final class FloatLessThanNode extends CompareNode { |
48 public static final NodeClass<FloatLessThanNode> TYPE = NodeClass.create(FloatLessThanNode.class); |
49 public static final NodeClass<FloatLessThanNode> TYPE = NodeClass.create(FloatLessThanNode.class); |
49 private static final FloatLessThanOp OP = new FloatLessThanOp(); |
50 private static final FloatLessThanOp OP = new FloatLessThanOp(); |
50 |
51 |
51 public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { |
52 public FloatLessThanNode(ValueNode x, ValueNode y, boolean unorderedIsTrue) { |
52 super(TYPE, Condition.LT, unorderedIsTrue, x, y); |
53 super(TYPE, CanonicalCondition.LT, unorderedIsTrue, x, y); |
53 assert x.stamp(NodeView.DEFAULT) instanceof FloatStamp && y.stamp(NodeView.DEFAULT) instanceof FloatStamp; |
54 assert x.stamp(NodeView.DEFAULT) instanceof FloatStamp && y.stamp(NodeView.DEFAULT) instanceof FloatStamp; |
54 assert x.stamp(NodeView.DEFAULT).isCompatible(y.stamp(NodeView.DEFAULT)); |
55 assert x.stamp(NodeView.DEFAULT).isCompatible(y.stamp(NodeView.DEFAULT)); |
55 } |
56 } |
56 |
57 |
57 public static LogicNode create(ValueNode x, ValueNode y, boolean unorderedIsTrue, NodeView view) { |
58 public static LogicNode create(ValueNode x, ValueNode y, boolean unorderedIsTrue, NodeView view) { |
58 LogicNode result = CompareNode.tryConstantFoldPrimitive(Condition.LT, x, y, unorderedIsTrue, view); |
59 LogicNode result = CompareNode.tryConstantFoldPrimitive(CanonicalCondition.LT, x, y, unorderedIsTrue, view); |
59 if (result != null) { |
60 if (result != null) { |
60 return result; |
61 return result; |
61 } |
62 } |
62 return new FloatLessThanNode(x, y, unorderedIsTrue); |
63 return new FloatLessThanNode(x, y, unorderedIsTrue); |
63 } |
64 } |
64 |
65 |
65 public static LogicNode create(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, |
66 public static LogicNode create(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, |
66 ValueNode x, ValueNode y, boolean unorderedIsTrue, NodeView view) { |
67 ValueNode x, ValueNode y, boolean unorderedIsTrue, NodeView view) { |
67 LogicNode result = OP.canonical(constantReflection, metaAccess, options, smallestCompareWidth, Condition.LT, unorderedIsTrue, x, y, view); |
68 LogicNode result = OP.canonical(constantReflection, metaAccess, options, smallestCompareWidth, CanonicalCondition.LT, unorderedIsTrue, x, y, view); |
68 if (result != null) { |
69 if (result != null) { |
69 return result; |
70 return result; |
70 } |
71 } |
71 return create(x, y, unorderedIsTrue, view); |
72 return create(x, y, unorderedIsTrue, view); |
72 } |
73 } |
73 |
74 |
74 @Override |
75 @Override |
75 public Node canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
76 public Node canonical(CanonicalizerTool tool, ValueNode forX, ValueNode forY) { |
76 NodeView view = NodeView.from(tool); |
77 NodeView view = NodeView.from(tool); |
77 ValueNode value = OP.canonical(tool.getConstantReflection(), tool.getMetaAccess(), tool.getOptions(), tool.smallestCompareWidth(), Condition.LT, unorderedIsTrue, forX, forY, view); |
78 ValueNode value = OP.canonical(tool.getConstantReflection(), tool.getMetaAccess(), tool.getOptions(), tool.smallestCompareWidth(), CanonicalCondition.LT, unorderedIsTrue, forX, forY, view); |
78 if (value != null) { |
79 if (value != null) { |
79 return value; |
80 return value; |
80 } |
81 } |
81 return this; |
82 return this; |
82 } |
83 } |
83 |
84 |
84 public static class FloatLessThanOp extends CompareOp { |
85 public static class FloatLessThanOp extends CompareOp { |
85 |
86 |
86 @Override |
87 @Override |
87 public LogicNode canonical(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, Condition condition, |
88 public LogicNode canonical(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, CanonicalCondition condition, |
88 boolean unorderedIsTrue, ValueNode forX, ValueNode forY, NodeView view) { |
89 boolean unorderedIsTrue, ValueNode forX, ValueNode forY, NodeView view) { |
89 LogicNode result = super.canonical(constantReflection, metaAccess, options, smallestCompareWidth, condition, unorderedIsTrue, forX, forY, view); |
90 LogicNode result = super.canonical(constantReflection, metaAccess, options, smallestCompareWidth, condition, unorderedIsTrue, forX, forY, view); |
90 if (result != null) { |
91 if (result != null) { |
91 return result; |
92 return result; |
92 } |
93 } |