< prev index next >

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

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 42,52 **** @NodeInfo(shortName = "/") public class SignedDivNode extends IntegerDivRemNode implements LIRLowerable { public static final NodeClass<SignedDivNode> TYPE = NodeClass.create(SignedDivNode.class); ! protected SignedDivNode(ValueNode x, ValueNode y, GuardingNode zeroCheck) { this(TYPE, x, y, zeroCheck); } protected SignedDivNode(NodeClass<? extends SignedDivNode> c, ValueNode x, ValueNode y, GuardingNode zeroCheck) { super(c, IntegerStamp.OPS.getDiv().foldStamp(x.stamp(NodeView.DEFAULT), y.stamp(NodeView.DEFAULT)), Op.DIV, Type.SIGNED, x, y, zeroCheck); --- 42,52 ---- @NodeInfo(shortName = "/") public class SignedDivNode extends IntegerDivRemNode implements LIRLowerable { public static final NodeClass<SignedDivNode> TYPE = NodeClass.create(SignedDivNode.class); ! public SignedDivNode(ValueNode x, ValueNode y, GuardingNode zeroCheck) { this(TYPE, x, y, zeroCheck); } protected SignedDivNode(NodeClass<? extends SignedDivNode> c, ValueNode x, ValueNode y, GuardingNode zeroCheck) { super(c, IntegerStamp.OPS.getDiv().foldStamp(x.stamp(NodeView.DEFAULT), y.stamp(NodeView.DEFAULT)), Op.DIV, Type.SIGNED, x, y, zeroCheck);
*** 116,127 **** if (c == -1) { return NegateNode.create(forX, view); } long abs = Math.abs(c); if (CodeUtil.isPowerOf2(abs) && forX.stamp(view) instanceof IntegerStamp) { - ValueNode dividend = forX; IntegerStamp stampX = (IntegerStamp) forX.stamp(view); int log2 = CodeUtil.log2(abs); // no rounding if dividend is positive or if its low bits are always 0 if (stampX.canBeNegative() || (stampX.upMask() & (abs - 1)) != 0) { int bits = PrimitiveStamp.getBits(forX.stamp(view)); RightShiftNode sign = new RightShiftNode(forX, ConstantNode.forInt(bits - 1)); --- 116,127 ---- if (c == -1) { return NegateNode.create(forX, view); } long abs = Math.abs(c); if (CodeUtil.isPowerOf2(abs) && forX.stamp(view) instanceof IntegerStamp) { IntegerStamp stampX = (IntegerStamp) forX.stamp(view); + ValueNode dividend = forX; int log2 = CodeUtil.log2(abs); // no rounding if dividend is positive or if its low bits are always 0 if (stampX.canBeNegative() || (stampX.upMask() & (abs - 1)) != 0) { int bits = PrimitiveStamp.getBits(forX.stamp(view)); RightShiftNode sign = new RightShiftNode(forX, ConstantNode.forInt(bits - 1));
< prev index next >