Commit 8b5d1aa6 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [wasm] Fix codegen issue for i64.add and i64.sub on ia32.

  port 037200e6 (r42486)

  original commit message:
  The IA32AddPair and IA32SubPair instructions were using an input register as a
  temporary value, which led to registers sometimes being clobbered when they
  shouldn't have been. This led to problems, for example, in calling printf to
  format doubles:

  printf("%f", 1.2345) => 0.61725 (on x86)

BUG=

Review-Url: https://codereview.chromium.org/2645233002
Cr-Commit-Position: refs/heads/master@{#42587}
parent 932cf29f
......@@ -994,10 +994,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
} else {
__ add(i.OutputRegister(0), i.InputRegister(2));
}
__ adc(i.InputRegister(1), Operand(i.InputRegister(3)));
if (i.OutputRegister(1).code() != i.InputRegister(1).code()) {
__ Move(i.OutputRegister(1), i.InputRegister(1));
}
__ adc(i.OutputRegister(1), Operand(i.InputRegister(3)));
if (use_temp) {
__ Move(i.OutputRegister(0), i.TempRegister(0));
}
......@@ -1019,10 +1019,10 @@ CodeGenerator::CodeGenResult CodeGenerator::AssembleArchInstruction(
} else {
__ sub(i.OutputRegister(0), i.InputRegister(2));
}
__ sbb(i.InputRegister(1), Operand(i.InputRegister(3)));
if (i.OutputRegister(1).code() != i.InputRegister(1).code()) {
__ Move(i.OutputRegister(1), i.InputRegister(1));
}
__ sbb(i.OutputRegister(1), Operand(i.InputRegister(3)));
if (use_temp) {
__ Move(i.OutputRegister(0), i.TempRegister(0));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment