Commit f62356e0 authored by sreten.kovacevic's avatar sreten.kovacevic Committed by Commit Bot

[mips] Fix {AssembleArchLookupSwitch} implementation

Previous implementation used delay slot the wrong way.
Also, trampoline pools were not generated as they should.
MIPS64 changed to be the same as MIPS since there is probably
same problem that is masked.

test=wasm-spec-tests/tests/br_table

Change-Id: I94786233714a4a2f5eb86e74e02b7e7a7328bf2b
Reviewed-on: https://chromium-review.googlesource.com/901883Reviewed-by: 's avatarIvica Bogosavljevic <ivica.bogosavljevic@mips.com>
Commit-Queue: Ivica Bogosavljevic <ivica.bogosavljevic@mips.com>
Cr-Commit-Position: refs/heads/master@{#51100}
parent 34a8204a
...@@ -3254,9 +3254,8 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { ...@@ -3254,9 +3254,8 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) {
Register input = i.InputRegister(0); Register input = i.InputRegister(0);
for (size_t index = 2; index < instr->InputCount(); index += 2) { for (size_t index = 2; index < instr->InputCount(); index += 2) {
__ li(at, Operand(i.InputInt32(index + 0))); __ li(at, Operand(i.InputInt32(index + 0)));
__ beq(input, at, GetLabel(i.InputRpo(index + 1))); __ Branch(GetLabel(i.InputRpo(index + 1)), eq, input, Operand(at));
} }
__ nop(); // Branch delay slot of the last beq.
AssembleArchJump(i.InputRpo(1)); AssembleArchJump(i.InputRpo(1));
} }
......
...@@ -3523,9 +3523,8 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { ...@@ -3523,9 +3523,8 @@ void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) {
Register input = i.InputRegister(0); Register input = i.InputRegister(0);
for (size_t index = 2; index < instr->InputCount(); index += 2) { for (size_t index = 2; index < instr->InputCount(); index += 2) {
__ li(at, Operand(i.InputInt32(index + 0))); __ li(at, Operand(i.InputInt32(index + 0)));
__ beq(input, at, GetLabel(i.InputRpo(index + 1))); __ Branch(GetLabel(i.InputRpo(index + 1)), eq, input, Operand(at));
} }
__ nop(); // Branch delay slot of the last beq.
AssembleArchJump(i.InputRpo(1)); AssembleArchJump(i.InputRpo(1));
} }
......
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