[Liftoff] div/rem bug on ia32 |
||
Issue description
Found by fuzzing locally:
load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addFunction(undefined, kSig_i_v).addBody([
kExprI32Const, 0, // i32.const 0 [0]
kExprI32Const, 0, // i32.const 0 [0, 0]
kExprI32Const, 1, // i32.const 1 [0, 0, 1]
kExprI32RemS, // i32.rem_s -> 0 [0, 0]
kExprI32ShrS, // i32.shr_s -> 0 [0]
kExprI32Const, 0, // i32.const 0 [0, 0]
kExprI32Const, 0x7f, // i32.const -1 [0, 0, -1]
kExprI32RemS, // i32.rem_s -> 0 [0, 0]
kExprI32Const, 0, // i32.const 0 [0, 0, 0]
kExprI32Const, 1, // i32.const 1 [0, 0, 0, 1]
kExprI32GeU, // i32.ge_u -> 0 [0, 0, 0]
kExprI32GeS, // i32.ge_s -> 1 [0, 1]
kExprI32GeU, // i32.ge_u -> 0 [0]
]);
builder.addExport('main', 0);
const instance = builder.instantiate();
print(instance.exports.main(1, 2, 3));
Should produce 0, but produces one on Liftoff.
,
May 4 2018
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/c20d7f660513bd24e594d311420573408ca0b923 commit c20d7f660513bd24e594d311420573408ca0b923 Author: Clemens Hammacher <clemensh@chromium.org> Date: Fri May 04 13:36:39 2018 [Liftoff] Fix conditional spilling on div and rem On div and rem on ia32 and x64, we sometimes need to spill. If this spilling code happens inside of a branch, the cache state will reflect that the value was spilled, even though the actual spilling code might not have executed. R=titzer@chromium.org Bug: v8:6600, chromium:839800 Change-Id: I93b681a23119f903feb54235d6d44a7cbd5815fe Reviewed-on: https://chromium-review.googlesource.com/1044185 Reviewed-by: Ben Titzer <titzer@chromium.org> Commit-Queue: Clemens Hammacher <clemensh@chromium.org> Cr-Commit-Position: refs/heads/master@{#52995} [modify] https://crrev.com/c20d7f660513bd24e594d311420573408ca0b923/src/wasm/baseline/ia32/liftoff-assembler-ia32.h [modify] https://crrev.com/c20d7f660513bd24e594d311420573408ca0b923/src/wasm/baseline/x64/liftoff-assembler-x64.h [modify] https://crrev.com/c20d7f660513bd24e594d311420573408ca0b923/test/cctest/wasm/test-run-wasm.cc
,
May 4 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by bugdroid1@chromium.org
, May 4 2018