• fedor's avatar
    binary-operator-reducer: reduce mul+div(shift) · 461e5b49
    fedor authored
    Reduction Input:
    
        ChangeInt32ToFloat64=>          TruncateFloat64ToInt32
                             Float64Mul=>
        ChangeInt32ToFloat64=>          Float64Div=>TruncateFloat64ToInt32
    
    Output:
    
             =>  TruncateInt64ToInt32
    Int64Mul
             =>  Int64Shr => TruncateInt64ToInt32
    
    Test code:
    
        function mul(a, b) {
          var l = a & 0x3ffffff;
          var h = b & 0x3ffffff;
          var m = l * h;
    
          var rl = m & 0x3ffffff;
          var rh = (m / 0x4000000) | 0;
    
          return rl | rh;
        }
    
        mul(1, 2);
        var a0 = mul(0x3ffffff, 0x3ffffff);
        mul(0x0, 0x0);
        %OptimizeFunctionOnNextCall(mul);
        var a1 = mul(0x3ffffff, 0x3ffffff);
    
        print(a0 + ' == ' + a1);
    
    BUG=
    R=mstarzinger@chromium.org
    
    Review URL: https://codereview.chromium.org/1350223006
    
    Cr-Commit-Position: refs/heads/master@{#31899}
    461e5b49
Name
Last commit
Last update
..
base Loading commit data...
compiler Loading commit data...
heap Loading commit data...
interpreter Loading commit data...
libplatform Loading commit data...
runtime Loading commit data...
DEPS Loading commit data...
atomic-utils-unittest.cc Loading commit data...
char-predicates-unittest.cc Loading commit data...
counters-unittest.cc Loading commit data...
run-all-unittests.cc Loading commit data...
test-utils.cc Loading commit data...
test-utils.h Loading commit data...
unittests.gyp Loading commit data...
unittests.isolate Loading commit data...
unittests.status Loading commit data...