< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/calc/IntegerLessThanNode.java

Print this page
rev 56282 : [mq]: graal

*** 112,122 **** throw GraalError.shouldNotReachHere(); } @Override protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, ! Constant constant, NormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) { PrimitiveConstant primitive = (PrimitiveConstant) constant; /* @formatter:off * a NC b < c (not mirrored) * cases for c: * 0 -> a < b --- 112,122 ---- throw GraalError.shouldNotReachHere(); } @Override protected LogicNode optimizeNormalizeCompare(ConstantReflectionProvider constantReflection, MetaAccessProvider metaAccess, OptionValues options, Integer smallestCompareWidth, ! Constant constant, AbstractNormalizeCompareNode normalizeNode, boolean mirrored, NodeView view) { PrimitiveConstant primitive = (PrimitiveConstant) constant; /* @formatter:off * a NC b < c (not mirrored) * cases for c: * 0 -> a < b
*** 134,162 **** * unordered-is-less means unordered-is-false. * * We can handle mirroring by swapping a & b and negating the constant. * @formatter:on */ - ValueNode a = mirrored ? normalizeNode.getY() : normalizeNode.getX(); - ValueNode b = mirrored ? normalizeNode.getX() : normalizeNode.getY(); long cst = mirrored ? -primitive.asLong() : primitive.asLong(); if (cst == 0) { ! if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) { ! return FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, mirrored ^ normalizeNode.isUnorderedLess, view); ! } else { ! return IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, a, b, view); ! } } else if (cst == 1) { // a <= b <=> !(a > b) - LogicNode compare; - if (normalizeNode.getX().getStackKind() == JavaKind.Double || normalizeNode.getX().getStackKind() == JavaKind.Float) { // since we negate, we have to reverse the unordered result ! compare = FloatLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, mirrored == normalizeNode.isUnorderedLess, view); ! } else { ! compare = IntegerLessThanNode.create(constantReflection, metaAccess, options, smallestCompareWidth, b, a, view); ! } return LogicNegationNode.create(compare); } else if (cst <= -1) { return LogicConstantNode.contradiction(); } else { assert cst >= 2; --- 134,151 ---- * unordered-is-less means unordered-is-false. * * We can handle mirroring by swapping a & b and negating the constant. * @formatter:on */ long cst = mirrored ? -primitive.asLong() : primitive.asLong(); if (cst == 0) { ! return normalizeNode.createLowerComparison(mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view); } else if (cst == 1) { // a <= b <=> !(a > b) // since we negate, we have to reverse the unordered result ! LogicNode compare = normalizeNode.createLowerComparison(!mirrored, constantReflection, metaAccess, options, smallestCompareWidth, view); return LogicNegationNode.create(compare); } else if (cst <= -1) { return LogicConstantNode.contradiction(); } else { assert cst >= 2;
< prev index next >