src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerEqualsNode.java
changeset 58299 6df94ce3ab2f
parent 54084 84f10bbf993f
equal deleted inserted replaced
58298:0152ad7b38b8 58299:6df94ce3ab2f
   107     }
   107     }
   108 
   108 
   109     public static class IntegerEqualsOp extends CompareOp {
   109     public static class IntegerEqualsOp extends CompareOp {
   110         @Override
   110         @Override
   111         protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
   111         protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth,
   112                         Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
   112                         Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) {
   113             PrimitiveConstant primitive = (PrimitiveConstant) constant;
   113             PrimitiveConstant primitive = (PrimitiveConstant) constant;
   114             ValueNode a = normalizeNode.getX();
       
   115             ValueNode b = normalizeNode.getY();
       
   116             long cst = primitive.asLong();
   114             long cst = primitive.asLong();
   117 
       
   118             if (cst == 0) {
   115             if (cst == 0) {
   119                 if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
   116                 return normalizeNode.createEqualComparison(constantReflection, metaAccess, options, smallestCompareWidth, view);
   120                     return FloatEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
       
   121                 } else {
       
   122                     return IntegerEqualsNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
       
   123                 }
       
   124             } else if (cst == 1) {
   117             } else if (cst == 1) {
   125                 if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
   118                 return normalizeNode.createLowerComparison(true, constantReflection, metaAccess, options, smallestCompareWidth, view);
   126                     return FloatLessThanNode.create(b, a, !normalizeNode.isUnorderedLess, view);
       
   127                 } else {
       
   128                     return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, view);
       
   129                 }
       
   130             } else if (cst == -1) {
   119             } else if (cst == -1) {
   131                 if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) {
   120                 return normalizeNode.createLowerComparison(false, constantReflection, metaAccess, options, smallestCompareWidth, view);
   132                     return FloatLessThanNode.create(a, b, normalizeNode.isUnorderedLess, view);
       
   133                 } else {
       
   134                     return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view);
       
   135                 }
       
   136             } else {
   121             } else {
   137                 return LogicConstantNode.contradiction();
   122                 return LogicConstantNode.contradiction();
   138             }
   123             }
   139         }
   124         }
   140 
   125