changeset 19527:34c0014aaf5b

Merge
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Sat, 21 Feb 2015 19:48:22 +0100
parents 8fc336a04d77
children db19eba20b9c
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java
diffstat 1 files changed, 2 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Fri Feb 20 22:22:55 2015 +0100
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/MulNode.java	Sat Feb 21 19:48:22 2015 +0100
@@ -77,33 +77,8 @@
 
             if (c instanceof PrimitiveConstant && ((PrimitiveConstant) c).getKind().isNumericInteger()) {
                 long i = ((PrimitiveConstant) c).asLong();
-                boolean signFlip = false;
-                if (i < 0) {
-                    i = -i;
-                    signFlip = true;
-                }
-                if (i > 0) {
-                    ValueNode mulResult = null;
-                    long bit1 = i & -i;
-                    long bit2 = i - bit1;
-                    bit2 = bit2 & -bit2;    // Extract 2nd bit
-                    if (CodeUtil.isPowerOf2(i)) { //
-                        mulResult = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i)));
-                    } else if (bit2 + bit1 == i) { // We can work with two shifts and add
-                        ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit1)));
-                        ValueNode shift2 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(bit2)));
-                        mulResult = new AddNode(shift1, shift2);
-                    } else if (CodeUtil.isPowerOf2(i + 1)) { // shift and subtract
-                        ValueNode shift1 = new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i + 1)));
-                        mulResult = new SubNode(shift1, forX);
-                    }
-                    if (mulResult != null) {
-                        if (signFlip) {
-                            return new NegateNode(mulResult);
-                        } else {
-                            return mulResult;
-                        }
-                    }
+                if (i > 0 && CodeUtil.isPowerOf2(i)) {
+                    return new LeftShiftNode(forX, ConstantNode.forInt(CodeUtil.log2(i)));
                 }
             }